private static void drawMenuBezel(
      Graphics g, Color background, int x, int y, int width, int height) {
    // shadowed button region
    g.setColor(background);
    g.fillRect(x, y, width, height);

    g.setColor(background.brighter().brighter());
    g.drawLine(x + 1, y + height - 1, x + width - 1, y + height - 1);
    g.drawLine(x + width - 1, y + height - 2, x + width - 1, y + 1);

    g.setColor(background.darker().darker());
    g.drawLine(x, y, x + width - 2, y);
    g.drawLine(x, y + 1, x, y + height - 2);
  }
Exemple #2
0
    /**
     * Draws the FrameBorder in the given Rect. Calls <b>drawTitleBar</b>, <b>drawLeftBorder</b>,
     * <b>drawRightBorder</b> and <b>drawBottomBorder</b>.
     */
    public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
      if (isActiveFrame()) {
        frameColor = UIManager.getColor("activeCaptionBorder");
      } else {
        frameColor = UIManager.getColor("inactiveCaptionBorder");
      }
      frameHighlight = frameColor.brighter();
      frameShadow = frameColor.darker().darker();

      drawTopBorder(c, g, x, y, width, height);
      drawLeftBorder(c, g, x, y, width, height);
      drawRightBorder(c, g, x, y, width, height);
      drawBottomBorder(c, g, x, y, width, height);
    }
Exemple #3
0
    public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
      Color color = c.getBackground();

      if (origColor != color) {
        origColor = color;
        paintColor = new Color(~origColor.getRGB());
      }

      g.setColor(paintColor);
      BasicGraphicsUtils.drawDashedRect(g, x, y, width, height);
    }
 /**
  * Derives the ARGB value for a color based on an offset between two other colors.
  *
  * @param color1 The first color
  * @param color2 The second color
  * @param midPoint The offset between color 1 and color 2, a value of 0.0 is color 1 and 1.0 is
  *     color 2;
  * @return the ARGB value for a new color based on this derivation
  */
 static int deriveARGB(Color color1, Color color2, float midPoint) {
   int r = color1.getRed() + Math.round((color2.getRed() - color1.getRed()) * midPoint);
   int g = color1.getGreen() + Math.round((color2.getGreen() - color1.getGreen()) * midPoint);
   int b = color1.getBlue() + Math.round((color2.getBlue() - color1.getBlue()) * midPoint);
   int a = color1.getAlpha() + Math.round((color2.getAlpha() - color1.getAlpha()) * midPoint);
   return ((a & 0xFF) << 24) | ((r & 0xFF) << 16) | ((g & 0xFF) << 8) | (b & 0xFF);
 }
 /**
  * Sets the selected color to <code>color</code>. Note that setting the color to <code>null</code>
  * is undefined and may have unpredictable results. This method fires a state changed event if it
  * sets the current color to a new non-<code>null</code> color; if the new color is the same as
  * the current color, no event is fired.
  *
  * @param color the new <code>Color</code>
  */
 public void setSelectedColor(Color color) {
   if (color != null && !selectedColor.equals(color)) {
     selectedColor = color;
     fireStateChanged();
   }
 }