本文整理了Java中javax.swing.AbstractButton.isBorderPainted()
方法的一些代码示例,展示了AbstractButton.isBorderPainted()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AbstractButton.isBorderPainted()
方法的具体详情如下:
包路径:javax.swing.AbstractButton
类名称:AbstractButton
方法名:isBorderPainted
暂无
代码示例来源:origin: com.github.arnabk/pgslookandfeel
public Insets getBorderInsets(Component c) {
if (((AbstractButton) c).isBorderPainted()) {
return INSETS;
}
return NO_INSETS;
}
代码示例来源:origin: com.jidesoft/jide-oss
@Override
public void paintHeaderBoxBackground(JComponent c, Graphics g, Rectangle rect, int orientation, int state) {
boolean paintBorder = !(c instanceof AbstractButton) || ((AbstractButton) c).isBorderPainted();
paintButtonBackground(c, g, rect, orientation, state, paintBorder);
if (!paintBorder) {
Color old = g.getColor();
g.setColor(UIDefaultsLookup.getColor("Table.gridColor"));
g.drawLine(rect.x + rect.width - 1, rect.y, rect.x + rect.width - 1, rect.y + rect.height - 1);
g.drawLine(rect.x, rect.y + rect.height - 1, rect.x + rect.width - 1, rect.y + rect.height - 1);
g.setColor(old);
}
}
代码示例来源:origin: org.softsmithy.lib/softsmithy-lib-swing
/**
* {@inheritDoc }
*/
@Override
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.DESELECTED) {
if (!mouseIsOver && button.isBorderPainted()) {
button.setBorderPainted(false);
}
} else { // ItemEvent.SELECTED
if (!mouseIsOver && !button.isBorderPainted() && button.isEnabled()) {
button.setBorderPainted(true);
}
}
}
代码示例来源:origin: org.softsmithy.lib/lib-core
/** Invoked when an item has been selected or deselected by the user.
* The code written for this method performs the operations
* that need to occur when an item is selected (or deselected).
*
*/
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.DESELECTED) {
if (!mouseIsOver && button.isBorderPainted()) {
button.setBorderPainted(false);
}
} else { // ItemEvent.SELECTED
if (!mouseIsOver && !button.isBorderPainted() && button.isEnabled()) {
button.setBorderPainted(true);
}
}
}
代码示例来源:origin: org.softsmithy.lib/lib-core
/** Invoked when the mouse enters a component.
*
*/
@Override
public void mouseEntered(MouseEvent e) {
if (!button.isBorderPainted() && button.isEnabled()) {
button.setBorderPainted(true);
}
mouseIsOver = true;
}
代码示例来源:origin: com.github.arnabk/pgslookandfeel
public Insets getBorderInsets(Component c, Insets newInsets) {
if (((AbstractButton) c).isBorderPainted()) {
return getBorderInsets(c, newInsets, INSETS);
}
return getBorderInsets(c, newInsets, NO_INSETS);
}
代码示例来源:origin: org.softsmithy.lib/lib-core
/** Invoked when the mouse exits a component.
*
*/
@Override
public void mouseExited(MouseEvent e) {
if (button.isBorderPainted() && !button.isSelected()) {
button.setBorderPainted(false);
}
mouseIsOver = false;
}
代码示例来源:origin: org.softsmithy.lib/softsmithy-lib-swing
/**
* {@inheritDoc }
*/
@Override
public void mouseExited(MouseEvent e) {
if (button.isBorderPainted() && !button.isSelected()) {
button.setBorderPainted(false);
}
mouseIsOver = false;
}
代码示例来源:origin: org.softsmithy.lib/softsmithy-lib-swing
/**
* Invoked when the mouse enters a component.
*/
@Override
public void mouseEntered(MouseEvent e) {
if (!button.isBorderPainted() && button.isEnabled()) {
button.setBorderPainted(true);
}
mouseIsOver = true;
}
代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw
@Override
public void paint(Graphics g, JComponent c) {
AbstractButton button = (AbstractButton) c;
if (button.isBorderPainted() && (c.getBorder() instanceof BackdropBorder)) {
BackdropBorder bb = (BackdropBorder) c.getBorder();
bb.getBackdropBorder().paintBorder(c, g, 0, 0, c.getWidth(), c.getHeight());
}
super.paint(g, c);
}
}
代码示例来源:origin: net.sf.nimrod/nimrod-laf
public void paintBorder( Component c, Graphics g, int x, int y, int w, int h) {
if ( !((AbstractButton)c).isBorderPainted() ) {
return;
}
g.translate( x, y);
Graphics2D g2D = (Graphics2D)g;
g2D.setRenderingHint( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2D.setColor( NimRODLookAndFeel.getControlDarkShadow());
g2D.drawRoundRect( 0,0, w-1,h-1, 8,8);
if ( c instanceof JButton ) {
JButton button = (JButton)c;
//ButtonModel model = button.getModel();
if ( button.isDefaultButton() ) {
g2D.setColor( NimRODLookAndFeel.getControlDarkShadow().darker());
g2D.drawRoundRect( 1,1, w-3,h-3, 7,7);
}
/*else if ( model.isPressed() && model.isArmed() ) {
g.translate( x, y);
g.setColor( NimRODLookAndFeel.getControlDarkShadow() );
g.drawRoundRect( 0,0, w-1,h-1, 8,8);
}*/
}
g2D.setRenderingHint( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_DEFAULT);
}
代码示例来源:origin: com.jtattoo/JTattoo
protected void paintBackground(Graphics g, AbstractButton b) {
if (!b.isContentAreaFilled() || (b.getParent() instanceof JMenuBar)) {
return;
}
int width = b.getWidth();
int height = b.getHeight();
Graphics2D g2D = (Graphics2D) g;
Shape savedClip = g.getClip();
if ((b.getBorder() != null) && b.isBorderPainted() && (b.getBorder() instanceof UIResource)) {
Area clipArea = new Area(new Rectangle2D.Double(1, 1, width - 2, height - 2));
if (savedClip != null) {
clipArea.intersect(new Area(savedClip));
}
g2D.setClip(clipArea);
}
super.paintBackground(g, b);
g2D.setClip(savedClip);
}
代码示例来源:origin: com.jtattoo/JTattoo
protected void paintBackground(Graphics g, AbstractButton b) {
super.paintBackground(g, b);
if (b.isContentAreaFilled() && b.isRolloverEnabled() && b.getModel().isRollover() && b.isBorderPainted() && (b.getBorder() != null)) {
g.setColor(AbstractLookAndFeel.getFocusColor());
g.drawLine(1, 1, b.getWidth() - 1, 1);
g.drawLine(1, 2, b.getWidth() - 1, 2);
g.drawLine(1, 3, b.getWidth() - 1, 3);
}
}
}
代码示例来源:origin: net.sf.nimrod/nimrod-laf
public void paintBorder( Component c, Graphics g, int x, int y, int w, int h) {
if ( !((AbstractButton)c).isBorderPainted() ) {
return;
代码示例来源:origin: com.jtattoo/JTattoo
protected void paintBackground(Graphics g, AbstractButton b) {
int w = b.getWidth();
int h = b.getHeight();
Graphics2D g2D = (Graphics2D) g;
Shape savedClip = g.getClip();
if ((b.getBorder() != null) && b.isBorderPainted() && (b.getBorder() instanceof UIResource)) {
Area clipArea = new Area(new RoundRectangle2D.Double(0, 0, w - 1, h - 1, 6, 6));
if (savedClip != null) {
clipArea.intersect(new Area(savedClip));
}
g2D.setClip(clipArea);
}
super.paintBackground(g, b);
if (b.isContentAreaFilled() && b.isRolloverEnabled() && b.getModel().isRollover() && b.isBorderPainted() && (b.getBorder() != null)) {
g.setColor(AbstractLookAndFeel.getTheme().getFocusColor());
Insets ins = b.getBorder().getBorderInsets(b);
if (ins.top == 0) {
g.drawLine(1, 0, w - 1, 0);
g.drawLine(1, 1, w - 1, 1);
g.drawLine(1, 2, w - 1, 2);
} else {
g.drawLine(1, 1, w - 1, 1);
g.drawLine(1, 2, w - 1, 2);
g.drawLine(1, 3, w - 1, 3);
}
}
g2D.setClip(savedClip);
}
}
代码示例来源:origin: fr.avianey.apache-xmlgraphics/batik
||
(cmp instanceof JProgressBar) ){
if( ((cmp instanceof AbstractButton) && ((AbstractButton)cmp).isBorderPainted())
||
((cmp instanceof JPopupMenu) && ((JPopupMenu)cmp).isBorderPainted())
代码示例来源:origin: com.jtattoo/JTattoo
protected void paintBackground(Graphics g, AbstractButton b) {
int w = b.getWidth();
int h = b.getHeight();
Graphics2D g2D = (Graphics2D) g;
Shape savedClip = g.getClip();
if ((b.getBorder() != null) && b.isBorderPainted() && (b.getBorder() instanceof UIResource)) {
Area clipArea = new Area(new RoundRectangle2D.Double(0, 0, w - 1, h - 1, 6, 6));
if (savedClip != null) {
clipArea.intersect(new Area(savedClip));
}
g2D.setClip(clipArea);
}
super.paintBackground(g, b);
if (b.isContentAreaFilled() && b.isRolloverEnabled() && b.getModel().isRollover() && (b.getBorder() != null) && b.isBorderPainted()) {
g.setColor(AbstractLookAndFeel.getTheme().getFocusColor());
Insets ins = b.getBorder().getBorderInsets(b);
if ((ins.top == 0) && (ins.left == 1)) {
g.drawRect(1, 0, w - 2, h - 1);
g.drawRect(2, 1, w - 4, h - 3);
} else {
g.drawRect(1, 1, w - 4, h - 4);
g.drawRect(2, 2, w - 6, h - 6);
}
}
g2D.setClip(savedClip);
}
代码示例来源:origin: com.jtattoo/JTattoo
protected void paintBackground(Graphics g, AbstractButton b) {
if (AbstractLookAndFeel.getTheme().doDrawSquareButtons()) {
super.paintBackground(g, b);
} else {
Graphics2D g2D = (Graphics2D) g;
Shape savedClip = g.getClip();
if ((b.getBorder() != null) && b.isBorderPainted() && (b.getBorder() instanceof UIResource)) {
int w = b.getWidth();
int h = b.getHeight();
Area clipArea = new Area(new RoundRectangle2D.Double(0, 0, w - 1, h - 1, 6, 6));
clipArea.intersect(new Area(savedClip));
g2D.setClip(clipArea);
}
super.paintBackground(g, b);
g2D.setClip(savedClip);
}
}
代码示例来源:origin: com.jtattoo/JTattoo
protected void paintBackground(Graphics g, AbstractButton b) {
if (AbstractLookAndFeel.getTheme().doDrawSquareButtons()) {
super.paintBackground(g, b);
} else {
int w = b.getWidth();
int h = b.getHeight();
Graphics2D g2D = (Graphics2D) g;
Shape savedClip = g.getClip();
if ((b.getBorder() != null) && b.isBorderPainted() && (b.getBorder() instanceof UIResource)) {
Area clipArea = new Area(new RoundRectangle2D.Double(0, 0, w -1, h - 1, 6, 6));
if (savedClip != null) {
clipArea.intersect(new Area(savedClip));
}
g2D.setClip(clipArea);
}
super.paintBackground(g, b);
g2D.setClip(savedClip);
}
}
}
代码示例来源:origin: com.jtattoo/JTattoo
protected void paintBackground(Graphics g, AbstractButton b) {
if (AbstractLookAndFeel.getTheme().doDrawSquareButtons()) {
super.paintBackground(g, b);
} else {
int w = b.getWidth();
int h = b.getHeight();
Graphics2D g2D = (Graphics2D) g;
Shape savedClip = g.getClip();
if ((b.getBorder() != null) && b.isBorderPainted() && (b.getBorder() instanceof UIResource)) {
Area clipArea = new Area(new RoundRectangle2D.Double(0, 0, w - 1, h - 1, 6, 6));
if (savedClip != null) {
clipArea.intersect(new Area(savedClip));
}
g2D.setClip(clipArea);
}
super.paintBackground(g, b);
g2D.setClip(savedClip);
}
}
内容来源于网络,如有侵权,请联系作者删除!