@Override public void paintIcon(Component c, Graphics g, int x, int y) { if (c instanceof AbstractButton) { AbstractButton model = (AbstractButton) c; Icon icon = null; if (!model.isEnabled()) { icon = UIManager.getLookAndFeel().getDisabledIcon(model, mouseIcon); } if (icon == null) { icon = mouseIcon; } icon.paintIcon(c, g, x, y); } }
@Override public void paintIcon(Component c, Graphics g, int x, int y) { if (c instanceof AbstractButton) { AbstractButton model = (AbstractButton) c; Icon icon = null; if (!model.isEnabled()) { icon = UIManager.getLookAndFeel().getDisabledIcon(model, mouseIcon); } if (icon == null) { icon = mouseIcon; } icon.paintIcon(c, g, x, y); } }
@Override public void paintIcon(Component c, Graphics g, int x, int y) { if (c instanceof AbstractButton) { AbstractButton model = (AbstractButton) c; Icon icon = null; if (!model.isEnabled()) { icon = UIManager.getLookAndFeel().getDisabledIcon(model, mouseIcon); } if (icon == null) { icon = mouseIcon; } icon.paintIcon(c, g, x, y); } }
return null; Icon result = UIManager.getLookAndFeel().getDisabledIcon( parent, icon ); if( result != null ) return result; g.dispose(); icon = new ImageIcon( image ); result = UIManager.getLookAndFeel().getDisabledIcon( parent, icon );
@Override public void paintIcon(Component c, Graphics g, int x, int y) { if (c instanceof AbstractButton) { AbstractButton model = (AbstractButton) c; Icon icon = null; if (!model.isEnabled()) { icon = UIManager.getLookAndFeel().getDisabledIcon(model, mouseIcon); } if (icon == null) { icon = mouseIcon; } icon.paintIcon(c, g, x, y); if (smallIcon != null) { Icon sIcon = null; if (!model.isEnabled()) { sIcon = UIManager.getLookAndFeel().getDisabledIcon(model, smallIcon); } if (sIcon == null) { sIcon = smallIcon; } int sx = x + mouseIcon.getIconWidth() - sIcon.getIconWidth(); int sy = y + mouseIcon.getIconHeight() - sIcon.getIconHeight(); sIcon.paintIcon(c, g, sx, sy); } } }
@Override public void paintIcon(Component c, Graphics g, int x, int y) { if (c instanceof AbstractButton) { AbstractButton model = (AbstractButton) c; Icon icon = null; if (!model.isEnabled()) { icon = UIManager.getLookAndFeel().getDisabledIcon(model, mouseIcon); } if (icon == null) { icon = mouseIcon; } if (smallIcon != null) { Icon sIcon = null; if (!model.isEnabled()) { sIcon = UIManager.getLookAndFeel().getDisabledIcon(model, smallIcon); } if (sIcon == null) { sIcon = smallIcon; } int x2 = x + mouseIcon.getIconWidth() / 2 - sIcon.getIconWidth() / 2; int y2 = y + mouseIcon.getIconHeight() / 2 - sIcon.getIconHeight() / 2; sIcon.paintIcon(c, g, x2, y2); } icon.paintIcon(c, g, x, y); } }
@Override public void paintIcon(Component c, Graphics g, int x, int y) { if (c instanceof AbstractButton) { AbstractButton model = (AbstractButton) c; Icon icon = null; if (!model.isEnabled()) { icon = UIManager.getLookAndFeel().getDisabledIcon(model, bckIcon); } if (icon == null) { icon = bckIcon; } icon.paintIcon(c, g, x, y); if (graphic != null) { Icon smallIcon = null; if (!model.isEnabled()) { smallIcon = UIManager.getLookAndFeel().getDisabledIcon(model, graphic.getIcon()); } if (smallIcon == null) { smallIcon = graphic.getIcon(); } if (smallIcon != null) { int offsetx = bckIcon.getIconWidth() - smallIcon.getIconWidth() - 1; int offsety = bckIcon.getIconHeight() - smallIcon.getIconHeight() - 1; smallIcon.paintIcon(c, g, x + offsetx, y + offsety); } } } }
protected Icon getClosedIcon(Object value) { if (value instanceof PrestimeCPUCCTNode) { PrestimeCPUCCTNode cct = (PrestimeCPUCCTNode) value; if (cct.isThreadNode()) { if (cct.getThreadId() == -1) { return allThreadsIcon; } else { return threadIcon; } } else if (cct.isFilteredNode()) { return UIManager.getLookAndFeel().getDisabledIcon(this, super.getClosedIcon(value)); } } else if (value instanceof PresoObjAllocCCTNode) { if (((PresoObjAllocCCTNode)value).isFilteredNode()) { return UIManager.getLookAndFeel().getDisabledIcon(this, super.getClosedIcon(value)); } } // not a thread node or not instance of PrestimeCPUCCTNode return super.getClosedIcon(value); }
protected Icon getLeafIcon(Object value) { if (value instanceof PrestimeCPUCCTNode) { PrestimeCPUCCTNode cct = (PrestimeCPUCCTNode) value; if (cct.isThreadNode()) { if (cct.getThreadId() == -1) { return allThreadsIcon; } else { return threadIcon; } } else if (cct.isFilteredNode()) { return UIManager.getLookAndFeel().getDisabledIcon(this, super.getLeafIcon(value)); } } else if (value instanceof PresoObjAllocCCTNode) { if (((PresoObjAllocCCTNode)value).isFilteredNode()) { return UIManager.getLookAndFeel().getDisabledIcon(this, super.getLeafIcon(value)); } } // not a thread node or not instance of PrestimeCPUCCTNode return super.getLeafIcon(value); }
protected Icon getOpenIcon(Object value) { if (value instanceof PrestimeCPUCCTNode) { PrestimeCPUCCTNode cct = (PrestimeCPUCCTNode) value; if (cct.isThreadNode()) { if (cct.getThreadId() == -1) { return allThreadsIcon; } else { return threadIcon; } } else if (cct.isFilteredNode()) { return UIManager.getLookAndFeel().getDisabledIcon(this, super.getOpenIcon(value)); } } else if (value instanceof PresoObjAllocCCTNode) { if (((PresoObjAllocCCTNode)value).isFilteredNode()) { return UIManager.getLookAndFeel().getDisabledIcon(this, super.getOpenIcon(value)); } } // not a thread node or not instance of PrestimeCPUCCTNode return super.getOpenIcon(value); } }
button3.setIcon( UIManager.getLookAndFeel().getDisabledIcon(null, original) ); add(button3);