示例#1
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);
      }
    }
示例#2
0
 public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {
   if (c.isEnabled()) {
     MetalUtils.drawFlush3DBorder(g, x, y, w, h);
   } else {
     MetalUtils.drawDisabledBorder(g, x, y, w, h);
   }
 }
示例#3
0
 /*      */ private void addMenuItems(JMenu paramJMenu) /*      */ {
   /*  449 */ Locale localLocale = getRootPane().getLocale();
   /*  450 */ JMenuItem localJMenuItem = paramJMenu.add(this.restoreAction);
   /*  451 */ int i = MetalUtils.getInt("MetalTitlePane.restoreMnemonic", -1);
   /*      */
   /*  453 */ if (i != -1) {
     /*  454 */ localJMenuItem.setMnemonic(i);
     /*      */ }
   /*      */
   /*  457 */ localJMenuItem = paramJMenu.add(this.iconifyAction);
   /*  458 */ i = MetalUtils.getInt("MetalTitlePane.iconifyMnemonic", -1);
   /*  459 */ if (i != -1) {
     /*  460 */ localJMenuItem.setMnemonic(i);
     /*      */ }
   /*      */
   /*  463 */ if (Toolkit.getDefaultToolkit().isFrameStateSupported(6))
   /*      */ {
     /*  465 */ localJMenuItem = paramJMenu.add(this.maximizeAction);
     /*  466 */ i = MetalUtils.getInt("MetalTitlePane.maximizeMnemonic", -1);
     /*      */
     /*  468 */ if (i != -1) {
       /*  469 */ localJMenuItem.setMnemonic(i);
       /*      */ }
     /*      */ }
   /*      */
   /*  473 */ paramJMenu.add(new JSeparator());
   /*      */
   /*  475 */ localJMenuItem = paramJMenu.add(this.closeAction);
   /*  476 */ i = MetalUtils.getInt("MetalTitlePane.closeMnemonic", -1);
   /*  477 */ if (i != -1) /*  478 */ localJMenuItem.setMnemonic(i);
   /*      */ }
示例#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);
    }
示例#5
0
 public void paintIcon(Component c, Graphics g, int x, int y) {
   if (MetalUtils.isLeftToRight(c)) {
     super.paintIcon(c, g, x, y);
   } else {
     rtl.paintIcon(c, g, 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);
  }
示例#7
0
    public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {

      if (!(c instanceof JTextComponent)) {
        // special case for non-text components (bug ID 4144840)
        if (c.isEnabled()) {
          MetalUtils.drawFlush3DBorder(g, x, y, w, h);
        } else {
          MetalUtils.drawDisabledBorder(g, x, y, w, h);
        }
        return;
      }

      if (c.isEnabled() && ((JTextComponent) c).isEditable()) {
        MetalUtils.drawFlush3DBorder(g, x, y, w, h);
      } else {
        MetalUtils.drawDisabledBorder(g, x, y, w, h);
      }
    }
  /**
   * 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);
    }
  }
示例#9
0
 /**
  * If necessary paints the background of the component, then invokes <code>paint</code>.
  *
  * @param g Graphics to paint to
  * @param c JComponent painting on
  * @throws NullPointerException if <code>g</code> or <code>c</code> is null
  * @see javax.swing.plaf.ComponentUI#update
  * @see javax.swing.plaf.ComponentUI#paint
  * @since 1.5
  */
 public void update(Graphics g, JComponent c) {
   AbstractButton button = (AbstractButton) c;
   if ((c.getBackground() instanceof UIResource)
       && button.isContentAreaFilled()
       && c.isEnabled()) {
     ButtonModel model = button.getModel();
     if (!MetalUtils.isToolBarButton(c)) {
       if (!model.isArmed()
           && !model.isPressed()
           && MetalUtils.drawGradient(
               c, g, "Button.gradient", 0, 0, c.getWidth(), c.getHeight(), true)) {
         paint(g, c);
         return;
       }
     } else if (model.isRollover()
         && MetalUtils.drawGradient(
             c, g, "Button.gradient", 0, 0, c.getWidth(), c.getHeight(), true)) {
       paint(g, c);
       return;
     }
   }
   super.update(g, c);
 }
示例#10
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);
     }
   }
 }
 /*     */ 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 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);
    }
  }
    public void layoutContainer(Container c) {
      boolean leftToRight = MetalUtils.isLeftToRight(frame);

      int w = getWidth();
      int x = leftToRight ? w : 0;
      int y = 2;
      int spacing;

      // assumes all buttons have the same dimensions
      // these dimensions include the borders
      int buttonHeight = closeButton.getIcon().getIconHeight();
      int buttonWidth = closeButton.getIcon().getIconWidth();

      if (frame.isClosable()) {
        if (isPalette) {
          spacing = 3;
          x += leftToRight ? -spacing - (buttonWidth + 2) : spacing;
          closeButton.setBounds(x, y, buttonWidth + 2, getHeight() - 4);
          if (!leftToRight) x += (buttonWidth + 2);
        } else {
          spacing = 4;
          x += leftToRight ? -spacing - buttonWidth : spacing;
          closeButton.setBounds(x, y, buttonWidth, buttonHeight);
          if (!leftToRight) x += buttonWidth;
        }
      }

      if (frame.isMaximizable() && !isPalette) {
        spacing = frame.isClosable() ? 10 : 4;
        x += leftToRight ? -spacing - buttonWidth : spacing;
        maxButton.setBounds(x, y, buttonWidth, buttonHeight);
        if (!leftToRight) x += buttonWidth;
      }

      if (frame.isIconifiable() && !isPalette) {
        spacing = frame.isMaximizable() ? 2 : (frame.isClosable() ? 10 : 4);
        x += leftToRight ? -spacing - buttonWidth : spacing;
        iconButton.setBounds(x, y, buttonWidth, buttonHeight);
        if (!leftToRight) x += buttonWidth;
      }

      buttonsWidth = leftToRight ? w - x : x;
    }
  public void paintComponent(Graphics g) {
    if (isPalette) {
      paintPalette(g);
      return;
    }

    boolean leftToRight = MetalUtils.isLeftToRight(frame);
    boolean isSelected = frame.isSelected();

    int width = getWidth();
    int height = getHeight();

    Color background = null;
    Color foreground = null;
    Color shadow = null;

    MetalBumps bumps;
    String gradientKey;

    if (isSelected) {
      if (!MetalLookAndFeel.usingOcean()) {
        closeButton.setContentAreaFilled(true);
        maxButton.setContentAreaFilled(true);
        iconButton.setContentAreaFilled(true);
      }
      if (selectedBackgroundKey != null) {
        background = UIManager.getColor(selectedBackgroundKey);
      }
      if (background == null) {
        background = MetalLookAndFeel.getWindowTitleBackground();
      }
      if (selectedForegroundKey != null) {
        foreground = UIManager.getColor(selectedForegroundKey);
      }
      if (selectedShadowKey != null) {
        shadow = UIManager.getColor(selectedShadowKey);
      }
      if (shadow == null) {
        shadow = MetalLookAndFeel.getPrimaryControlDarkShadow();
      }
      if (foreground == null) {
        foreground = MetalLookAndFeel.getWindowTitleForeground();
      }
      activeBumps.setBumpColors(
          activeBumpsHighlight,
          activeBumpsShadow,
          UIManager.get("InternalFrame.activeTitleGradient") != null ? null : background);
      bumps = activeBumps;
      gradientKey = "InternalFrame.activeTitleGradient";
    } else {
      if (!MetalLookAndFeel.usingOcean()) {
        closeButton.setContentAreaFilled(false);
        maxButton.setContentAreaFilled(false);
        iconButton.setContentAreaFilled(false);
      }
      background = MetalLookAndFeel.getWindowTitleInactiveBackground();
      foreground = MetalLookAndFeel.getWindowTitleInactiveForeground();
      shadow = MetalLookAndFeel.getControlDarkShadow();
      bumps = inactiveBumps;
      gradientKey = "InternalFrame.inactiveTitleGradient";
    }

    if (!MetalUtils.drawGradient(this, g, gradientKey, 0, 0, width, height, true)) {
      g.setColor(background);
      g.fillRect(0, 0, width, height);
    }

    g.setColor(shadow);
    g.drawLine(0, height - 1, width, height - 1);
    g.drawLine(0, 0, 0, 0);
    g.drawLine(width - 1, 0, width - 1, 0);

    int titleLength = 0;
    int xOffset = leftToRight ? 5 : width - 5;
    String frameTitle = frame.getTitle();

    Icon icon = frame.getFrameIcon();
    if (icon != null) {
      if (!leftToRight) xOffset -= icon.getIconWidth();
      int iconY = ((height / 2) - (icon.getIconHeight() / 2));
      icon.paintIcon(frame, g, xOffset, iconY);
      xOffset += leftToRight ? icon.getIconWidth() + 5 : -5;
    }

    if (frameTitle != null) {
      Font f = getFont();
      g.setFont(f);
      FontMetrics fm = SwingUtilities2.getFontMetrics(frame, g, f);
      int fHeight = fm.getHeight();

      g.setColor(foreground);

      int yOffset = ((height - fm.getHeight()) / 2) + fm.getAscent();

      Rectangle rect = new Rectangle(0, 0, 0, 0);
      if (frame.isIconifiable()) {
        rect = iconButton.getBounds();
      } else if (frame.isMaximizable()) {
        rect = maxButton.getBounds();
      } else if (frame.isClosable()) {
        rect = closeButton.getBounds();
      }
      int titleW;

      if (leftToRight) {
        if (rect.x == 0) {
          rect.x = frame.getWidth() - frame.getInsets().right - 2;
        }
        titleW = rect.x - xOffset - 4;
        frameTitle = getTitle(frameTitle, fm, titleW);
      } else {
        titleW = xOffset - rect.x - rect.width - 4;
        frameTitle = getTitle(frameTitle, fm, titleW);
        xOffset -= SwingUtilities2.stringWidth(frame, fm, frameTitle);
      }

      titleLength = SwingUtilities2.stringWidth(frame, fm, frameTitle);
      SwingUtilities2.drawString(frame, g, frameTitle, xOffset, yOffset);
      xOffset += leftToRight ? titleLength + 5 : -5;
    }

    int bumpXOffset;
    int bumpLength;
    if (leftToRight) {
      bumpLength = width - buttonsWidth - xOffset - 5;
      bumpXOffset = xOffset;
    } else {
      bumpLength = xOffset - buttonsWidth - 5;
      bumpXOffset = buttonsWidth + 5;
    }
    int bumpYOffset = 3;
    int bumpHeight = getHeight() - (2 * bumpYOffset);
    bumps.setBumpArea(bumpLength, bumpHeight);
    bumps.paintIcon(this, g, bumpXOffset, bumpYOffset);
  }
  public void paint(Graphics g) {
    boolean leftToRight = MetalUtils.isLeftToRight(this);
    boolean isEnabled = getParent().isEnabled();

    Color arrowColor =
        isEnabled ? MetalLookAndFeel.getControlInfo() : MetalLookAndFeel.getControlDisabled();
    boolean isPressed = getModel().isPressed();
    int width = getWidth();
    int height = getHeight();
    int w = width;
    int h = height;
    int arrowHeight = (height + 1) / 4;
    int arrowWidth = (height + 1) / 2;

    if (isPressed) {
      g.setColor(MetalLookAndFeel.getControlShadow());
    } else {
      g.setColor(getBackground());
    }

    g.fillRect(0, 0, width, height);

    if (getDirection() == NORTH) {
      if (!isFreeStanding) {
        height += 1;
        g.translate(0, -1);
        width += 2;
        if (!leftToRight) {
          g.translate(-1, 0);
        }
      }

      // Draw the arrow
      g.setColor(arrowColor);
      int startY = ((h + 1) - arrowHeight) / 2;
      int startX = (w / 2);
      //                  System.out.println( "startX :" + startX + " startY :"+startY);
      for (int line = 0; line < arrowHeight; line++) {
        g.drawLine(startX - line, startY + line, startX + line + 1, startY + line);
      }
      /*      g.drawLine( 7, 6, 8, 6 );
      g.drawLine( 6, 7, 9, 7 );
      g.drawLine( 5, 8, 10, 8 );
      g.drawLine( 4, 9, 11, 9 );*/

      if (isEnabled) {
        g.setColor(highlightColor);

        if (!isPressed) {
          g.drawLine(1, 1, width - 3, 1);
          g.drawLine(1, 1, 1, height - 1);
        }

        g.drawLine(width - 1, 1, width - 1, height - 1);

        g.setColor(shadowColor);
        g.drawLine(0, 0, width - 2, 0);
        g.drawLine(0, 0, 0, height - 1);
        g.drawLine(width - 2, 2, width - 2, height - 1);
      } else {
        MetalUtils.drawDisabledBorder(g, 0, 0, width, height + 1);
      }
      if (!isFreeStanding) {
        height -= 1;
        g.translate(0, 1);
        width -= 2;
        if (!leftToRight) {
          g.translate(1, 0);
        }
      }
    } else if (getDirection() == SOUTH) {
      if (!isFreeStanding) {
        height += 1;
        width += 2;
        if (!leftToRight) {
          g.translate(-1, 0);
        }
      }

      // Draw the arrow
      g.setColor(arrowColor);

      int startY = (((h + 1) - arrowHeight) / 2) + arrowHeight - 1;
      int startX = (w / 2);

      //          System.out.println( "startX2 :" + startX + " startY2 :"+startY);

      for (int line = 0; line < arrowHeight; line++) {
        g.drawLine(startX - line, startY - line, startX + line + 1, startY - line);
      }

      /*      g.drawLine( 4, 5, 11, 5 );
      g.drawLine( 5, 6, 10, 6 );
      g.drawLine( 6, 7, 9, 7 );
      g.drawLine( 7, 8, 8, 8 ); */

      if (isEnabled) {
        g.setColor(highlightColor);

        if (!isPressed) {
          g.drawLine(1, 0, width - 3, 0);
          g.drawLine(1, 0, 1, height - 3);
        }

        g.drawLine(1, height - 1, width - 1, height - 1);
        g.drawLine(width - 1, 0, width - 1, height - 1);

        g.setColor(shadowColor);
        g.drawLine(0, 0, 0, height - 2);
        g.drawLine(width - 2, 0, width - 2, height - 2);
        g.drawLine(2, height - 2, width - 2, height - 2);
      } else {
        MetalUtils.drawDisabledBorder(g, 0, -1, width, height + 1);
      }

      if (!isFreeStanding) {
        height -= 1;
        width -= 2;
        if (!leftToRight) {
          g.translate(1, 0);
        }
      }
    } else if (getDirection() == EAST) {
      if (!isFreeStanding) {
        height += 2;
        width += 1;
      }

      // Draw the arrow
      g.setColor(arrowColor);

      int startX = (((w + 1) - arrowHeight) / 2) + arrowHeight - 1;
      int startY = (h / 2);

      // System.out.println( "startX2 :" + startX + " startY2 :"+startY);

      for (int line = 0; line < arrowHeight; line++) {
        g.drawLine(startX - line, startY - line, startX - line, startY + line + 1);
      }

      /*              g.drawLine( 5, 4, 5, 11 );
      g.drawLine( 6, 5, 6, 10 );
      g.drawLine( 7, 6, 7, 9 );
      g.drawLine( 8, 7, 8, 8 );*/

      if (isEnabled) {
        g.setColor(highlightColor);

        if (!isPressed) {
          g.drawLine(0, 1, width - 3, 1);
          g.drawLine(0, 1, 0, height - 3);
        }

        g.drawLine(width - 1, 1, width - 1, height - 1);
        g.drawLine(0, height - 1, width - 1, height - 1);

        g.setColor(shadowColor);
        g.drawLine(0, 0, width - 2, 0);
        g.drawLine(width - 2, 2, width - 2, height - 2);
        g.drawLine(0, height - 2, width - 2, height - 2);
      } else {
        MetalUtils.drawDisabledBorder(g, -1, 0, width + 1, height);
      }
      if (!isFreeStanding) {
        height -= 2;
        width -= 1;
      }
    } else if (getDirection() == WEST) {
      if (!isFreeStanding) {
        height += 2;
        width += 1;
        g.translate(-1, 0);
      }

      // Draw the arrow
      g.setColor(arrowColor);

      int startX = (((w + 1) - arrowHeight) / 2);
      int startY = (h / 2);

      for (int line = 0; line < arrowHeight; line++) {
        g.drawLine(startX + line, startY - line, startX + line, startY + line + 1);
      }

      /*      g.drawLine( 6, 7, 6, 8 );
      g.drawLine( 7, 6, 7, 9 );
      g.drawLine( 8, 5, 8, 10 );
      g.drawLine( 9, 4, 9, 11 );*/

      if (isEnabled) {
        g.setColor(highlightColor);

        if (!isPressed) {
          g.drawLine(1, 1, width - 1, 1);
          g.drawLine(1, 1, 1, height - 3);
        }

        g.drawLine(1, height - 1, width - 1, height - 1);

        g.setColor(shadowColor);
        g.drawLine(0, 0, width - 1, 0);
        g.drawLine(0, 0, 0, height - 2);
        g.drawLine(2, height - 2, width - 1, height - 2);
      } else {
        MetalUtils.drawDisabledBorder(g, 0, 0, width + 1, height);
      }

      if (!isFreeStanding) {
        height -= 2;
        width -= 1;
        g.translate(1, 0);
      }
    }
  }
 /*     */ public void paintDeterminate(Graphics paramGraphics, JComponent paramJComponent)
       /*     */ {
   /*  63 */ super.paintDeterminate(paramGraphics, paramJComponent);
   /*     */
   /*  65 */ if (!(paramGraphics instanceof Graphics2D)) {
     /*  66 */ return;
     /*     */ }
   /*     */
   /*  69 */ if (this.progressBar.isBorderPainted()) {
     /*  70 */ Insets localInsets = this.progressBar.getInsets();
     /*  71 */ int i = this.progressBar.getWidth() - (localInsets.left + localInsets.right);
     /*  72 */ int j = this.progressBar.getHeight() - (localInsets.top + localInsets.bottom);
     /*  73 */ int k = getAmountFull(localInsets, i, j);
     /*  74 */ boolean bool = MetalUtils.isLeftToRight(paramJComponent);
     /*     */
     /*  80 */ int m = localInsets.left;
     /*  81 */ int n = localInsets.top;
     /*  82 */ int i1 = localInsets.left + i - 1;
     /*  83 */ int i2 = localInsets.top + j - 1;
     /*     */
     /*  85 */ Graphics2D localGraphics2D = (Graphics2D) paramGraphics;
     /*  86 */ localGraphics2D.setStroke(new BasicStroke(1.0F));
     /*     */
     /*  88 */ if (this.progressBar.getOrientation() == 0)
     /*     */ {
       /*  90 */ localGraphics2D.setColor(MetalLookAndFeel.getControlShadow());
       /*  91 */ localGraphics2D.drawLine(m, n, i1, n);
       /*     */
       /*  93 */ if (k > 0)
       /*     */ {
         /*  95 */ localGraphics2D.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
         /*     */
         /*  97 */ if (bool) {
           /*  98 */ localGraphics2D.drawLine(m, n, m + k - 1, n);
           /*     */ }
         /*     */ else {
           /* 101 */ localGraphics2D.drawLine(i1, n, i1 - k + 1, n);
           /*     */
           /* 103 */ if (this.progressBar.getPercentComplete() != 1.0D) {
             /* 104 */ localGraphics2D.setColor(MetalLookAndFeel.getControlShadow());
             /*     */ }
           /*     */ }
         /*     */
         /*     */ }
       /*     */
       /* 110 */ localGraphics2D.drawLine(m, n, m, i2);
       /*     */ }
     /*     */ else
     /*     */ {
       /* 114 */ localGraphics2D.setColor(MetalLookAndFeel.getControlShadow());
       /* 115 */ localGraphics2D.drawLine(m, n, m, i2);
       /*     */
       /* 117 */ if (k > 0)
       /*     */ {
         /* 119 */ localGraphics2D.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
         /* 120 */ localGraphics2D.drawLine(m, i2, m, i2 - k + 1);
         /*     */ }
       /*     */
       /* 125 */ localGraphics2D.setColor(MetalLookAndFeel.getControlShadow());
       /*     */
       /* 127 */ if (this.progressBar.getPercentComplete() == 1.0D) {
         /* 128 */ localGraphics2D.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
         /*     */ }
       /* 130 */ localGraphics2D.drawLine(m, n, i1, n);
       /*     */ }
     /*     */ }
   /*     */ }
示例#17
0
    private void paintOceanBorder(Component c, Graphics g, int x, int y, int w, int h) {
      AbstractButton button = (AbstractButton) c;
      ButtonModel model = ((AbstractButton) c).getModel();

      g.translate(x, y);
      if (MetalUtils.isToolBarButton(button)) {
        if (model.isEnabled()) {
          if (model.isPressed()) {
            g.setColor(MetalLookAndFeel.getWhite());
            g.fillRect(1, h - 1, w - 1, 1);
            g.fillRect(w - 1, 1, 1, h - 1);
            g.setColor(MetalLookAndFeel.getControlDarkShadow());
            g.drawRect(0, 0, w - 2, h - 2);
            g.fillRect(1, 1, w - 3, 1);
          } else if (model.isSelected() || model.isRollover()) {
            g.setColor(MetalLookAndFeel.getWhite());
            g.fillRect(1, h - 1, w - 1, 1);
            g.fillRect(w - 1, 1, 1, h - 1);
            g.setColor(MetalLookAndFeel.getControlDarkShadow());
            g.drawRect(0, 0, w - 2, h - 2);
          } else {
            g.setColor(MetalLookAndFeel.getWhite());
            g.drawRect(1, 1, w - 2, h - 2);
            g.setColor(UIManager.getColor("Button.toolBarBorderBackground"));
            g.drawRect(0, 0, w - 2, h - 2);
          }
        } else {
          g.setColor(UIManager.getColor("Button.disabledToolBarBorderBackground"));
          g.drawRect(0, 0, w - 2, h - 2);
        }
      } else if (model.isEnabled()) {
        boolean pressed = model.isPressed();
        boolean armed = model.isArmed();

        if ((c instanceof JButton) && ((JButton) c).isDefaultButton()) {
          g.setColor(MetalLookAndFeel.getControlDarkShadow());
          g.drawRect(0, 0, w - 1, h - 1);
          g.drawRect(1, 1, w - 3, h - 3);
        } else if (pressed) {
          g.setColor(MetalLookAndFeel.getControlDarkShadow());
          g.fillRect(0, 0, w, 2);
          g.fillRect(0, 2, 2, h - 2);
          g.fillRect(w - 1, 1, 1, h - 1);
          g.fillRect(1, h - 1, w - 2, 1);
        } else if (model.isRollover() && button.getClientProperty(NO_BUTTON_ROLLOVER) == null) {
          g.setColor(MetalLookAndFeel.getPrimaryControl());
          g.drawRect(0, 0, w - 1, h - 1);
          g.drawRect(2, 2, w - 5, h - 5);
          g.setColor(MetalLookAndFeel.getControlDarkShadow());
          g.drawRect(1, 1, w - 3, h - 3);
        } else {
          g.setColor(MetalLookAndFeel.getControlDarkShadow());
          g.drawRect(0, 0, w - 1, h - 1);
        }
      } else {
        g.setColor(MetalLookAndFeel.getInactiveControlTextColor());
        g.drawRect(0, 0, w - 1, h - 1);
        if ((c instanceof JButton) && ((JButton) c).isDefaultButton()) {
          g.drawRect(1, 1, w - 3, h - 3);
        }
      }
    }