Exemple #1
0
    public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {

      JScrollPane scroll = (JScrollPane) c;
      JComponent colHeader = scroll.getColumnHeader();
      int colHeaderHeight = 0;
      if (colHeader != null) colHeaderHeight = colHeader.getHeight();

      JComponent rowHeader = scroll.getRowHeader();
      int rowHeaderWidth = 0;
      if (rowHeader != null) rowHeaderWidth = rowHeader.getWidth();

      g.translate(x, y);

      g.setColor(MetalLookAndFeel.getControlDarkShadow());
      g.drawRect(0, 0, w - 2, h - 2);
      g.setColor(MetalLookAndFeel.getControlHighlight());

      g.drawLine(w - 1, 1, w - 1, h - 1);
      g.drawLine(1, h - 1, w - 1, h - 1);

      g.setColor(MetalLookAndFeel.getControl());
      g.drawLine(w - 2, 2 + colHeaderHeight, w - 2, 2 + colHeaderHeight);
      g.drawLine(1 + rowHeaderWidth, h - 2, 1 + rowHeaderWidth, h - 2);

      g.translate(-x, -y);
    }
  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);
  }
  /**
   * Paints the track for a vertical scrollbar.
   *
   * @param g the graphics device.
   * @param c the component.
   * @param x the x-coordinate for the track bounds.
   * @param y the y-coordinate for the track bounds.
   * @param w the width for the track bounds.
   * @param h the height for the track bounds.
   */
  private void paintTrackVertical(Graphics g, JComponent c, int x, int y, int w, int h) {
    if (c.isEnabled()) {
      g.setColor(MetalLookAndFeel.getControlDarkShadow());
      g.drawLine(x, y, x, y + h - 1);
      g.drawLine(x, y, x + w - 1, y);
      g.drawLine(x, y + h - 1, x + w - 1, y + h - 1);

      g.setColor(scrollBarShadowColor);
      g.drawLine(x + 1, y + 1, x + w - 1, y + 1);
      g.drawLine(x + 1, y + 1, x + 1, y + h - 2);

      if (isFreeStanding) {
        g.setColor(MetalLookAndFeel.getControlDarkShadow());
        g.drawLine(x + w - 2, y, x + w - 2, y + h - 1);
        g.setColor(MetalLookAndFeel.getControlHighlight());
        g.drawLine(x + w - 1, y, x + w - 1, y + h - 1);
      }
    } else {
      g.setColor(MetalLookAndFeel.getControlDisabled());
      if (isFreeStanding) g.drawRect(x, y, w - 1, h - 1);
      else {
        g.drawLine(x, y, x + w - 1, y);
        g.drawLine(x, y, x, y + h - 1);
        g.drawLine(x, y + h - 1, x + w - 1, y + h - 1);
      }
    }
  }
Exemple #4
0
    public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {
      g.translate(x, y);

      if (((JToolBar) c).isFloatable()) {
        if (((JToolBar) c).getOrientation() == HORIZONTAL) {
          int shift = MetalLookAndFeel.usingOcean() ? -1 : 0;
          bumps.setBumpArea(10, h - 4);
          if (MetalUtils.isLeftToRight(c)) {
            bumps.paintIcon(c, g, 2, 2 + shift);
          } else {
            bumps.paintIcon(c, g, w - 12, 2 + shift);
          }
        } else // vertical
        {
          bumps.setBumpArea(w - 4, 10);
          bumps.paintIcon(c, g, 2, 2);
        }
      }

      if (((JToolBar) c).getOrientation() == HORIZONTAL && MetalLookAndFeel.usingOcean()) {
        g.setColor(MetalLookAndFeel.getControl());
        g.drawLine(0, h - 2, w, h - 2);
        g.setColor(UIManager.getColor("ToolBar.borderColor"));
        g.drawLine(0, h - 1, w, h - 1);
      }

      g.translate(-x, -y);
    }
Exemple #5
0
 static void drawActiveButtonBorder(Graphics g, int x, int y, int w, int h) {
   drawFlush3DBorder(g, x, y, w, h);
   g.setColor(MetalLookAndFeel.getPrimaryControl());
   g.drawLine(x + 1, y + 1, x + 1, h - 3);
   g.drawLine(x + 1, y + 1, w - 3, x + 1);
   g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
   g.drawLine(x + 2, h - 2, w - 2, h - 2);
   g.drawLine(w - 2, y + 2, w - 2, h - 2);
 }
  static void initLookAndFeel() {
    MetalLookAndFeel mlf = new MetalLookAndFeel();
    mlf.setCurrentTheme(new SipCommunicatorColorTheme());

    try {
      UIManager.setLookAndFeel(mlf);
    } catch (UnsupportedLookAndFeelException ex) {
      console.error("Failed to set custom look and feel", ex);
    }
  }
Exemple #7
0
 /** This draws the "Flush 3D Border" which is used throughout the Metal L&F */
 static void drawFlush3DBorder(Graphics g, int x, int y, int w, int h) {
   g.translate(x, y);
   g.setColor(MetalLookAndFeel.getControlDarkShadow());
   g.drawRect(0, 0, w - 2, h - 2);
   g.setColor(MetalLookAndFeel.getControlHighlight());
   g.drawRect(1, 1, w - 2, h - 2);
   g.setColor(MetalLookAndFeel.getControl());
   g.drawLine(0, h - 1, 1, h - 2);
   g.drawLine(w - 1, 0, w - 2, 1);
   g.translate(-x, -y);
 }
Exemple #8
0
 static void drawDefaultButtonPressedBorder(Graphics g, int x, int y, int w, int h) {
   drawPressed3DBorder(g, x + 1, y + 1, w - 1, h - 1);
   g.translate(x, y);
   g.setColor(MetalLookAndFeel.getControlDarkShadow());
   g.drawRect(0, 0, w - 3, h - 3);
   g.drawLine(w - 2, 0, w - 2, 0);
   g.drawLine(0, h - 2, 0, h - 2);
   g.setColor(MetalLookAndFeel.getControl());
   g.drawLine(w - 1, 0, w - 1, 0);
   g.drawLine(0, h - 1, 0, h - 1);
   g.translate(-x, -y);
 }
Exemple #9
0
    public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {
      g.translate(x, y);

      g.setColor(MetalLookAndFeel.getControlDarkShadow());
      g.drawLine(w - 1, 0, w - 1, h - 1);
      g.drawLine(1, h - 1, w - 1, h - 1);
      g.setColor(MetalLookAndFeel.getControlHighlight());
      g.drawLine(0, 0, w - 2, 0);
      g.drawLine(0, 0, 0, h - 2);

      g.translate(-x, -y);
    }
Exemple #10
0
  /**
   * This draws a variant "Flush 3D Border" It is used for things like active toggle buttons. This
   * is used rarely.
   */
  static void drawDark3DBorder(Graphics g, int x, int y, int w, int h) {
    g.translate(x, y);

    drawFlush3DBorder(g, 0, 0, w, h);

    g.setColor(MetalLookAndFeel.getControl());
    g.drawLine(1, 1, 1, h - 2);
    g.drawLine(1, 1, w - 2, 1);
    g.setColor(MetalLookAndFeel.getControlShadow());
    g.drawLine(1, h - 2, 1, h - 2);
    g.drawLine(w - 2, 1, w - 2, 1);
    g.translate(-x, -y);
  }
Exemple #11
0
 static Border getToolBarNonrolloverBorder() {
   if (MetalLookAndFeel.usingOcean()) {
     new CompoundBorder(new MetalBorders.ButtonBorder(), new MetalBorders.RolloverMarginBorder());
   }
   return new CompoundBorder(
       new MetalBorders.ButtonBorder(), new MetalBorders.RolloverMarginBorder());
 }
Exemple #12
0
    public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {
      if (MetalLookAndFeel.usingOcean()) {
        paintOceanBorder(c, g, x, y, w, h);
        return;
      }
      AbstractButton button = (AbstractButton) c;
      ButtonModel model = button.getModel();

      if (model.isEnabled()) {
        boolean isPressed = model.isPressed() && model.isArmed();
        boolean isDefault = (button instanceof JButton && ((JButton) button).isDefaultButton());

        if (isPressed && isDefault) {
          MetalUtils.drawDefaultButtonPressedBorder(g, x, y, w, h);
        } else if (isPressed) {
          MetalUtils.drawPressed3DBorder(g, x, y, w, h);
        } else if (isDefault) {
          MetalUtils.drawDefaultButtonBorder(g, x, y, w, h, false);
        } else {
          MetalUtils.drawButtonBorder(g, x, y, w, h, false);
        }
      } else { // disabled state
        MetalUtils.drawDisabledBorder(g, x, y, w - 1, h - 1);
      }
    }
Exemple #13
0
    public Insets getBorderInsets(Component c, Insets newInsets) {
      if (MetalLookAndFeel.usingOcean()) {
        newInsets.set(1, 2, 3, 2);
      } else {
        newInsets.top = newInsets.left = newInsets.bottom = newInsets.right = 2;
      }

      if (((JToolBar) c).isFloatable()) {
        if (((JToolBar) c).getOrientation() == HORIZONTAL) {
          if (c.getComponentOrientation().isLeftToRight()) {
            newInsets.left = 16;
          } else {
            newInsets.right = 16;
          }
        } else { // vertical
          newInsets.top = 16;
        }
      }

      Insets margin = ((JToolBar) c).getMargin();

      if (margin != null) {
        newInsets.left += margin.left;
        newInsets.top += margin.top;
        newInsets.right += margin.right;
        newInsets.bottom += margin.bottom;
      }

      return newInsets;
    }
Exemple #14
0
 /**
  * Paints the major ticks for a slider with a vertical orientation.
  *
  * @param g the graphics device.
  * @param tickBounds the tick bounds.
  * @param y the y value for the tick.
  */
 protected void paintMajorTickForVertSlider(Graphics g, Rectangle tickBounds, int y) {
   // Note the incoming 'g' has a translation in place to get us to the
   // start of the tick rect already...
   if (slider.isEnabled()) g.setColor(slider.getForeground());
   else g.setColor(MetalLookAndFeel.getControlShadow());
   g.drawLine(TICK_BUFFER, y, TICK_BUFFER + tickLength, y);
 }
 /*     */ public void paintIndeterminate(Graphics paramGraphics, JComponent paramJComponent)
       /*     */ {
   /* 143 */ super.paintIndeterminate(paramGraphics, paramJComponent);
   /*     */
   /* 145 */ if ((!this.progressBar.isBorderPainted())
       || (!(paramGraphics instanceof Graphics2D))) {
     /* 146 */ return;
     /*     */ }
   /*     */
   /* 149 */ Insets localInsets = this.progressBar.getInsets();
   /* 150 */ int i = this.progressBar.getWidth() - (localInsets.left + localInsets.right);
   /* 151 */ int j = this.progressBar.getHeight() - (localInsets.top + localInsets.bottom);
   /* 152 */ int k = getAmountFull(localInsets, i, j);
   /* 153 */ boolean bool = MetalUtils.isLeftToRight(paramJComponent);
   /*     */
   /* 155 */ Rectangle localRectangle = null;
   /* 156 */ localRectangle = getBox(localRectangle);
   /*     */
   /* 161 */ int m = localInsets.left;
   /* 162 */ int n = localInsets.top;
   /* 163 */ int i1 = localInsets.left + i - 1;
   /* 164 */ int i2 = localInsets.top + j - 1;
   /*     */
   /* 166 */ Graphics2D localGraphics2D = (Graphics2D) paramGraphics;
   /* 167 */ localGraphics2D.setStroke(new BasicStroke(1.0F));
   /*     */
   /* 169 */ if (this.progressBar.getOrientation() == 0)
   /*     */ {
     /* 171 */ localGraphics2D.setColor(MetalLookAndFeel.getControlShadow());
     /* 172 */ localGraphics2D.drawLine(m, n, i1, n);
     /* 173 */ localGraphics2D.drawLine(m, n, m, i2);
     /*     */
     /* 176 */ localGraphics2D.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
     /* 177 */ localGraphics2D.drawLine(
         localRectangle.x, n, localRectangle.x + localRectangle.width - 1, n);
     /*     */ }
   /*     */ else
   /*     */ {
     /* 181 */ localGraphics2D.setColor(MetalLookAndFeel.getControlShadow());
     /* 182 */ localGraphics2D.drawLine(m, n, m, i2);
     /* 183 */ localGraphics2D.drawLine(m, n, i1, n);
     /*     */
     /* 186 */ localGraphics2D.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
     /* 187 */ localGraphics2D.drawLine(
         m, localRectangle.y, m, localRectangle.y + localRectangle.height - 1);
     /*     */ }
   /*     */ }
  /** 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);
  }
Exemple #17
0
 static void drawDefaultButtonBorder(Graphics g, int x, int y, int w, int h, boolean active) {
   drawButtonBorder(g, x + 1, y + 1, w - 1, h - 1, active);
   g.translate(x, y);
   g.setColor(MetalLookAndFeel.getControlDarkShadow());
   g.drawRect(0, 0, w - 3, h - 3);
   g.drawLine(w - 2, 0, w - 2, 0);
   g.drawLine(0, h - 2, 0, h - 2);
   g.translate(-x, -y);
 }
 /**
  * Paints the track for the scrollbar.
  *
  * @param g the graphics device.
  * @param c the component.
  * @param trackBounds the track bounds.
  */
 protected void paintTrack(Graphics g, JComponent c, Rectangle trackBounds) {
   g.setColor(MetalLookAndFeel.getControl());
   g.fillRect(trackBounds.x, trackBounds.y, trackBounds.width, trackBounds.height);
   if (scrollbar.getOrientation() == HORIZONTAL)
     paintTrackHorizontal(
         g, c, trackBounds.x, trackBounds.y, trackBounds.width, trackBounds.height);
   else
     paintTrackVertical(g, c, trackBounds.x, trackBounds.y, trackBounds.width, trackBounds.height);
 }
Exemple #19
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);
    }
 protected void installDefaults() {
   super.installDefaults();
   setFont(UIManager.getFont("InternalFrame.titleFont"));
   paletteTitleHeight = UIManager.getInt("InternalFrame.paletteTitleHeight");
   paletteCloseIcon = UIManager.getIcon("InternalFrame.paletteCloseIcon");
   wasClosable = frame.isClosable();
   selectedForegroundKey = selectedBackgroundKey = null;
   if (MetalLookAndFeel.usingOcean()) {
     setOpaque(true);
   }
 }
Exemple #21
0
 public Insets getBorderInsets(Component c, Insets newInsets) {
   if (MetalLookAndFeel.usingOcean()) {
     newInsets.set(0, 0, 2, 0);
   } else {
     newInsets.top = 1;
     newInsets.left = 0;
     newInsets.bottom = 1;
     newInsets.right = 0;
   }
   return newInsets;
 }
  /**
   * Paints the thumb for a vertical scroll bar.
   *
   * @param g the graphics device.
   * @param c the scroll bar component.
   * @param thumbBounds the thumb bounds.
   */
  private void paintThumbVertical(Graphics g, JComponent c, Rectangle thumbBounds) {
    int x = thumbBounds.x;
    int y = thumbBounds.y;
    int w = thumbBounds.width;
    int h = thumbBounds.height;

    // First we fill the background.
    MetalTheme theme = MetalLookAndFeel.getCurrentTheme();
    if (theme instanceof OceanTheme && UIManager.get("ScrollBar.gradient") != null) {
      MetalUtils.paintGradient(
          g, x + 2, y + 2, w - 2, h - 4, SwingConstants.HORIZONTAL, "ScrollBar.gradient");
    } else {
      g.setColor(thumbColor);
      if (isFreeStanding) g.fillRect(x, y, w - 1, h);
      else g.fillRect(x, y, w, h);
    }

    // then draw the dark box
    g.setColor(thumbLightShadowColor);
    if (isFreeStanding) g.drawRect(x, y, w - 2, h - 1);
    else {
      g.drawLine(x, y, x + w - 1, y);
      g.drawLine(x, y, x, y + h - 1);
      g.drawLine(x, y + h - 1, x + w - 1, y + h - 1);
    }

    // then the highlight
    g.setColor(thumbHighlightColor);
    if (isFreeStanding) {
      g.drawLine(x + 1, y + 1, x + w - 3, y + 1);
      g.drawLine(x + 1, y + 1, x + 1, y + h - 3);
    } else {
      g.drawLine(x + 1, y + 1, x + w - 1, y + 1);
      g.drawLine(x + 1, y + 1, x + 1, y + h - 3);
    }

    // draw the shadow line
    g.setColor(UIManager.getColor("ScrollBar.shadow"));
    g.drawLine(x + 1, y + h, x + w - 2, y + h);

    // For the OceanTheme, draw the 3 lines in the middle.
    if (theme instanceof OceanTheme) {
      g.setColor(thumbLightShadowColor);
      int middle = y + h / 2;
      g.drawLine(x + 4, middle - 2, x + w - 5, middle - 2);
      g.drawLine(x + 4, middle, x + w - 5, middle);
      g.drawLine(x + 4, middle + 2, x + w - 5, middle + 2);
      g.setColor(UIManager.getColor("ScrollBar.highlight"));
      g.drawLine(x + 5, middle - 1, x + w - 4, middle - 1);
      g.drawLine(x + 5, middle + 1, x + w - 4, middle + 1);
      g.drawLine(x + 5, middle + 3, x + w - 4, middle + 3);
    }
  }
Exemple #23
0
    public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {
      JMenuItem b = (JMenuItem) c;
      ButtonModel model = b.getModel();

      g.translate(x, y);

      if (c.getParent() instanceof JMenuBar) {
        if (model.isArmed() || model.isSelected()) {
          g.setColor(MetalLookAndFeel.getControlDarkShadow());
          g.drawLine(0, 0, w - 2, 0);
          g.drawLine(0, 0, 0, h - 1);
          g.drawLine(w - 2, 2, w - 2, h - 1);

          g.setColor(MetalLookAndFeel.getPrimaryControlHighlight());
          g.drawLine(w - 1, 1, w - 1, h - 1);

          g.setColor(MetalLookAndFeel.getMenuBackground());
          g.drawLine(w - 1, 0, w - 1, 0);
        }
      } else {
        if (model.isArmed() || (c instanceof JMenu && model.isSelected())) {
          g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
          g.drawLine(0, 0, w - 1, 0);

          g.setColor(MetalLookAndFeel.getPrimaryControlHighlight());
          g.drawLine(0, h - 1, w - 1, h - 1);
        } else {
          g.setColor(MetalLookAndFeel.getPrimaryControlHighlight());
          g.drawLine(0, 0, 0, h - 1);
        }
      }

      g.translate(-x, -y);
    }
  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);
    }
  }
Exemple #25
0
 public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {
   AbstractButton button = (AbstractButton) c;
   ButtonModel model = button.getModel();
   if (MetalLookAndFeel.usingOcean()) {
     if (model.isArmed() || !button.isEnabled()) {
       super.paintBorder(c, g, x, y, w, h);
     } else {
       g.setColor(MetalLookAndFeel.getControlDarkShadow());
       g.drawRect(0, 0, w - 1, h - 1);
     }
     return;
   }
   if (!c.isEnabled()) {
     MetalUtils.drawDisabledBorder(g, x, y, w - 1, h - 1);
   } else {
     if (model.isPressed() && model.isArmed()) {
       MetalUtils.drawPressed3DBorder(g, x, y, w, h);
     } else if (model.isSelected()) {
       MetalUtils.drawDark3DBorder(g, x, y, w, h);
     } else {
       MetalUtils.drawFlush3DBorder(g, x, y, w, h);
     }
   }
 }
Exemple #26
0
    public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {

      g.translate(x, y);

      int messageType = JOptionPane.PLAIN_MESSAGE;
      if (c instanceof JInternalFrame) {
        Object obj = ((JInternalFrame) c).getClientProperty("JInternalFrame.messageType");
        if (obj != null && (obj instanceof Integer)) {
          messageType = ((Integer) obj).intValue();
        }
      }

      Color borderColor;

      switch (messageType) {
        case (JOptionPane.ERROR_MESSAGE):
          borderColor = UIManager.getColor("OptionPane.errorDialog.border.background");
          break;
        case (JOptionPane.QUESTION_MESSAGE):
          borderColor = UIManager.getColor("OptionPane.questionDialog.border.background");
          break;
        case (JOptionPane.WARNING_MESSAGE):
          borderColor = UIManager.getColor("OptionPane.warningDialog.border.background");
          break;
        case (JOptionPane.INFORMATION_MESSAGE):
        case (JOptionPane.PLAIN_MESSAGE):
        default:
          borderColor = MetalLookAndFeel.getPrimaryControlDarkShadow();
          break;
      }

      g.setColor(borderColor);

      // 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 < 3; i++) {
        g.drawRect(i, i, w - (i * 2) - 1, h - (i * 2) - 1);
      }

      g.translate(-x, -y);
    }
  /**
   * Paints the slider button of the ScrollBar.
   *
   * @param g the Graphics context to use
   * @param c the JComponent on which we paint
   * @param thumbBounds the rectangle that is the slider button
   */
  protected void paintThumb(Graphics g, JComponent c, Rectangle thumbBounds) {
    // a disabled scrollbar has no thumb in the metal look and feel
    if (!c.isEnabled()) return;
    if (scrollbar.getOrientation() == HORIZONTAL) paintThumbHorizontal(g, c, thumbBounds);
    else paintThumbVertical(g, c, thumbBounds);

    // Draw the pattern when the theme is not Ocean.
    if (!(MetalLookAndFeel.getCurrentTheme() instanceof OceanTheme)) {
      MetalUtils.fillMetalPattern(
          c,
          g,
          thumbBounds.x + 3,
          thumbBounds.y + 3,
          thumbBounds.width - 6,
          thumbBounds.height - 6,
          thumbHighlightColor,
          thumbLightShadowColor);
    }
  }
Exemple #28
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);
      }
    }
Exemple #29
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);
      }
    }
    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);
    }