Esempio n. 1
0
  public void setUpColorArrs() {
    super.setUpColorArrs();

    // Generate the color arrays
    DEFAULT_COLORS = ColorHelper.createColorArr(controlColorLight, controlColorDark, 20);
    HIDEFAULT_COLORS =
        ColorHelper.createColorArr(
            ColorHelper.brighter(controlColorLight, 90),
            ColorHelper.brighter(controlColorDark, 30),
            20);

    ACTIVE_COLORS = DEFAULT_COLORS;
    INACTIVE_COLORS = ColorHelper.createColorArr(Color.white, backgroundColor, 20);

    ROLLOVER_COLORS = ColorHelper.createColorArr(rolloverColorLight, rolloverColorDark, 20);
    SELECTED_COLORS = DEFAULT_COLORS;
    PRESSED_COLORS = ColorHelper.createColorArr(controlColorDark, controlColorLight, 20);
    DISABLED_COLORS = ColorHelper.createColorArr(Color.white, new Color(230, 230, 230), 20);

    WINDOW_TITLE_COLORS =
        ColorHelper.createColorArr(windowTitleColorLight, windowTitleColorDark, 20);
    WINDOW_INACTIVE_TITLE_COLORS =
        ColorHelper.createColorArr(windowInactiveTitleColorLight, windowInactiveTitleColorDark, 20);
    MENUBAR_COLORS = ColorHelper.createColorArr(menuColorLight, menuColorDark, 20);
    TOOLBAR_COLORS = ColorHelper.createColorArr(toolbarColorLight, toolbarColorDark, 20);

    BUTTON_COLORS = ColorHelper.createColorArr(buttonColorLight, buttonColorDark, 20);
    TAB_COLORS = ColorHelper.createColorArr(Color.white, backgroundColor, 20);
    CHECKBOX_COLORS = TAB_COLORS;
    COL_HEADER_COLORS = MENUBAR_COLORS;
    TRACK_COLORS = ColorHelper.createColorArr(backgroundColor, Color.white, 16);
    THUMB_COLORS = DEFAULT_COLORS;
    SLIDER_COLORS = DEFAULT_COLORS;
    PROGRESSBAR_COLORS = DEFAULT_COLORS;
  }
Esempio n. 2
0
 protected Color[] getContentBorderColors(int tabPlacement) {
   Color SEP_COLORS[] = {
     ColorHelper.brighter(AcrylLookAndFeel.getControlColorLight(), 20),
     AcrylLookAndFeel.getControlColorLight(),
     ColorHelper.brighter(AcrylLookAndFeel.getControlColorDark(), 20),
     AcrylLookAndFeel.getControlColorDark(),
     ColorHelper.darker(AcrylLookAndFeel.getControlColorDark(), 20),
   };
   return SEP_COLORS;
 }
Esempio n. 3
0
 protected Color getFrameColor() {
   Color frameColor =
       ColorHelper.brighter(AbstractLookAndFeel.getTheme().getButtonBackgroundColor(), 8);
   if (isDragging) {
     return ColorHelper.darker(frameColor, 8);
   } else if (isRollover) {
     return ColorHelper.brighter(frameColor, 16);
   } else {
     return frameColor;
   }
 }
Esempio n. 4
0
 public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {
   if (JTattooUtilities.isFrameActive((JComponent) c)) {
     g.setColor(AbstractLookAndFeel.getFrameColor());
   } else {
     g.setColor(ColorHelper.brighter(AbstractLookAndFeel.getFrameColor(), 40));
   }
   g.drawRect(x, y, w - 1, h - 1);
 }
Esempio n. 5
0
 protected void installDefaults() {
   super.installDefaults();
   Color colors[] = AbstractLookAndFeel.getTheme().getThumbColors();
   rolloverColors = new Color[colors.length];
   dragColors = new Color[colors.length];
   for (int i = 0; i < colors.length; i++) {
     rolloverColors[i] = ColorHelper.brighter(colors[i], 8);
     dragColors[i] = ColorHelper.darker(colors[i], 8);
   }
 }
Esempio n. 6
0
 protected Color[] getTabColors(int tabIndex, boolean isSelected) {
   if ((tabIndex >= 0) && (tabIndex < tabPane.getTabCount())) {
     boolean isEnabled = tabPane.isEnabledAt(tabIndex);
     Color backColor = tabPane.getBackgroundAt(tabIndex);
     Color colorArr[] = AbstractLookAndFeel.getTheme().getTabColors();
     if ((backColor instanceof UIResource)) {
       if (isSelected) {
         colorArr = AbstractLookAndFeel.getTheme().getDefaultColors();
       } else if (tabIndex == rolloverIndex && isEnabled) {
         colorArr = AbstractLookAndFeel.getTheme().getRolloverColors();
       } else {
         colorArr = AbstractLookAndFeel.getTheme().getTabColors();
       }
     } else {
       if (isSelected) {
         if (tabPane.getTabPlacement() == BOTTOM) {
           colorArr =
               ColorHelper.createColorArr(backColor, ColorHelper.brighter(backColor, 50), 20);
         } else {
           colorArr =
               ColorHelper.createColorArr(ColorHelper.brighter(backColor, 50), backColor, 20);
         }
       } else {
         if (tabIndex == rolloverIndex && isEnabled) {
           colorArr =
               ColorHelper.createColorArr(
                   ColorHelper.brighter(backColor, 80), ColorHelper.brighter(backColor, 20), 20);
         } else {
           colorArr =
               ColorHelper.createColorArr(
                   ColorHelper.brighter(backColor, 40), ColorHelper.darker(backColor, 10), 20);
         }
       }
     }
     return colorArr;
   }
   return AbstractLookAndFeel.getTheme().getTabColors();
 }
Esempio n. 7
0
    public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {
      AbstractButton button = (AbstractButton) c;
      Graphics2D g2D = (Graphics2D) g;
      Color frameColor = AbstractLookAndFeel.getTheme().getFrameColor();
      if (!JTattooUtilities.isFrameActive(button)) {
        frameColor = ColorHelper.brighter(frameColor, 40);
      }

      if (AbstractLookAndFeel.getTheme().doDrawSquareButtons()) {
        g2D.setColor(Color.white);
        g2D.drawRect(x, y, w - 1, h - 1);

        if (button.getRootPane() != null
            && button.equals(button.getRootPane().getDefaultButton())
            && !button.hasFocus()) {
          g2D.setColor(ColorHelper.darker(frameColor, 20));
          g2D.drawRect(x, y, w - 1, h - 2);
          if (!button.getModel().isRollover()) {
            g2D.setColor(defaultColorHi);
            g2D.drawRect(x + 1, y + 1, w - 3, h - 4);
            g2D.setColor(defaultColorLo);
            g2D.drawRect(x + 2, y + 2, w - 5, h - 6);
          }
        } else {
          g2D.setColor(frameColor);
          g2D.drawRect(x, y, w - 2, h - 2);
        }
      } else {
        Object savedRederingHint = g2D.getRenderingHint(RenderingHints.KEY_ANTIALIASING);
        g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

        if (button.getRootPane() != null
            && button.equals(button.getRootPane().getDefaultButton())) {
          if (!button.getModel().isRollover()) {
            g2D.setColor(defaultColorHi);
            g2D.drawRoundRect(x + 1, y + 1, w - 4, h - 2, 6, 6);
            g2D.setColor(defaultColorLo);
            g2D.drawRoundRect(x + 2, y + 2, w - 6, h - 6, 6, 6);
          }
        }

        g2D.setColor(Color.white);
        g2D.drawRoundRect(x, y, w - 1, h - 1, 6, 6);

        g2D.setColor(frameColor);
        g2D.drawRoundRect(x, y, w - 2, h - 2, 6, 6);

        g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, savedRederingHint);
      }
    }
Esempio n. 8
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 (model.isEnabled()) {
        if ((model.isPressed() && model.isArmed()) || model.isSelected()) {
          Color frameColor =
              ColorHelper.darker(AbstractLookAndFeel.getToolbarBackgroundColor(), 30);
          g.setColor(frameColor);
          g.drawRect(x, y, w - 1, h - 1);

          Graphics2D g2D = (Graphics2D) g;
          Composite composite = g2D.getComposite();
          AlphaComposite alpha = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.1f);
          g2D.setComposite(alpha);
          g.setColor(Color.black);
          g.fillRect(x + 1, y + 1, w - 2, h - 2);
          g2D.setComposite(composite);
        } else if (model.isRollover()) {
          Color frameColor = AbstractLookAndFeel.getToolbarBackgroundColor();
          Color frameHiColor = ColorHelper.darker(frameColor, 5);
          Color frameLoColor = ColorHelper.darker(frameColor, 20);
          JTattooUtilities.draw3DBorder(g, frameHiColor, frameLoColor, x, y, w, h);
          frameHiColor = Color.white;
          frameLoColor = ColorHelper.brighter(frameLoColor, 60);
          JTattooUtilities.draw3DBorder(g, frameHiColor, frameLoColor, x + 1, y + 1, w - 2, h - 2);

          Graphics2D g2D = (Graphics2D) g;
          Composite composite = g2D.getComposite();
          AlphaComposite alpha = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.4f);
          g2D.setComposite(alpha);
          g.setColor(Color.white);
          g.fillRect(x + 2, y + 2, w - 4, h - 4);
          g2D.setComposite(composite);

          g.setColor(AbstractLookAndFeel.getFocusColor());
          g.drawLine(x + 1, y + 1, x + w - 1, y + 1);
          g.drawLine(x + 1, y + 2, x + w - 2, y + 2);
        } else if (model.isSelected()) {
          Color frameColor = AbstractLookAndFeel.getToolbarBackgroundColor();
          Color frameHiColor = Color.white;
          Color frameLoColor = ColorHelper.darker(frameColor, 30);
          JTattooUtilities.draw3DBorder(g, frameLoColor, frameHiColor, x, y, w, h);
        }
      }
    }
Esempio n. 9
0
 protected void paintRoundedBottomTabBorder(
     int tabIndex, Graphics g, int x1, int y1, int x2, int y2, boolean isSelected) {
   Graphics2D g2D = (Graphics2D) g;
   Object savedRederingHint = g2D.getRenderingHint(RenderingHints.KEY_ANTIALIASING);
   g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
   int d = 2 * GAP;
   if (isSelected) {
     g.setColor(AbstractLookAndFeel.getTheme().getFrameColor());
   } else {
     g.setColor(ColorHelper.brighter(AbstractLookAndFeel.getTheme().getFrameColor(), 40));
   }
   g.drawLine(x1 + GAP, y2, x2 - GAP, y2);
   g.drawArc(x1, y2 - d, d, d, 180, 90);
   g.drawArc(x2 - d, y2 - d, d, d, -90, 90);
   g.drawLine(x1, y1, x1, y2 - GAP - 1);
   g.drawLine(x2, y1, x2, y2 - GAP - 1);
   g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, savedRederingHint);
 }
Esempio n. 10
0
 protected Color[] getContentBorderColors(int tabPlacement) {
   Color controlColorLight = AbstractLookAndFeel.getTheme().getControlColorLight();
   if (!controlColorLight.equals(new ColorUIResource(106, 150, 192))) {
     controlColorLight = ColorHelper.brighter(controlColorLight, 6);
     Color controlColorDark = AbstractLookAndFeel.getTheme().getControlColorDark();
     if (sepColors == null) {
       sepColors = new Color[5];
       sepColors[0] = controlColorDark;
       sepColors[1] = controlColorLight;
       sepColors[2] = controlColorLight;
       sepColors[3] = controlColorLight;
       sepColors[4] = controlColorDark;
     }
     return sepColors;
   } else {
     if (tabPlacement == TOP || tabPlacement == LEFT) {
       if (sepColors == null) {
         int len = AbstractLookAndFeel.getTheme().getDefaultColors().length;
         sepColors = new Color[5];
         sepColors[0] = AbstractLookAndFeel.getTheme().getDefaultColors()[0];
         sepColors[1] = AbstractLookAndFeel.getTheme().getDefaultColors()[len - 6];
         sepColors[2] = AbstractLookAndFeel.getTheme().getDefaultColors()[2];
         sepColors[3] = AbstractLookAndFeel.getTheme().getDefaultColors()[1];
         sepColors[4] = AbstractLookAndFeel.getTheme().getDefaultColors()[0];
       }
       return sepColors;
     } else {
       if (altSepColors == null) {
         altSepColors = new Color[5];
         altSepColors[0] = AbstractLookAndFeel.getTheme().getDefaultColors()[9];
         altSepColors[1] = AbstractLookAndFeel.getTheme().getDefaultColors()[8];
         altSepColors[2] = AbstractLookAndFeel.getTheme().getDefaultColors()[7];
         altSepColors[3] = AbstractLookAndFeel.getTheme().getDefaultColors()[6];
         altSepColors[4] = AbstractLookAndFeel.getTheme().getDefaultColors()[0];
       }
       return altSepColors;
     }
   }
 }
Esempio n. 11
0
  public void setUpColorArrs() {
    super.setUpColorArrs();

    Color topHi = white;
    Color topLo = buttonColorLight;
    Color bottomHi = ColorHelper.brighter(buttonColorDark, 40);
    Color bottomLo = buttonColorDark;
    Color topColors[] = ColorHelper.createColorArr(topHi, topLo, 11);
    Color bottomColors[] = ColorHelper.createColorArr(bottomHi, bottomLo, 13);
    BUTTON_COLORS = new Color[24];
    System.arraycopy(topColors, 0, BUTTON_COLORS, 0, 11);
    System.arraycopy(bottomColors, 0, BUTTON_COLORS, 11, 13);
    CHECKBOX_COLORS = BUTTON_COLORS;

    DEFAULT_COLORS = ColorHelper.createColorArr(controlColorLight, controlColorDark, 24);
    HIDEFAULT_COLORS = new Color[20];
    for (int i = 0; i < 20; i++) {
      HIDEFAULT_COLORS[i] = ColorHelper.brighter(DEFAULT_COLORS[i], 40);
    }
    SELECTED_COLORS =
        ColorHelper.createColorArr(selectionBackgroundColorLight, selectionBackgroundColorDark, 20);
    SELECTION_COLORS =
        SELECTED_COLORS; // ColorHelper.createColorArr(selectionBackgroundColorLight,
                         // selectionBackgroundColorDark, 20);
    MENU_SELECTION_COLORS =
        ColorHelper.createColorArr(
            menuSelectionBackgroundColorLight, menuSelectionBackgroundColorDark, 20);

    topHi = rolloverColorLight;
    topLo = rolloverColorDark;
    bottomHi = ColorHelper.darker(rolloverColorDark, 6);
    bottomLo = ColorHelper.darker(rolloverColorDark, 10);
    topColors = ColorHelper.createColorArr(topHi, topLo, 11);
    bottomColors = ColorHelper.createColorArr(bottomHi, bottomLo, 13);
    ROLLOVER_COLORS = new Color[24];
    System.arraycopy(topColors, 0, ROLLOVER_COLORS, 0, 11);
    System.arraycopy(bottomColors, 0, ROLLOVER_COLORS, 11, 13);
    PRESSED_COLORS = ColorHelper.createColorArr(buttonColorDark, buttonColorLight, 24);
    DISABLED_COLORS = ColorHelper.createColorArr(superLightGray, extraLightGray, 24);
    ACTIVE_COLORS = DEFAULT_COLORS;
    INACTIVE_COLORS = BUTTON_COLORS;

    WINDOW_TITLE_COLORS =
        ColorHelper.createColorArr(windowTitleColorLight, windowTitleColorDark, 24);
    WINDOW_INACTIVE_TITLE_COLORS =
        ColorHelper.createColorArr(windowInactiveTitleColorLight, windowInactiveTitleColorDark, 24);

    TOOLBAR_COLORS = ColorHelper.createColorArr(toolbarColorLight, toolbarColorDark, 24);
    MENUBAR_COLORS = ColorHelper.createColorArr(menuColorLight, menuColorDark, 24);

    TAB_COLORS =
        BUTTON_COLORS; // ColorHelper.createColorArr(controlColorLight, controlColorDark, 24);
    COL_HEADER_COLORS = BUTTON_COLORS;

    THUMB_COLORS = ColorHelper.createColorArr(backgroundColorLight, backgroundColorDark, 24);
    Color hiColor = ColorHelper.brighter(backgroundColor, 30);
    Color loColor = ColorHelper.brighter(backgroundColor, 10);
    TRACK_COLORS = ColorHelper.createColorArr(loColor, hiColor, 24);

    SLIDER_COLORS = THUMB_COLORS;
    PROGRESSBAR_COLORS = SLIDER_COLORS;
  }
Esempio n. 12
0
    public void paintIcon(Component c, Graphics g, int x, int y) {
      if (!JTattooUtilities.isLeftToRight(c)) {
        x += GAP;
      }
      int w = getIconWidth() - GAP;
      int h = getIconHeight();

      Graphics2D g2D = (Graphics2D) g;
      AbstractButton button = (AbstractButton) c;
      ButtonModel model = button.getModel();
      Color colors[];
      if (button.isEnabled()) {
        if ((button.isRolloverEnabled() && model.isRollover())
            || (model.isPressed() && model.isArmed())) {
          colors = AbstractLookAndFeel.getTheme().getRolloverColors();
        } else {
          if (AbstractLookAndFeel.getTheme().doShowFocusFrame() && button.hasFocus()) {
            colors = AbstractLookAndFeel.getTheme().getFocusColors();
          } else {
            colors = AbstractLookAndFeel.getTheme().getCheckBoxColors();
          }
        }
      } else {
        colors = AbstractLookAndFeel.getTheme().getDisabledColors();
      }

      Color frameColor =
          ColorHelper.brighter(AbstractLookAndFeel.getTheme().getButtonBackgroundColor(), 6);
      Shape savedClip = g.getClip();
      Area clipArea = new Area(new Ellipse2D.Double(x, y, w + 1, h + 1));
      if (savedClip != null) {
        clipArea.intersect(new Area(savedClip));
      }
      g2D.setClip(clipArea);
      JTattooUtilities.fillHorGradient(g, colors, x, y, w, h);
      g2D.setClip(savedClip);

      Object savedRederingHint = g2D.getRenderingHint(RenderingHints.KEY_ANTIALIASING);
      g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
      g.setColor(frameColor);
      g.drawOval(x, y, w, h);

      if (model.isSelected()) {
        if (model.isEnabled()) {
          Color fc = AbstractLookAndFeel.getForegroundColor();
          if (ColorHelper.getGrayValue(colors[0]) < 128) {
            if (ColorHelper.getGrayValue(fc) < 128) {
              g2D.setColor(Color.white);
            } else {
              g2D.setColor(fc);
            }
          } else {
            if (ColorHelper.getGrayValue(fc) > 128) {
              g2D.setColor(Color.black);
            } else {
              g2D.setColor(fc);
            }
          }
        } else {
          g.setColor(AbstractLookAndFeel.getDisabledForegroundColor());
        }
        if (AbstractLookAndFeel.getTheme().isSmallFontSize()) {
          g2D.fillOval(x + 4, y + 4, w - 7, h - 7);
        } else if (AbstractLookAndFeel.getTheme().isMediumFontSize()) {
          g2D.fillOval(x + 4, y + 4, w - 7, h - 7);
        } else {
          g2D.fillOval(x + 5, y + 5, w - 9, h - 9);
        }
      }
      g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, savedRederingHint);
    }
Esempio n. 13
0
    public void paintIcon(Component c, Graphics g, int x, int y) {
      if (!JTattooUtilities.isLeftToRight(c)) {
        x += GAP;
      }
      int w = getIconWidth() - GAP;
      int h = getIconHeight();
      AbstractButton button = (AbstractButton) c;
      ButtonModel model = button.getModel();
      Graphics2D g2D = (Graphics2D) g;
      if (button.isEnabled()) {
        if ((button.isRolloverEnabled() && model.isRollover())) {
          JTattooUtilities.fillHorGradient(
              g, AbstractLookAndFeel.getTheme().getRolloverColors(), x + 1, y + 1, w - 1, h - 1);
        } else {
          if (AbstractLookAndFeel.getTheme().doShowFocusFrame() && button.hasFocus()) {
            JTattooUtilities.fillHorGradient(
                g, AbstractLookAndFeel.getTheme().getFocusColors(), x + 1, y + 1, w - 1, h - 1);
          } else {
            JTattooUtilities.fillHorGradient(
                g, AbstractLookAndFeel.getTheme().getCheckBoxColors(), x + 1, y + 1, w - 1, h - 1);
          }
        }
      } else {
        JTattooUtilities.fillHorGradient(
            g, AbstractLookAndFeel.getTheme().getDisabledColors(), x + 1, y + 1, w - 1, h - 1);
      }

      Color frameColor =
          ColorHelper.brighter(AbstractLookAndFeel.getTheme().getButtonBackgroundColor(), 6);
      Color loFrameColor =
          ColorHelper.darker(AbstractLookAndFeel.getTheme().getButtonBackgroundColor(), 50);

      g.setColor(frameColor);
      g.drawRect(x, y, w, h);
      Composite savedComposite = g2D.getComposite();
      AlphaComposite alpha = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f);
      g2D.setComposite(alpha);
      g.setColor(loFrameColor);
      g.drawLine(x + 1, y + 1, x + w - 1, y + 1);
      g.drawLine(x + 1, y + 1, x + 1, y + h - 1);
      g2D.setComposite(savedComposite);

      Icon checkIcon;
      Icon checkDisabledIcon;
      Icon checkInverseIcon;
      if (AbstractLookAndFeel.getTheme().isSmallFontSize()) {
        checkIcon = SMALL_CHECK_ICON;
        checkDisabledIcon = SMALL_CHECK_DISABLED_ICON;
        checkInverseIcon = SMALL_CHECK_INVERSE_ICON;
      } else if (AbstractLookAndFeel.getTheme().isMediumFontSize()) {
        checkIcon = MEDIUM_CHECK_ICON;
        checkDisabledIcon = MEDIUM_CHECK_DISABLED_ICON;
        checkInverseIcon = MEDIUM_CHECK_INVERSE_ICON;
      } else {
        checkIcon = LARGE_CHECK_ICON;
        checkDisabledIcon = LARGE_CHECK_DISABLED_ICON;
        checkInverseIcon = LARGE_CHECK_INVERSE_ICON;
      }
      int xi = x + ((w - checkIcon.getIconWidth()) / 2) + 1;
      int yi = y + ((h - checkIcon.getIconHeight()) / 2);
      int gv = ColorHelper.getGrayValue(AbstractLookAndFeel.getButtonForegroundColor());
      if (model.isPressed() && model.isArmed()) {
        Color bc =
            gv > 128
                ? AbstractLookAndFeel.getTheme().getSelectionForegroundColor()
                : AbstractLookAndFeel.getTheme().getSelectionBackgroundColor();
        Color fc = gv > 128 ? ColorHelper.brighter(bc, 20) : ColorHelper.darker(bc, 40);
        g.setColor(fc);
        g.drawRect(x + 4, y + 4, w - 8, h - 8);
        g.setColor(bc);
        g.fillRect(x + 5, y + 5, w - 9, h - 9);
      } else if (model.isSelected()) {
        if (!model.isEnabled()) {
          checkDisabledIcon.paintIcon(c, g, xi + 1, yi);
        } else {
          if (gv > 128) {
            checkIcon.paintIcon(c, g, xi, yi);
          } else {
            checkInverseIcon.paintIcon(c, g, xi + 1, yi + 1);
          }
        }
      }
    }
Esempio n. 14
0
    public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {
      Graphics2D g2D = (Graphics2D) g;
      boolean active = isActive(c);
      boolean resizable = isResizable(c);
      int th = getTitleHeight(c);
      Color frameColor = AbstractLookAndFeel.getWindowInactiveBorderColor();
      Color titleColor = AbstractLookAndFeel.getWindowInactiveTitleColorLight();
      if (active) {
        titleColor = AbstractLookAndFeel.getWindowTitleColorLight();
        frameColor = AbstractLookAndFeel.getWindowBorderColor();
      }

      if (!resizable) {
        Insets bi = getBorderInsets(c);
        g.setColor(frameColor);
        g.drawRect(x, y, w - 1, h - 1);
        if (active) {
          g.setColor(AbstractLookAndFeel.getWindowTitleColorDark());
        } else {
          g.setColor(AbstractLookAndFeel.getWindowInactiveTitleColorDark());
        }
        for (int i = 1; i < bi.left; i++) {
          g.drawRect(i, i, w - (2 * i) - 1, h - (2 * i) - 1);
        }
        g.setColor(frameColor);
        g.drawLine(bi.left - 1, y + th + bi.top, bi.left - 1, y + h - bi.bottom);
        g.drawLine(w - bi.right, y + th + bi.top, w - bi.right, y + h - bi.bottom);
        g.drawLine(bi.left - 1, y + h - bi.bottom, w - bi.right, y + h - bi.bottom);
        return;
      }
      g.setColor(titleColor);
      g.fillRect(x, y + 1, w, dw - 1);
      g.fillRect(x + 1, y + h - dw, w - 2, dw - 1);
      Color color = ColorHelper.brighter(AbstractLookAndFeel.getWindowTitleColorDark(), 30);
      if (active) {
        JTattooUtilities.fillHorGradient(
            g, AbstractLookAndFeel.getTheme().getWindowTitleColors(), 1, dw, dw, th + 1);
        JTattooUtilities.fillHorGradient(
            g, AbstractLookAndFeel.getTheme().getWindowTitleColors(), w - dw, dw, dw, th + 1);

        Color c1 = AbstractLookAndFeel.getTheme().getWindowTitleColorDark();
        Color c2 = AbstractLookAndFeel.getTheme().getWindowTitleColorLight();
        g2D.setPaint(new GradientPaint(0, dw + th + 1, c1, 0, h - th - (2 * dw), c2));
        g.fillRect(1, dw + th + 1, dw - 1, h - th - (2 * dw));
        g.fillRect(w - dw, dw + th + 1, dw - 1, h - th - (2 * dw));
        g2D.setPaint(null);
      } else {
        JTattooUtilities.fillHorGradient(
            g, AbstractLookAndFeel.getTheme().getWindowInactiveTitleColors(), 1, dw, dw, th + 1);
        JTattooUtilities.fillHorGradient(
            g,
            AbstractLookAndFeel.getTheme().getWindowInactiveTitleColors(),
            w - dw,
            dw,
            dw,
            th + 1);

        Color c1 = AbstractLookAndFeel.getTheme().getWindowInactiveTitleColorDark();
        Color c2 = AbstractLookAndFeel.getTheme().getWindowInactiveTitleColorLight();
        g2D.setPaint(new GradientPaint(0, dw + th + 1, c1, 0, h - th - (2 * dw), c2));
        g.fillRect(1, dw + th + 1, dw - 1, h - th - (2 * dw));
        g.fillRect(w - dw, dw + th + 1, dw - 1, h - th - (2 * dw));
        g2D.setPaint(null);
      }
      if (active && resizable) {
        int d = dw + 12;
        // unten
        color = AbstractLookAndFeel.getWindowTitleColorDark();
        Color cHi = ColorHelper.brighter(color, 30);
        Color cLo = ColorHelper.darker(color, 20);

        // links
        g.setColor(color);
        g.fillRect(x + 1, y + h - d, dw - 1, d - 1);
        g.fillRect(x + dw, y + h - dw, d - dw - 1, d - dw - 1);

        g.setColor(cLo);
        g.drawLine(x + 1, y + h - d - 2, x + dw - 2, y + h - d - 2);
        g.drawLine(x + dw - 2, y + h - d - 2, x + dw - 2, y + h - dw);
        g.drawLine(x + dw - 2, y + h - dw, x + d - 1, y + h - dw);
        g.drawLine(x + d - 1, y + h - dw, x + d - 1, y + h - 1);

        g.setColor(cHi);
        g.drawLine(x + 1, y + h - d - 1, x + dw - 3, y + h - d - 1);
        g.drawLine(x + dw - 1, y + h - d - 1, x + dw - 1, y + h - dw - 1);
        g.drawLine(x + dw - 1, y + h - dw + 1, x + d - 2, y + h - dw + 1);
        g.drawLine(x + d - 2, y + h - dw + 1, x + d - 2, y + h - 1);

        // rechts
        g.setColor(color);
        g.fillRect(x + w - d - 1, y + h - dw, d, dw - 1);
        g.fillRect(x + w - dw, y + h - d - 1, dw - 1, d);

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

        g.setColor(cHi);
        g.drawLine(x + w - dw + 1, y + h - d - 1, x + w - 1, y + h - d - 1);
        g.drawLine(x + w - dw + 1, y + h - d - 1, x + w - dw + 1, y + h - dw);
        g.drawLine(x + w - d, y + h - dw + 1, x + w - dw + 1, y + h - dw + 1);
        g.drawLine(x + w - d, y + h - dw + 1, x + w - d, y + h - 1);
      }
      g.setColor(frameColor);
      g.drawRect(x, y, w - 1, h - 1);
      g.drawLine(x + dw - 1, y + dw + th, x + dw - 1, y + h - dw);
      g.drawLine(x + w - dw, y + dw + th, x + w - dw, y + h - dw);
      g.drawLine(x + dw - 1, y + h - dw, x + w - dw, y + h - dw);
    }
Esempio n. 15
0
  protected void paintBackground(Graphics g, AbstractButton b) {
    if (!b.isContentAreaFilled() || (b.getParent() instanceof JMenuBar)) {
      return;
    }

    if (!(b.isBorderPainted() && (b.getBorder() instanceof UIResource))) {
      super.paintBackground(g, b);
      return;
    }

    int width = b.getWidth();
    int height = b.getHeight();
    ButtonModel model = b.getModel();
    Graphics2D g2D = (Graphics2D) g;
    Composite composite = g2D.getComposite();
    Object savedRederingHint = g2D.getRenderingHint(RenderingHints.KEY_ANTIALIASING);
    g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    if (((width < 64) || (height < 16)) && ((b.getText() == null) || b.getText().length() == 0)) {
      if (model.isSelected()) {
        Color color = ColorHelper.darker(b.getBackground(), 20);
        g2D.setColor(color);
        g2D.fillRect(0, 0, width - 1, height - 1);
        if (model.isEnabled()) {
          g2D.setColor(AbstractLookAndFeel.getFrameColor());
        } else {
          g2D.setColor(ColorHelper.brighter(AbstractLookAndFeel.getFrameColor(), 20));
        }
        g2D.drawRect(0, 0, width - 1, height - 1);
      } else {
        Color[] colors = null;
        if (b.getBackground() instanceof ColorUIResource) {
          if (!model.isEnabled()) {
            colors = AbstractLookAndFeel.getTheme().getDisabledColors();
          } else if (b.isRolloverEnabled() && model.isRollover()) {
            colors = AbstractLookAndFeel.getTheme().getRolloverColors();
          } else {
            colors = AbstractLookAndFeel.getTheme().getButtonColors();
          }
        } else {
          colors =
              ColorHelper.createColorArr(
                  ColorHelper.brighter(b.getBackground(), 20),
                  ColorHelper.darker(b.getBackground(), 20),
                  20);
        }
        JTattooUtilities.fillHorGradient(g, colors, 0, 0, width - 1, height - 1);
        if (model.isEnabled()) {
          g2D.setColor(AbstractLookAndFeel.getFrameColor());
        } else {
          g2D.setColor(ColorHelper.brighter(AbstractLookAndFeel.getFrameColor(), 20));
        }
        g2D.drawRect(0, 0, width - 1, height - 1);
        AlphaComposite alpha = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.6f);
        g2D.setComposite(alpha);
        g2D.setColor(Color.white);
        g2D.drawRect(1, 1, width - 3, height - 3);
      }
    } else if (model.isPressed() && model.isArmed()) {
      int d = height - 2;
      Color color = AbstractLookAndFeel.getTheme().getSelectionBackgroundColor();
      g2D.setColor(color);
      g2D.fillRoundRect(0, 0, width - 1, height - 1, d, d);

      g2D.setColor(ColorHelper.darker(color, 40));
      g2D.drawRoundRect(0, 0, width - 1, height - 1, d, d);
    } else if (model.isSelected()) {
      int d = height - 2;
      Color color = ColorHelper.darker(b.getBackground(), 20);
      g2D.setColor(color);
      g2D.fillRoundRect(0, 0, width - 1, height - 1, d, d);

      if (model.isEnabled()) {
        g2D.setColor(AbstractLookAndFeel.getFrameColor());
      } else {
        g2D.setColor(ColorHelper.brighter(AbstractLookAndFeel.getFrameColor(), 20));
      }
      g2D.drawRoundRect(0, 0, width - 1, height - 1, d, d);
    } else {
      int d = height - 2;

      Color[] colors = null;
      if (b.getBackground() instanceof ColorUIResource) {
        if (!model.isEnabled()) {
          colors = AbstractLookAndFeel.getTheme().getDisabledColors();
        } else if (b.isRolloverEnabled() && model.isRollover()) {
          colors = AbstractLookAndFeel.getTheme().getRolloverColors();
        } else {
          colors = AbstractLookAndFeel.getTheme().getButtonColors();
        }
      } else {
        colors =
            ColorHelper.createColorArr(
                ColorHelper.brighter(b.getBackground(), 20),
                ColorHelper.darker(b.getBackground(), 20),
                20);
      }

      Shape savedClip = g.getClip();
      Area clipArea = new Area(new RoundRectangle2D.Double(0, 0, width - 1, height - 1, d, d));
      clipArea.intersect(new Area(savedClip));
      g2D.setClip(clipArea);
      JTattooUtilities.fillHorGradient(g, colors, 0, 0, width, height);
      g2D.setClip(savedClip);

      if (model.isEnabled()) {
        g2D.setColor(AbstractLookAndFeel.getFrameColor());
      } else {
        g2D.setColor(ColorHelper.brighter(AbstractLookAndFeel.getFrameColor(), 20));
      }
      g2D.drawRoundRect(0, 0, width - 1, height - 1, d, d);

      AlphaComposite alpha = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.6f);
      g2D.setComposite(alpha);
      g2D.setColor(Color.white);
      g2D.drawRoundRect(1, 1, width - 3, height - 3, d - 2, d - 2);
    }
    g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, savedRederingHint);
    g2D.setComposite(composite);
  }
Esempio n. 16
0
 protected Color getContentBorderColor(int tabPlacement) {
   return ColorHelper.brighter(AbstractLookAndFeel.getTheme().getFrameColor(), 50);
 }