public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { AbstractButton button = (AbstractButton) c; ButtonModel model = button.getModel(); if (model.isEnabled()) { if ((model.isPressed() && model.isArmed()) || model.isSelected()) { Color frameColor = ColorHelper.darker(AbstractLookAndFeel.getToolbarBackgroundColor(), 30); g.setColor(frameColor); g.drawRect(x, y, w - 1, h - 1); Graphics2D g2D = (Graphics2D) g; Composite composite = g2D.getComposite(); AlphaComposite alpha = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.1f); g2D.setComposite(alpha); g.setColor(Color.black); g.fillRect(x + 1, y + 1, w - 2, h - 2); g2D.setComposite(composite); } else if (model.isRollover()) { Color frameColor = AbstractLookAndFeel.getToolbarBackgroundColor(); Color frameHiColor = ColorHelper.darker(frameColor, 5); Color frameLoColor = ColorHelper.darker(frameColor, 20); JTattooUtilities.draw3DBorder(g, frameHiColor, frameLoColor, x, y, w, h); frameHiColor = Color.white; frameLoColor = ColorHelper.brighter(frameLoColor, 60); JTattooUtilities.draw3DBorder(g, frameHiColor, frameLoColor, x + 1, y + 1, w - 2, h - 2); Graphics2D g2D = (Graphics2D) g; Composite composite = g2D.getComposite(); AlphaComposite alpha = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.4f); g2D.setComposite(alpha); g.setColor(Color.white); g.fillRect(x + 2, y + 2, w - 4, h - 4); g2D.setComposite(composite); g.setColor(AbstractLookAndFeel.getFocusColor()); g.drawLine(x + 1, y + 1, x + w - 1, y + 1); g.drawLine(x + 1, y + 2, x + w - 2, y + 2); } else if (model.isSelected()) { Color frameColor = AbstractLookAndFeel.getToolbarBackgroundColor(); Color frameHiColor = Color.white; Color frameLoColor = ColorHelper.darker(frameColor, 30); JTattooUtilities.draw3DBorder(g, frameLoColor, frameHiColor, x, y, w, h); } } }
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { AbstractButton button = (AbstractButton) c; ButtonModel model = button.getModel(); Color frameColor = AbstractLookAndFeel.getToolbarBackgroundColor(); Color frameHiColor = ColorHelper.brighter(frameColor, 10); Color frameLoColor = ColorHelper.darker(frameColor, 30); JTattooUtilities.draw3DBorder(g, frameHiColor, frameLoColor, x, y, w, h); if ((model.isPressed() && model.isArmed()) || model.isSelected()) { JTattooUtilities.draw3DBorder(g, frameLoColor, frameHiColor, x, y, w, h); } else { JTattooUtilities.draw3DBorder(g, frameLoColor, frameHiColor, x, y, w, h); JTattooUtilities.draw3DBorder(g, frameHiColor, frameLoColor, x + 1, y + 1, w - 2, h - 2); } }