本文整理了Java中javax.swing.JButton.paintComponent()
方法的一些代码示例,展示了JButton.paintComponent()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JButton.paintComponent()
方法的具体详情如下:
包路径:javax.swing.JButton
类名称:JButton
方法名:paintComponent
暂无
代码示例来源:origin: libgdx/libgdx
@Override
protected void paintComponent (Graphics g) {
if (getModel().isPressed()) {
g.setColor(pressedColor);
} else if (getModel().isRollover()) {
g.setColor(overColor);
} else {
g.setColor(getBackground());
}
g.fillRect(0, 0, getWidth(), getHeight());
super.paintComponent(g);
}
}
代码示例来源:origin: magefree/mage
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
if (text != null) {
g.setColor(Color.GRAY);
int dx = 15;
int dy = 17;
g.setColor(Color.WHITE);
if (text.length() > 5) {
g.drawString(this.text, 8, dy);
} else {
g.drawString(this.text, dx, dy);
}
}
}
代码示例来源:origin: org.cytoscape/vizmap-gui-impl
@Override
protected void paintComponent(final Graphics g) {
paintBackground(g, this);
super.paintComponent(g);
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-xml-xam-ui
protected void paintComponent(Graphics g) {
Graphics2D g2 = (Graphics2D) g;
Map rhints = (Map) Toolkit.getDefaultToolkit().getDesktopProperty(
"awt.font.desktophints"); // NOI18N
if (rhints == null && Boolean.getBoolean("swing.aatext")) { // NOI18N
g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
} else if (rhints != null) {
g2.addRenderingHints(rhints);
}
super.paintComponent(g2);
}
代码示例来源:origin: org.cytoscape/vizmap-gui-impl
@Override
public void paintComponent(final Graphics g) {
super.paintComponent(g);
if (showMenuArrowIcon) {
final Dimension size = getSize();
final Insets ins = getInsets();
int x = size.width - buttonIcon.getIconWidth() - ins.right;
int y = ins.top + ((size.height - ins.top - ins.bottom - buttonIcon.getIconHeight()) / 2);
buttonIcon.paintIcon(this, g, x, y);
}
}
代码示例来源:origin: hneemann/Digital
@Override
protected void paintComponent(Graphics graphics) {
graphics.setColor(Color.WHITE);
graphics.fillRect(0, 0, getWidth(), getHeight());
super.paintComponent(graphics);
}
};
代码示例来源:origin: org.cytoscape/swing-util-api
/**
* {@inheritDoc}
*/
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
final Dimension dim = getSize();
final Insets ins = getInsets();
final int x = dim.width - ins.right;
final int y = ins.top + ((dim.height - ins.top - ins.bottom - buttonIcon.getIconHeight()) / 2);
buttonIcon.paintIcon(this, g, x, y);
}
代码示例来源:origin: com.google.code.maven-play-plugin.org.xhtmlrenderer/core-renderer
protected void paintComponent(Graphics g) {
super.paintComponent(g);
g.drawImage(img, 0, 0, getWidth(), getHeight(), null);
}
代码示例来源:origin: nl.cloudfarming.client/util-swing
@Override
public void paint(Graphics g) {
super.paintComponent(g);
if(!isEnabled()){
g.drawImage(disabledImage, 0, 0, backGround, null);
} else if (isFocusPainted() && isFocusOwner() && selectedImage != null) {
g.drawImage(selectedImage, 0, 0, backGround, null);
}
else {
g.drawImage(image, 0, 0, backGround, null);
}
}
代码示例来源:origin: eu.agrosense.client/util-swing
@Override
public void paint(Graphics g) {
super.paintComponent(g);
if(!isEnabled()){
g.drawImage(disabledImage, 0, 0, backGround, null);
} else if (isFocusPainted() && isFocusOwner() && selectedImage != null) {
g.drawImage(selectedImage, 0, 0, backGround, null);
}
else {
g.drawImage(image, 0, 0, backGround, null);
}
}
代码示例来源:origin: antlr/antlrworks
@Override
protected void paintComponent(Graphics g) {
if(isEnabled()) {
if(inside) {
g.setColor(Color.lightGray);
g.fillRect(0, 0, getWidth(), getHeight());
g.setColor(Color.darkGray);
g.drawRect(0, 0, getWidth()-1, getHeight()-1);
}
}
super.paintComponent(g);
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-visualweb-propertyeditors
public void paintComponent(Graphics graphics) {
super.paintComponent(graphics);
Graphics2D g2d = (Graphics2D) graphics;
Color color = colorModel.getColor();
if(color == null) color = Color.BLACK;
g2d.setColor(color);
int w = getWidth();
int h = getHeight();
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.fillRoundRect(4,4,w-9,h-9,5,5);
g2d.setColor(color.darker());
g2d.drawRoundRect(4,4,w-9,h-9,5,5);
}
代码示例来源:origin: com.metsci.glimpse/glimpse-docking
@Override
public void paintComponent( Graphics g )
{
Tile tile = tileRef[0];
MultiSplitPane docker = getAncestorOfClass( MultiSplitPane.class, tile );
setIcon( docker.getMaximizedLeaf( ) == tile ? theme.unmaximizeIcon : theme.maximizeIcon );
super.paintComponent( g );
}
};
代码示例来源:origin: org.codehaus.jtstand/jtstand-desktop
protected void paintComponent(Graphics g) {
Painter<JXButton> bgPainter = getBackgroundPainter();
Painter<JXButton> fgPainter = getForegroundPainter();
if (painting || (bgPainter == null && fgPainter == null)) {
super.paintComponent(g);
} else {
invokePainter(g, bgPainter);
invokePainter(g, fgPainter);
}
}
代码示例来源:origin: com.synaptix/SynaptixSwing
protected void paintComponent(Graphics g) {
paintBlock(g);
paintGrid(g);
if (outOfMonth) {
this.setForeground(COLOR_OUT_OF_MONTH_DAY);
this.setFont(italicFont);
} else {
this.setForeground(COLOR_IN_OF_MONTH_DAY);
this.setFont(boldFont);
}
super.paintComponent(g);
}
代码示例来源:origin: com.synaptix/SynaptixSwing
protected void paintComponent(Graphics g) {
paintBlock(g);
paintGrid(g);
if (outOfMonth) {
this.setForeground(COLOR_OUT_OF_MONTH_DAY);
this.setFont(italicFont);
} else {
this.setForeground(COLOR_IN_OF_MONTH_DAY);
this.setFont(boldFont);
}
super.paintComponent(g);
}
代码示例来源:origin: com.synaptix/SynaptixSwing
protected void paintComponent(Graphics g) {
paintBlock(g);
paintGrid(g);
if (outOfMonth) {
this.setForeground(COLOR_OUT_OF_MONTH_DAY);
this.setFont(italicFont);
} else {
this.setForeground(COLOR_IN_OF_MONTH_DAY);
this.setFont(boldFont);
}
super.paintComponent(g);
}
代码示例来源:origin: com.synaptix/SynaptixSwing
protected void paintComponent(Graphics g) {
ButtonModel model = this.getModel();
if (model.isSelected() || model.isArmed()) {
this.setForeground(COLOR_FORGROUND_MONTH_YEAR_ROLLOVER);
} else if (model.isRollover()) {
this.setForeground(COLOR_FORGROUND_MONTH_YEAR_ROLLOVER);
} else {
this.setForeground(COLOR_FORGROUND_MONTH_YEAR_ON);
}
super.paintComponent(g);
}
代码示例来源:origin: com.synaptix/SynaptixSwing
protected void paintComponent(Graphics g) {
ButtonModel model = this.getModel();
if (model.isSelected() || model.isArmed()) {
this.setForeground(COLOR_FORGROUND_NONE_ROLLOVER);
} else if (model.isRollover()) {
this.setForeground(COLOR_FORGROUND_NONE_ROLLOVER);
} else {
this.setForeground(COLOR_FORGROUND_NONE_ON);
}
super.paintComponent(g);
}
代码示例来源:origin: com.synaptix/SynaptixSwing
protected void paintComponent(Graphics g) {
ButtonModel model = this.getModel();
if (model.isSelected() || model.isArmed()) {
this.setForeground(COLOR_FORGROUND_NONE_ROLLOVER);
} else if (model.isRollover()) {
this.setForeground(COLOR_FORGROUND_NONE_ROLLOVER);
} else {
this.setForeground(COLOR_FORGROUND_NONE_ON);
}
super.paintComponent(g);
}
内容来源于网络,如有侵权,请联系作者删除!