public void paintPalette(Graphics g) { boolean leftToRight = MetalUtils.isLeftToRight(frame); int width = getWidth(); int height = getHeight(); if (paletteBumps == null) { paletteBumps = new MetalBumps( 0, 0, MetalLookAndFeel.getPrimaryControlHighlight(), MetalLookAndFeel.getPrimaryControlInfo(), MetalLookAndFeel.getPrimaryControlShadow()); } Color background = MetalLookAndFeel.getPrimaryControlShadow(); Color darkShadow = MetalLookAndFeel.getPrimaryControlDarkShadow(); g.setColor(background); g.fillRect(0, 0, width, height); g.setColor(darkShadow); g.drawLine(0, height - 1, width, height - 1); int xOffset = leftToRight ? 4 : buttonsWidth + 4; int bumpLength = width - buttonsWidth - 2 * 4; int bumpHeight = getHeight() - 4; paletteBumps.setBumpArea(bumpLength, bumpHeight); paletteBumps.paintIcon(this, g, xOffset, 2); }
protected void createButtons() { super.createButtons(); Boolean paintActive = frame.isSelected() ? Boolean.TRUE : Boolean.FALSE; iconButton.putClientProperty("paintActive", paintActive); iconButton.setBorder(handyEmptyBorder); maxButton.putClientProperty("paintActive", paintActive); maxButton.setBorder(handyEmptyBorder); closeButton.putClientProperty("paintActive", paintActive); closeButton.setBorder(handyEmptyBorder); // The palette close icon isn't opaque while the regular close icon is. // This makes sure palette close buttons have the right background. closeButton.setBackground(MetalLookAndFeel.getPrimaryControlShadow()); if (MetalLookAndFeel.usingOcean()) { iconButton.setContentAreaFilled(false); maxButton.setContentAreaFilled(false); closeButton.setContentAreaFilled(false); } }