本文整理了Java中javax.swing.JPanel.paintComponent()
方法的一些代码示例,展示了JPanel.paintComponent()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JPanel.paintComponent()
方法的具体详情如下:
包路径:javax.swing.JPanel
类名称:JPanel
方法名:paintComponent
暂无
代码示例来源:origin: stanfordnlp/CoreNLP
protected void superPaint(Graphics g) {
super.paintComponent(g);
}
代码示例来源:origin: libgdx/libgdx
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
g.drawImage(image, 0, 0, null); // see javadoc for more info on the parameters
}
代码示例来源:origin: libgdx/libgdx
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
g.drawImage(image, 0, 0, null); // see javadoc for more info on the parameters
}
代码示例来源:origin: wildfly/wildfly
public void paintComponent(Graphics g) {
super.paintComponent(g);
if(img != null) {
g.drawImage(img, 0, 0, null);
}
}
代码示例来源:origin: wildfly/wildfly
public void paintComponent(Graphics g) {
super.paintComponent(g);
if(img != null) {
g.drawImage(img, 0, 0, null);
}
}
代码示例来源:origin: kiegroup/optaplanner
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
if (canvas != null) {
g.drawImage(canvas, 0, 0, this);
}
}
代码示例来源:origin: kiegroup/optaplanner
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
if (canvas != null) {
g.drawImage(canvas, 0, 0, this);
}
}
代码示例来源:origin: kiegroup/optaplanner
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
if (canvas != null) {
g.drawImage(canvas, 0, 0, this);
}
}
代码示例来源:origin: kiegroup/optaplanner
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
if (canvas != null) {
g.drawImage(canvas, 0, 0, this);
}
}
代码示例来源:origin: libgdx/libgdx
protected void paintComponent (Graphics graphics) {
super.paintComponent(graphics);
Graphics2D g = (Graphics2D)graphics;
int width = getWidth();
int height = getHeight();
g.setColor(bgColor);
g.fillRect(border, border, width - border * 2, height - border * 2);
int maxKnobX = width - border - KNOB_WIDTH;
int knobX = (int)((width - border * 2 - KNOB_WIDTH) * (value - sliderMin) / (sliderMax - sliderMin)) + border;
g.setColor(knobColor);
g.fillRect(Math.max(border, Math.min(maxKnobX, knobX)), 0, KNOB_WIDTH, height);
float displayValue = (int)(value * 10) / 10f;
String label = displayValue == (int)displayValue ? String.valueOf((int)displayValue) : String.valueOf(displayValue);
FontMetrics metrics = g.getFontMetrics();
int labelWidth = metrics.stringWidth(label);
g.setColor(Color.white);
g.drawString(label, width / 2 - labelWidth / 2, height / 2 + metrics.getAscent() / 2);
}
代码示例来源:origin: libgdx/libgdx
protected void paintComponent (Graphics graphics) {
super.paintComponent(graphics);
Graphics2D g = (Graphics2D)graphics;
int width = getWidth();
int height = getHeight();
g.setColor(bgColor);
g.fillRect(border, border, width - border * 2, height - border * 2);
int maxKnobX = width - border - KNOB_WIDTH;
int knobX = (int)((width - border * 2 - KNOB_WIDTH) * (value - sliderMin) / (sliderMax - sliderMin)) + border;
g.setColor(knobColor);
g.fillRect(Math.max(border, Math.min(maxKnobX, knobX)), 0, KNOB_WIDTH, height);
float displayValue = (int)(value * 10) / 10f;
String label = displayValue == (int)displayValue ? String.valueOf((int)displayValue) : String.valueOf(displayValue);
FontMetrics metrics = g.getFontMetrics();
int labelWidth = metrics.stringWidth(label);
g.setColor(Color.white);
g.drawString(label, width / 2 - labelWidth / 2, height / 2 + metrics.getAscent() / 2);
}
代码示例来源:origin: cmusphinx/sphinx4
/**
* Paint the component. This will be called by AWT/Swing.
*
* @param g The <code>Graphics</code> to draw on.
*/
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
if (vu != null) {
paintVUMeter(g);
}
}
代码示例来源:origin: kiegroup/optaplanner
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
BufferedImage canvas = solutionPainter.getCanvas();
if (canvas != null) {
g.drawImage(canvas, 0, 0, this);
}
}
代码示例来源:origin: libgdx/libgdx
protected void paintComponent (Graphics graphics) {
super.paintComponent(graphics);
Graphics2D g = (Graphics2D)graphics;
int width = getWidth() - 1;
代码示例来源:origin: libgdx/libgdx
protected void paintComponent (Graphics graphics) {
super.paintComponent(graphics);
Graphics2D g = (Graphics2D)graphics;
int width = getWidth() - 1;
代码示例来源:origin: kiegroup/optaplanner
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
g.setColor(TangoColorFactory.ALUMINIUM_2);
int lineX = HEADER_COLUMN_WIDTH + consumedDuration;
g.fillRect(HEADER_COLUMN_WIDTH, 0, lineX, getHeight());
g.setColor(Color.WHITE);
g.fillRect(lineX, 0, getWidth(), getHeight());
}
代码示例来源:origin: sarxos/webcam-capture
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
if (image == null) {
painter.paintPanel(this, (Graphics2D) g);
} else {
painter.paintImage(this, image, (Graphics2D) g);
}
}
代码示例来源:origin: runelite/runelite
@Override
public void paintComponent(Graphics g)
{
super.paintComponent(g);
int w = getWidth();
int h = getHeight();
int div = (value * w) / maximumValue;
g.setColor(getBackground());
g.fillRect(div, 0, w, h);
g.setColor(getForeground());
g.fillRect(0, 0, div, h);
}
}
代码示例来源:origin: skylot/jadx
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
applyRenderHints(g);
代码示例来源:origin: apache/geode
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2 = (Graphics2D) g.create();
// TODO - we should clip these to the visible lines
for (SubDiagram subDiagram : subDiagrams.values()) {
subDiagram.paintStates(g2, colorMap);
}
for (SubDiagram subDiagram : subDiagrams.values()) {
subDiagram.paintArrows(g2, colorMap);
}
paintHighlightedComponents(g2, selectedState, new HashSet<LifelineState>());
}
内容来源于网络,如有侵权,请联系作者删除!