if (UIManager.get("InternalFrame.activeTitleGradient") != null && frame.isSelected()) { MetalUtils.paintGradient(g, 0, 0, getWidth(), getHeight(), SwingConstants.VERTICAL, "InternalFrame.activeTitleGradient"); }
  public void paintComponent(Graphics g)  {    Color savedColor = g.getColor();    if (isPalette)      paintPalette(g);    else      {        paintTitleBackground(g);        paintChildren(g);        Dimension d = getSize();        if (frame.isSelected())          g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());        else          g.setColor(MetalLookAndFeel.getControlDarkShadow());                // put a dot in each of the top corners        g.drawLine(0, 0, 0, 0);        g.drawLine(d.width - 1, 0, d.width - 1, 0);                g.drawLine(0, d.height - 1, d.width - 1, d.height - 1);                // draw the metal pattern        Rectangle b = title.getBounds();        int startX = b.x + b.width + 5;        int endX = startX;        if (iconButton.isVisible())          endX = Math.max(iconButton.getX(), endX);        else if (maxButton.isVisible())           endX = Math.max(maxButton.getX(), endX);        else if (closeButton.isVisible())          endX = Math.max(closeButton.getX(), endX);        endX -= 7;        if (endX > startX)          MetalUtils.fillMetalPattern(this, g, startX, 3, endX - startX, getHeight() - 6, Color.white, Color.gray);      }    g.setColor(savedColor);  }