public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { if (MetalLookAndFeel.usingOcean()) { paintOceanBorder(c, g, x, y, w, h); return; } AbstractButton button = (AbstractButton) c; ButtonModel model = button.getModel(); if (model.isEnabled()) { boolean isPressed = model.isPressed() && model.isArmed(); boolean isDefault = (button instanceof JButton && ((JButton) button).isDefaultButton()); if (isPressed && isDefault) { MetalUtils.drawDefaultButtonPressedBorder(g, x, y, w, h); } else if (isPressed) { MetalUtils.drawPressed3DBorder(g, x, y, w, h); } else if (isDefault) { MetalUtils.drawDefaultButtonBorder(g, x, y, w, h, false); } else { MetalUtils.drawButtonBorder(g, x, y, w, h, false); } } else { // disabled state MetalUtils.drawDisabledBorder(g, x, y, w - 1, h - 1); } }
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { AbstractButton button = (AbstractButton) c; ButtonModel model = button.getModel(); if (MetalLookAndFeel.usingOcean()) { if (model.isArmed() || !button.isEnabled()) { super.paintBorder(c, g, x, y, w, h); } else { g.setColor(MetalLookAndFeel.getControlDarkShadow()); g.drawRect(0, 0, w - 1, h - 1); } return; } if (!c.isEnabled()) { MetalUtils.drawDisabledBorder(g, x, y, w - 1, h - 1); } else { if (model.isPressed() && model.isArmed()) { MetalUtils.drawPressed3DBorder(g, x, y, w, h); } else if (model.isSelected()) { MetalUtils.drawDark3DBorder(g, x, y, w, h); } else { MetalUtils.drawFlush3DBorder(g, x, y, w, h); } } }