public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { if (c instanceof AbstractButton) { AbstractButton b = (AbstractButton) c; ButtonModel model = b.getModel(); if (model.isArmed() && model.isPressed() || model.isSelected()) { drawBezel( g, x, y, width, height, (model.isPressed() || model.isSelected()), b.isFocusPainted() && b.hasFocus(), shadow, highlight, darkShadow, focus); } else { drawBezel( g, x, y, width, height, false, b.isFocusPainted() && b.hasFocus(), shadow, highlight, darkShadow, focus); } } else { drawBezel(g, x, y, width, height, false, false, shadow, highlight, darkShadow, focus); } }