Ejemplo n.º 1
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);
      }
    }
Ejemplo n.º 2
0
  /** Paints the horizontal bars for the */
  public void paintIcon(Component c, Graphics g, int x, int y) {
    JComponent component = (JComponent) c;
    int iconWidth = getIconWidth();

    g.translate(x, y);

    g.setColor(
        component.isEnabled()
            ? MetalLookAndFeel.getControlInfo()
            : MetalLookAndFeel.getControlShadow());
    g.drawLine(0, 0, iconWidth - 1, 0);
    g.drawLine(1, 1, 1 + (iconWidth - 3), 1);
    g.drawLine(2, 2, 2 + (iconWidth - 5), 2);
    g.drawLine(3, 3, 3 + (iconWidth - 7), 3);
    g.drawLine(4, 4, 4 + (iconWidth - 9), 4);

    g.translate(-x, -y);
  }
Ejemplo n.º 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);
      }
    }
Ejemplo n.º 4
0
    public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {
      g.translate(x, y);

      if (MetalLookAndFeel.usingOcean()) {
        // Only paint a border if we're not next to a horizontal
        // toolbar
        if (!MetalToolBarUI.doesMenuBarBorderToolBar((JMenuBar) c)) {
          g.setColor(MetalLookAndFeel.getControl());
          g.drawLine(0, h - 2, w, h - 2);
          g.setColor(UIManager.getColor("MenuBar.borderColor"));
          g.drawLine(0, h - 1, w, h - 1);
        }
      } else {
        g.setColor(MetalLookAndFeel.getControlShadow());
        g.drawLine(0, h - 1, w, h - 1);
      }

      g.translate(-x, -y);
    }
Ejemplo n.º 5
0
    public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {
      g.translate(x, y);

      if (MetalLookAndFeel.usingOcean()) {
        g.setColor(MetalLookAndFeel.getControlDarkShadow());
        g.drawRect(0, 0, w, h - 1);
        g.setColor(MetalLookAndFeel.getControlShadow());
        g.drawRect(1, 1, w - 2, h - 3);
      } else {
        g.setColor(MetalLookAndFeel.getControlDarkShadow());
        g.drawLine(0, 0, w - 1, 0);
        g.drawLine(0, 0, 0, h - 2);
        g.drawLine(0, h - 2, w - 1, h - 2);
        g.setColor(MetalLookAndFeel.getControlHighlight());
        g.drawLine(1, 1, w - 1, 1);
        g.drawLine(1, 1, 1, h - 1);
        g.drawLine(1, h - 1, w - 1, h - 1);
        g.setColor(MetalLookAndFeel.getControl());
        g.drawLine(1, h - 2, 1, h - 2);
      }

      g.translate(-x, -y);
    }
Ejemplo n.º 6
0
 protected Color getInactiveHighlight() {
   return MetalLookAndFeel.getControlShadow();
 }