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);
  }
示例#2
0
    public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {

      Color background;
      Color highlight;
      Color shadow;

      Window window = SwingUtilities.getWindowAncestor(c);
      if (window != null && window.isActive()) {
        background = MetalLookAndFeel.getPrimaryControlDarkShadow();
        highlight = MetalLookAndFeel.getPrimaryControlShadow();
        shadow = MetalLookAndFeel.getPrimaryControlInfo();
      } else {
        background = MetalLookAndFeel.getControlDarkShadow();
        highlight = MetalLookAndFeel.getControlShadow();
        shadow = MetalLookAndFeel.getControlInfo();
      }

      g.setColor(background);
      // Draw outermost lines
      g.drawLine(x + 1, y + 0, x + w - 2, y + 0);
      g.drawLine(x + 0, y + 1, x + 0, y + h - 2);
      g.drawLine(x + w - 1, y + 1, x + w - 1, y + h - 2);
      g.drawLine(x + 1, y + h - 1, x + w - 2, y + h - 1);

      // Draw the bulk of the border
      for (int i = 1; i < 5; i++) {
        g.drawRect(x + i, y + i, w - (i * 2) - 1, h - (i * 2) - 1);
      }

      if ((window instanceof Frame) && ((Frame) window).isResizable()) {
        g.setColor(highlight);
        // Draw the Long highlight lines
        g.drawLine(corner + 1, 3, w - corner, 3);
        g.drawLine(3, corner + 1, 3, h - corner);
        g.drawLine(w - 2, corner + 1, w - 2, h - corner);
        g.drawLine(corner + 1, h - 2, w - corner, h - 2);

        g.setColor(shadow);
        // Draw the Long shadow lines
        g.drawLine(corner, 2, w - corner - 1, 2);
        g.drawLine(2, corner, 2, h - corner - 1);
        g.drawLine(w - 3, corner, w - 3, h - corner - 1);
        g.drawLine(corner, h - 3, w - corner - 1, h - 3);
      }
    }
示例#3
0
    public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {

      Color background;
      Color highlight;
      Color shadow;

      if (c instanceof JInternalFrame && ((JInternalFrame) c).isSelected()) {
        background = MetalLookAndFeel.getPrimaryControlDarkShadow();
        highlight = MetalLookAndFeel.getPrimaryControlShadow();
        shadow = MetalLookAndFeel.getPrimaryControlInfo();
      } else {
        background = MetalLookAndFeel.getControlDarkShadow();
        highlight = MetalLookAndFeel.getControlShadow();
        shadow = MetalLookAndFeel.getControlInfo();
      }

      g.setColor(background);
      // Draw outermost lines
      g.drawLine(1, 0, w - 2, 0);
      g.drawLine(0, 1, 0, h - 2);
      g.drawLine(w - 1, 1, w - 1, h - 2);
      g.drawLine(1, h - 1, w - 2, h - 1);

      // Draw the bulk of the border
      for (int i = 1; i < 5; i++) {
        g.drawRect(x + i, y + i, w - (i * 2) - 1, h - (i * 2) - 1);
      }

      if (c instanceof JInternalFrame && ((JInternalFrame) c).isResizable()) {
        g.setColor(highlight);
        // Draw the Long highlight lines
        g.drawLine(corner + 1, 3, w - corner, 3);
        g.drawLine(3, corner + 1, 3, h - corner);
        g.drawLine(w - 2, corner + 1, w - 2, h - corner);
        g.drawLine(corner + 1, h - 2, w - corner, h - 2);

        g.setColor(shadow);
        // Draw the Long shadow lines
        g.drawLine(corner, 2, w - corner - 1, 2);
        g.drawLine(2, corner, 2, h - corner - 1);
        g.drawLine(w - 3, corner, w - 3, h - corner - 1);
        g.drawLine(corner, h - 3, w - corner - 1, h - 3);
      }
    }
示例#4
0
 protected Color getActiveShadow() {
   return MetalLookAndFeel.getPrimaryControlInfo();
 }