Part part = frame.isIcon() ? Part.WP_MINCAPTION
: (frame.isMaximum() ? Part.WP_MAXCAPTION
: Part.WP_CAPTION);
State state = frame.isSelected() ? State.ACTIVE : State.INACTIVE;
Skin skin = xp.getSkin(this, part);
skin.paintSkin(g, 0, 0, getWidth(), getHeight(), state);
} else {
Boolean gradientsOn = (Boolean)LookAndFeel.getDesktopPropertyValue(
"win.frame.captionGradientsOn", Boolean.valueOf(false));
if (gradientsOn.booleanValue() && g instanceof Graphics2D) {
Graphics2D g2 = (Graphics2D)g;