コード例 #1
0
ファイル: TextureTitlePane.java プロジェクト: huzhennan/Spark
  public void paintText(Graphics g, int x, int y, String title) {
    x += paintIcon(g, x, y);
    Graphics2D g2D = (Graphics2D) g;
    Shape savedClip = g2D.getClip();
    Color fc = AbstractLookAndFeel.getWindowTitleForegroundColor();
    if (fc.equals(Color.white)) {
      Color bc = AbstractLookAndFeel.getWindowTitleColorDark();
      g2D.setColor(bc);
      JTattooUtilities.drawString(rootPane, g, title, x - 1, y - 1);
      g2D.setColor(ColorHelper.darker(bc, 30));
      JTattooUtilities.drawString(rootPane, g, title, x + 1, y + 1);
    }
    g.setColor(fc);

    Area clipArea = new Area(new Rectangle2D.Double(x, 0, getWidth(), getHeight() / 2));
    clipArea.intersect(new Area(savedClip));
    g2D.setClip(clipArea);
    JTattooUtilities.drawString(rootPane, g, title, x, y);

    clipArea = new Area(new Rectangle2D.Double(x, (getHeight() / 2), getWidth(), getHeight()));
    clipArea.intersect(new Area(savedClip));
    g2D.setClip(clipArea);
    g.setColor(ColorHelper.darker(fc, 20));
    JTattooUtilities.drawString(rootPane, g, title, x, y);

    g2D.setClip(savedClip);
  }
コード例 #2
0
  protected void paintIndeterminate(Graphics g, JComponent c) {
    if (!(g instanceof Graphics2D)) {
      return;
    }
    Graphics2D g2D = (Graphics2D) g;

    Insets b = progressBar.getInsets(); // area for border
    int barRectWidth = progressBar.getWidth() - (b.right + b.left);
    int barRectHeight = progressBar.getHeight() - (b.top + b.bottom);

    Color colors[];
    if (progressBar.getForeground() instanceof UIResource) {
      if (!Utilities.isActive(c)) {
        colors = BaseLookAndFeel.getTheme().getInActiveColors();
      } else if (c.isEnabled()) {
        colors = BaseLookAndFeel.getTheme().getProgressBarColors();
      } else {
        colors = BaseLookAndFeel.getTheme().getDisabledColors();
      }
    } else {
      Color hiColor = ColorHelper.brighter(progressBar.getForeground(), 40);
      Color loColor = ColorHelper.darker(progressBar.getForeground(), 20);
      colors = ColorHelper.createColorArr(hiColor, loColor, 20);
    }

    Color cHi = ColorHelper.darker(colors[colors.length - 1], 5);
    Color cLo = ColorHelper.darker(colors[colors.length - 1], 10);

    // Paint the bouncing box.
    Rectangle box = getBox(null);
    if (box != null) {
      g2D.setColor(progressBar.getForeground());
      Utilities.draw3DBorder(g, cHi, cLo, box.x + 1, box.y + 1, box.width - 2, box.height - 2);
      if (progressBar.getOrientation() == JProgressBar.HORIZONTAL) {
        Utilities.fillHorGradient(g, colors, box.x + 2, box.y + 2, box.width - 4, box.height - 4);
      } else {
        Utilities.fillVerGradient(g, colors, box.x + 2, box.y + 2, box.width - 4, box.height - 4);
      }

      // Deal with possible text painting
      if (progressBar.isStringPainted()) {
        Object savedRenderingHint = null;
        if (BaseLookAndFeel.getTheme().isTextAntiAliasingOn()) {
          savedRenderingHint = g2D.getRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING);
          g2D.setRenderingHint(
              RenderingHints.KEY_TEXT_ANTIALIASING,
              BaseLookAndFeel.getTheme().getTextAntiAliasingHint());
        }
        if (progressBar.getOrientation() == JProgressBar.HORIZONTAL) {
          paintString(g2D, b.left, b.top, barRectWidth, barRectHeight, box.width, b);
        } else {
          paintString(g2D, b.left, b.top, barRectWidth, barRectHeight, box.height, b);
        }
        if (BaseLookAndFeel.getTheme().isTextAntiAliasingOn()) {
          g2D.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, savedRenderingHint);
        }
      }
    }
  }
コード例 #3
0
ファイル: GraphiteTitlePane.java プロジェクト: recon88/Botnak
 public void paintBorder(Graphics g) {
   if (isActive()) {
     g.setColor(ColorHelper.darker(AbstractLookAndFeel.getWindowBorderColor(), 10));
   } else {
     g.setColor(ColorHelper.darker(AbstractLookAndFeel.getWindowInactiveBorderColor(), 10));
   }
   g.drawLine(0, getHeight() - 1, getWidth(), getHeight() - 1);
 }
コード例 #4
0
 public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {
   Color logoColor = AbstractLookAndFeel.getMenuSelectionBackgroundColor();
   Color borderColorLo = AbstractLookAndFeel.getFrameColor();
   Color borderColorHi =
       ColorHelper.brighter(AbstractLookAndFeel.getMenuSelectionBackgroundColor(), 40);
   g.setColor(logoColor);
   if (JTattooUtilities.isLeftToRight(c)) {
     int dx = getBorderInsets(c).left;
     g.fillRect(x, y, dx - 1, h - 1);
     paintLogo(c, g, x, y, w, h);
     // - highlight
     g.setColor(ColorHelper.brighter(AbstractLookAndFeel.getMenuBackgroundColor(), 40));
     g.drawLine(x + dx, y + 1, x + w - 2, y + 1);
     g.setColor(borderColorHi);
     g.drawLine(x + 1, y, x + 1, y + h - 2);
     // - outer frame
     g.setColor(borderColorLo);
     if (isMenuBarPopup(c)) {
       // top
       g.drawLine(x + dx - 1, y, x + w, y);
       // left
       g.drawLine(x, y, x, y + h - 1);
       // bottom
       g.drawLine(x, y + h - 1, x + w, y + h - 1);
       // right
       g.drawLine(x + w - 1, y + 1, x + w - 1, y + h - 1);
     } else {
       g.drawRect(x, y, w - 1, h - 1);
     }
     // - logo separator
     g.drawLine(x + dx - 1, y + 1, x + dx - 1, y + h - 1);
   } else {
     int dx = getBorderInsets(c).right;
     g.fillRect(x + w - dx, y, dx, h - 1);
     paintLogo(c, g, x, y, w, h);
     // - highlight
     g.setColor(ColorHelper.brighter(AbstractLookAndFeel.getMenuBackgroundColor(), 40));
     g.drawLine(x + 1, y + 1, x + w - dx - 1, y + 1);
     g.drawLine(x + 1, y + 1, x + 1, y + h - 2);
     // - outer frame
     g.setColor(borderColorLo);
     if (isMenuBarPopup(c)) {
       // top
       g.drawLine(x, y, x + w - dx, y);
       // left
       g.drawLine(x, y, x, y + h - 1);
       // bottom
       g.drawLine(x, y + h - 1, x + w, y + h - 1);
       // right
       g.drawLine(x + w - 1, y, x + w - 1, y + h - 1);
     } else {
       g.drawRect(x, y, w - 1, h - 1);
     }
     // - logo separator
     g.drawLine(x + w - dx, y + 1, x + w - dx, y + h - 1);
   }
 }
コード例 #5
0
ファイル: HiFiScrollBarUI.java プロジェクト: undyliu/mars
 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);
   }
 }
コード例 #6
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;
 }
コード例 #7
0
ファイル: HiFiScrollBarUI.java プロジェクト: undyliu/mars
 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;
   }
 }
コード例 #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();
   Color frameColor = AbstractLookAndFeel.getToolbarBackgroundColor();
   Color frameHiColor = ColorHelper.brighter(frameColor, 10);
   Color frameLoColor = ColorHelper.darker(frameColor, 30);
   JTattooUtilities.draw3DBorder(g, frameHiColor, frameLoColor, x, y, w, h);
   if ((model.isPressed() && model.isArmed()) || model.isSelected()) {
     JTattooUtilities.draw3DBorder(g, frameLoColor, frameHiColor, x, y, w, h);
   } else {
     JTattooUtilities.draw3DBorder(g, frameLoColor, frameHiColor, x, y, w, h);
     JTattooUtilities.draw3DBorder(g, frameHiColor, frameLoColor, x + 1, y + 1, w - 2, h - 2);
   }
 }
コード例 #9
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);
      }
    }
コード例 #10
0
 public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {
   JMenuItem b = (JMenuItem) c;
   ButtonModel model = b.getModel();
   Color borderColorLo = AbstractLookAndFeel.getFrameColor();
   Color borderColorHi =
       ColorHelper.brighter(AbstractLookAndFeel.getMenuSelectionBackgroundColor(), 40);
   if (c.getParent() instanceof JMenuBar) {
     if (model.isArmed() || model.isSelected()) {
       g.setColor(borderColorLo);
       g.drawLine(x, y, x + w - 1, y);
       g.drawLine(x, y, x, y + h - 1);
       g.drawLine(x + w - 1, y + 1, x + w - 1, y + h - 1);
       g.setColor(borderColorHi);
       g.drawLine(x + 1, y + 1, x + w - 2, y + 1);
       g.drawLine(x + 1, y + 1, x + 1, y + h - 1);
     }
   } else {
     if (model.isArmed() || (c instanceof JMenu && model.isSelected())) {
       g.setColor(borderColorLo);
       g.drawLine(x, y, x + w - 1, y);
       g.drawLine(x, y + h - 1, x + w - 1, y + h - 1);
       g.setColor(borderColorHi);
       g.drawLine(x, y + 1, x + w - 2, y + 1);
     }
   }
 }
コード例 #11
0
 public MyRenderComponent(
     JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int col) {
   super();
   this.table = table;
   this.col = col;
   if (value != null) {
     setText(value.toString());
   } else {
     setText("");
   }
   setOpaque(false);
   setFont(UIManager.getFont("TableHeader.font"));
   setForeground(UIManager.getColor("TableHeader.foreground"));
   setHorizontalAlignment(JLabel.CENTER);
   setHorizontalTextPosition(SwingConstants.LEADING);
   setBorder(UIManager.getBorder("TableHeader.cellBorder"));
   if ((JTattooUtilities.getJavaVersion() >= 1.6)
       && (UIManager.getLookAndFeel() instanceof AbstractLookAndFeel)) {
     RowSorter rowSorter = table == null ? null : table.getRowSorter();
     List keyList = rowSorter == null ? null : rowSorter.getSortKeys();
     if ((keyList != null) && (keyList.size() > 0)) {
       RowSorter.SortKey sortKey = (RowSorter.SortKey) keyList.get(0);
       if (sortKey.getColumn() == table.convertColumnIndexToModel(col)) {
         AbstractIconFactory iconFactory =
             ((AbstractLookAndFeel) UIManager.getLookAndFeel()).getIconFactory();
         if (sortKey.getSortOrder().equals(SortOrder.ASCENDING)) {
           setIcon(iconFactory.getUpArrowIcon());
         } else if (sortKey.getSortOrder().equals(SortOrder.DESCENDING)) {
           setIcon(iconFactory.getDownArrowIcon());
         }
       }
     }
   }
   gv = ColorHelper.getGrayValue(AbstractLookAndFeel.getTheme().getRolloverColor());
 }
コード例 #12
0
ファイル: BaseComboBoxUI.java プロジェクト: kerberos20/aion-
    public void paint(Graphics g) {
      Dimension size = getSize();
      Color colors[];
      if (isEnabled()) {
        if (getModel().isArmed() && getModel().isPressed()) {
          colors = BaseLookAndFeel.getTheme().getPressedColors();
        } else if (getModel().isRollover()) {
          colors = BaseLookAndFeel.getTheme().getRolloverColors();
        } else {
          colors = BaseLookAndFeel.getTheme().getButtonColors();
        }
      } else {
        colors = BaseLookAndFeel.getTheme().getDisabledColors();
      }
      Utilities.fillHorGradient(g, colors, 0, 0, size.width, size.height);

      boolean inverse = ColorHelper.getGrayValue(colors) < 128;

      Icon icon = inverse ? BaseIcons.getComboBoxInverseIcon() : BaseIcons.getComboBoxIcon();
      int x = (size.width - icon.getIconWidth()) / 2;
      int y = (size.height - icon.getIconHeight()) / 2;

      Graphics2D g2D = (Graphics2D) g;
      Composite savedComposite = g2D.getComposite();
      g2D.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.8f));
      if (getModel().isPressed() && getModel().isArmed()) {
        icon.paintIcon(this, g, x + 2, y + 1);
      } else {
        icon.paintIcon(this, g, x + 1, y);
      }
      g2D.setComposite(savedComposite);
      paintBorder(g2D);
    }
コード例 #13
0
 public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
   Color hiColor = ColorHelper.brighter(AbstractLookAndFeel.getTheme().getFocusFrameColor(), 60);
   Color loColor = AbstractLookAndFeel.getTheme().getFocusFrameColor();
   g.setColor(loColor);
   g.drawRect(x, y, width - 1, height - 1);
   g.setColor(hiColor);
   g.drawRect(x + 1, y + 1, width - 3, height - 3);
 }
コード例 #14
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);
 }
コード例 #15
0
 /**
  * Gets the progress bar border.
  *
  * @return the progress bar border
  */
 public static Border getProgressBarBorder() {
   if (progressBarBorder == null) {
     progressBarBorder =
         BorderFactory.createLineBorder(
             ColorHelper.darker(AbstractLookAndFeel.getBackgroundColor(), 30));
   }
   return progressBarBorder;
 }
コード例 #16
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);
        }
      }
    }
コード例 #17
0
  public static void drawRound3DBorder(Graphics g, Color c1, Color c2, int x, int y, int w, int h) {
    Graphics2D g2D = (Graphics2D) g;
    int x2 = x + w;
    int y2 = y + h;
    int d = h;
    int r = h / 2;
    Color cm = ColorHelper.median(c1, c2);
    Color c1m = ColorHelper.median(c1, cm);
    Color c2m = ColorHelper.median(c2, cm);

    Object savedRederingHint = g2D.getRenderingHint(RenderingHints.KEY_ANTIALIASING);
    g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    // oben
    g2D.setColor(c1);
    g2D.drawLine(x + r, y, x2 - r, y);
    // rechts
    g2D.drawLine(x, y + r, x, y2 - r);
    // unten
    g2D.setColor(c2);
    g2D.drawLine(x + r, y2, x2 - r, y2);
    // links
    g2D.drawLine(x2, y + r, x2, y2 - r);

    // links
    g2D.setColor(c1);
    g2D.drawArc(x, y, d, d, 90, 45);
    g2D.setColor(c1m);
    g2D.drawArc(x, y, d, d, 135, 45);
    g2D.setColor(cm);
    g2D.drawArc(x, y, d, d, 180, 45);
    g2D.setColor(c2m);
    g2D.drawArc(x, y, d, d, 225, 45);
    // rechts
    g2D.setColor(c1m);
    g2D.drawArc(x2 - d, y, d, d, 45, 45);
    g2D.setColor(cm);
    g2D.drawArc(x2 - d, y, d, d, 0, 45);
    g2D.setColor(c2m);
    g2D.drawArc(x2 - d, y, d, d, -45, 45);
    g2D.setColor(c2);
    g2D.drawArc(x2 - d, y, d, d, -90, 45);
    g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, savedRederingHint);
  }
コード例 #18
0
ファイル: BaseSeparatorUI.java プロジェクト: recon88/Botnak
 public void paint(Graphics g, JComponent c) {
   boolean horizontal = true;
   if (c instanceof JSeparator) {
     horizontal = (((JSeparator) c).getOrientation() == JSeparator.HORIZONTAL);
   }
   if (horizontal) {
     int w = c.getWidth();
     g.setColor(AbstractLookAndFeel.getBackgroundColor());
     g.drawLine(0, 0, w, 0);
     g.setColor(ColorHelper.darker(AbstractLookAndFeel.getBackgroundColor(), 30));
     g.drawLine(0, 1, w, 1);
     g.setColor(ColorHelper.brighter(AbstractLookAndFeel.getBackgroundColor(), 50));
     g.drawLine(0, 2, w, 2);
   } else {
     int h = c.getHeight();
     g.setColor(ColorHelper.darker(AbstractLookAndFeel.getBackgroundColor(), 30));
     g.drawLine(0, 0, 0, h);
     g.setColor(ColorHelper.brighter(AbstractLookAndFeel.getBackgroundColor(), 50));
     g.drawLine(1, 0, 1, h);
   }
 }
コード例 #19
0
 public static Color getBorderColor(CTBorder border) {
   if (border == null) {
     return null;
   }
   // border.getColor returns object???, use attribute w:color to get
   // the color.
   Node colorAttr = border.getDomNode().getAttributes().getNamedItemNS(MAIN_NAMESPACE, "color");
   if (colorAttr != null) {
     Object val = border.getVal();
     return ColorHelper.getColor(((Attr) colorAttr).getValue(), val, false);
   }
   return null;
 }
コード例 #20
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();
 }
コード例 #21
0
ファイル: GraphiteTitlePane.java プロジェクト: recon88/Botnak
 public void paintText(Graphics g, int x, int y, String title) {
   x += paintIcon(g, x, y);
   Graphics2D g2D = (Graphics2D) g;
   Color fc = AbstractLookAndFeel.getWindowTitleForegroundColor();
   if (fc.equals(Color.white)) {
     Color bc = AbstractLookAndFeel.getWindowTitleColorDark();
     g2D.setColor(bc);
     JTattooUtilities.drawString(rootPane, g, title, x - 1, y - 1);
     g2D.setColor(ColorHelper.darker(bc, 30));
     JTattooUtilities.drawString(rootPane, g, title, x + 1, y + 1);
   }
   g.setColor(fc);
   JTattooUtilities.drawString(rootPane, g, title, x, y);
 }
コード例 #22
0
 public void paintText(Graphics g, int x, int y, String title) {
   Color shadowColor = AcrylLookAndFeel.getWindowTitleColorDark();
   if (isActive()) {
     shadowColor = ColorHelper.darker(shadowColor, 30);
   }
   g.setColor(shadowColor);
   JTattooUtilities.drawString(frame, g, title, x - 1, y - 1);
   JTattooUtilities.drawString(frame, g, title, x - 1, y + 1);
   JTattooUtilities.drawString(frame, g, title, x + 1, y - 1);
   JTattooUtilities.drawString(frame, g, title, x + 1, y + 1);
   if (isActive()) {
     g.setColor(AbstractLookAndFeel.getWindowTitleForegroundColor());
   } else {
     g.setColor(AbstractLookAndFeel.getWindowInactiveTitleForegroundColor());
   }
   JTattooUtilities.drawString(frame, g, title, x, y);
 }
コード例 #23
0
 public static TableCellBorder getTableCellBorder(CTBorder border, boolean fromTableCell) {
   if (border != null) {
     boolean noBorder = (STBorder.NONE == border.getVal() || STBorder.NIL == border.getVal());
     if (noBorder) {
       return new TableCellBorder(!noBorder, fromTableCell);
     }
     Float borderSize = null;
     BigInteger size = border.getSz();
     if (size != null) {
       // http://officeopenxml.com/WPtableBorders.php
       // if w:sz="4" => 1/4 points
       borderSize = size.floatValue() / 8f;
     }
     Color borderColor = ColorHelper.getBorderColor(border);
     return new TableCellBorder(borderSize, borderColor, fromTableCell);
   }
   return null;
 }
コード例 #24
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);
 }
コード例 #25
0
  protected void paintText(Graphics g, AbstractButton b, Rectangle textRect, String text) {
    ButtonModel model = b.getModel();
    FontMetrics fm = JTattooUtilities.getFontMetrics(b, g, b.getFont());
    int mnemIndex;
    if (JTattooUtilities.getJavaVersion() >= 1.4) {
      mnemIndex = b.getDisplayedMnemonicIndex();
    } else {
      mnemIndex = JTattooUtilities.findDisplayedMnemonicIndex(b.getText(), model.getMnemonic());
    }
    int offs = 0;
    if (model.isArmed() && model.isPressed()) {
      offs = 1;
    }

    Graphics2D g2D = (Graphics2D) g;
    Composite composite = g2D.getComposite();
    AlphaComposite alpha = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.6f);
    g2D.setComposite(alpha);
    Color foreground = b.getForeground();
    Color background = b.getBackground();
    if (background instanceof ColorUIResource) {
      if (model.isPressed() && model.isArmed()) {
        foreground = AbstractLookAndFeel.getTheme().getSelectionForegroundColor();
      } else if (model.isRollover()) {
        foreground = AbstractLookAndFeel.getTheme().getRolloverForegroundColor();
      }
    }
    if (!model.isEnabled()) {
      foreground = AbstractLookAndFeel.getTheme().getDisabledForegroundColor();
    }
    if (ColorHelper.getGrayValue(foreground) > 64) {
      g2D.setColor(Color.black);
    } else {
      g2D.setColor(Color.white);
    }
    JTattooUtilities.drawStringUnderlineCharAt(
        b, g, text, mnemIndex, textRect.x + offs + 1, textRect.y + offs + fm.getAscent() + 1);
    g2D.setComposite(composite);
    g2D.setColor(foreground);
    JTattooUtilities.drawStringUnderlineCharAt(
        b, g, text, mnemIndex, textRect.x + offs, textRect.y + offs + fm.getAscent());
  }
コード例 #26
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;
     }
   }
 }
コード例 #27
0
 protected void paintText(Graphics g, JComponent c, String text, Rectangle textRect) {
   View v = (View) c.getClientProperty(BasicHTML.propertyKey);
   if (v != null) {
     v.paint(g, textRect);
   } else {
     AbstractButton b = (AbstractButton) c;
     ButtonModel model = b.getModel();
     int mnemIndex = -1;
     if (JTattooUtilities.getJavaVersion() >= 1.4) {
       mnemIndex = b.getDisplayedMnemonicIndex();
     } else {
       mnemIndex = JTattooUtilities.findDisplayedMnemonicIndex(b.getText(), model.getMnemonic());
     }
     Font f = c.getFont();
     g.setFont(f);
     FontMetrics fm = g.getFontMetrics();
     if (model.isEnabled()) {
       Color fc = b.getForeground();
       if (AbstractLookAndFeel.getTheme().isTextShadowOn() && ColorHelper.getGrayValue(fc) > 128) {
         g.setColor(Color.black);
         JTattooUtilities.drawStringUnderlineCharAt(
             c, g, text, mnemIndex, textRect.x + 1, textRect.y + 1 + fm.getAscent());
       }
       g.setColor(fc);
       JTattooUtilities.drawStringUnderlineCharAt(
           c, g, text, mnemIndex, textRect.x, textRect.y + fm.getAscent());
     } else {
       g.setColor(Color.black);
       JTattooUtilities.drawStringUnderlineCharAt(
           c, g, text, mnemIndex, textRect.x + 1, textRect.y + 1 + fm.getAscent());
       g.setColor(AbstractLookAndFeel.getDisabledForegroundColor());
       JTattooUtilities.drawStringUnderlineCharAt(
           c, g, text, mnemIndex, textRect.x, textRect.y + fm.getAscent());
     }
   }
 }
コード例 #28
0
ファイル: BaseSliderUI.java プロジェクト: recon88/Botnak
  public void paintTrack(Graphics g) {
    boolean leftToRight = JTattooUtilities.isLeftToRight(slider);

    g.translate(trackRect.x, trackRect.y);
    int overhang = 4;
    int trackLeft = 0;
    int trackTop = 0;
    int trackRight = 0;
    int trackBottom = 0;

    if (slider.getOrientation() == JSlider.HORIZONTAL) {
      trackBottom = (trackRect.height - 1) - overhang;
      trackTop = trackBottom - (getTrackWidth() - 1);
      trackRight = trackRect.width - 1;
    } else {
      if (leftToRight) {
        trackLeft = (trackRect.width - overhang) - getTrackWidth();
        trackRight = (trackRect.width - overhang) - 1;
      } else {
        trackLeft = overhang;
        trackRight = overhang + getTrackWidth() - 1;
      }
      trackBottom = trackRect.height - 1;
    }

    g.setColor(AbstractLookAndFeel.getFrameColor());
    g.drawRect(trackLeft, trackTop, (trackRight - trackLeft) - 1, (trackBottom - trackTop) - 1);

    int middleOfThumb = 0;
    int fillTop = 0;
    int fillLeft = 0;
    int fillBottom = 0;
    int fillRight = 0;

    if (slider.getOrientation() == JSlider.HORIZONTAL) {
      middleOfThumb = thumbRect.x + (thumbRect.width / 2);
      middleOfThumb -= trackRect.x;
      fillTop = trackTop + 1;
      fillBottom = trackBottom - 2;

      if (!drawInverted()) {
        fillLeft = trackLeft + 1;
        fillRight = middleOfThumb;
      } else {
        fillLeft = middleOfThumb;
        fillRight = trackRight - 2;
      }
      Color colors[] = null;
      if (!JTattooUtilities.isActive(slider)) {
        colors = AbstractLookAndFeel.getTheme().getInActiveColors();
      } else {
        if (slider.isEnabled()) {
          colors = AbstractLookAndFeel.getTheme().getSliderColors();
        } else {
          colors = AbstractLookAndFeel.getTheme().getDisabledColors();
        }
      }
      JTattooUtilities.fillHorGradient(
          g, colors, fillLeft + 2, fillTop + 2, fillRight - fillLeft - 2, fillBottom - fillTop - 2);
      Color cHi = ColorHelper.darker(colors[colors.length - 1], 5);
      Color cLo = ColorHelper.darker(colors[colors.length - 1], 10);
      JTattooUtilities.draw3DBorder(
          g,
          cHi,
          cLo,
          fillLeft + 1,
          fillTop + 1,
          fillRight - fillLeft - 1,
          fillBottom - fillTop - 1);
    } else {
      middleOfThumb = thumbRect.y + (thumbRect.height / 2);
      middleOfThumb -= trackRect.y;
      fillLeft = trackLeft + 1;
      fillRight = trackRight - 2;

      if (!drawInverted()) {
        fillTop = middleOfThumb;
        fillBottom = trackBottom - 2;
      } else {
        fillTop = trackTop + 1;
        fillBottom = middleOfThumb;
      }
      Color colors[] = null;
      if (!JTattooUtilities.isActive(slider)) {
        colors = AbstractLookAndFeel.getTheme().getInActiveColors();
      } else {
        if (slider.isEnabled()) {
          colors = AbstractLookAndFeel.getTheme().getSliderColors();
        } else {
          colors = AbstractLookAndFeel.getTheme().getDisabledColors();
        }
      }
      JTattooUtilities.fillVerGradient(
          g, colors, fillLeft + 2, fillTop + 2, fillRight - fillLeft - 2, fillBottom - fillTop - 2);
      Color cHi = ColorHelper.darker(colors[colors.length - 1], 5);
      Color cLo = ColorHelper.darker(colors[colors.length - 1], 10);
      JTattooUtilities.draw3DBorder(
          g,
          cHi,
          cLo,
          fillLeft + 1,
          fillTop + 1,
          fillRight - fillLeft - 1,
          fillBottom - fillTop - 1);
    }
    g.translate(-trackRect.x, -trackRect.y);
  }
コード例 #29
0
    public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {
      Graphics2D g2D = (Graphics2D) g;
      Composite savedComposite = g2D.getComposite();
      AlphaComposite alpha =
          AlphaComposite.getInstance(
              AlphaComposite.SRC_OVER, AbstractLookAndFeel.getTheme().getMenuAlpha());
      g2D.setComposite(alpha);
      Color logoColor = AbstractLookAndFeel.getTheme().getMenuSelectionBackgroundColor();
      Color borderColorLo = AbstractLookAndFeel.getFrameColor();
      Color borderColorHi =
          ColorHelper.brighter(AbstractLookAndFeel.getMenuSelectionBackgroundColor(), 40);
      g.setColor(logoColor);
      if (JTattooUtilities.isLeftToRight(c)) {
        int dx = getBorderInsets(c).left;
        g.fillRect(x, y, dx - 1, h - 1 - shadowSize);
        paintLogo(c, g, x, y, w, h);
        // - highlight
        g.setColor(ColorHelper.brighter(AbstractLookAndFeel.getMenuBackgroundColor(), 40));
        g.drawLine(x + dx, y + 1, x + w - shadowSize - 2, y + 1);
        g.setColor(borderColorHi);
        g.drawLine(x + 1, y, x + 1, y + h - shadowSize - 2);
        // - outer frame
        g.setColor(borderColorLo);
        if (isMenuBarPopup(c)) {
          // top
          g.drawLine(x + dx - 1, y, x + w - shadowSize - 1, y);
          // left
          g.drawLine(x, y, x, y + h - shadowSize - 1);
          // bottom
          g.drawLine(x, y + h - shadowSize - 1, x + w - shadowSize - 1, y + h - shadowSize - 1);
          // right
          g.drawLine(x + w - shadowSize - 1, y + 1, x + w - shadowSize - 1, y + h - shadowSize - 1);
        } else {
          g.drawRect(x, y, w - shadowSize - 1, h - shadowSize - 1);
        }
        // - logo separator
        g.drawLine(x + dx - 1, y + 1, x + dx - 1, y + h - shadowSize - 1);
      } else {
        int dx = getBorderInsets(c).right - shadowSize;
        g.fillRect(x + w - dx - shadowSize, y, dx - 1, h - 1 - shadowSize);
        paintLogo(c, g, x, y, w, h);
        // - highlight
        g.setColor(ColorHelper.brighter(AbstractLookAndFeel.getMenuBackgroundColor(), 40));
        g.drawLine(x + 1, y + 1, x + w - dx - shadowSize - 1, y + 1);
        g.drawLine(x + 1, y + 1, x + 1, y + h - shadowSize - 2);
        // - outer frame
        g.setColor(borderColorLo);
        if (isMenuBarPopup(c)) {
          // top
          g.drawLine(x, y, x + w - dx - shadowSize, y);
          // left
          g.drawLine(x, y, x, y + h - shadowSize - 1);
          // bottom
          g.drawLine(x, y + h - shadowSize - 1, x + w - shadowSize - 1, y + h - shadowSize - 1);
          // right
          g.drawLine(x + w - shadowSize - 1, y, x + w - shadowSize - 1, y + h - shadowSize - 1);
        } else {
          g.drawRect(x, y, w - shadowSize - 1, h - shadowSize - 1);
        }
        // - logo separator
        g.drawLine(x + w - dx - shadowSize, y + 1, x + w - dx - shadowSize, y + h - shadowSize - 1);
      }

      // paint the shadow
      g2D.setColor(AbstractLookAndFeel.getTheme().getShadowColor());
      float alphaValue = 0.4f;
      for (int i = 0; i < shadowSize; i++) {
        alpha = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alphaValue);
        g2D.setComposite(alpha);
        g.drawLine(
            x + w - shadowSize + i,
            y + shadowSize,
            x + w - shadowSize + i,
            y + h - shadowSize - 1 + i);
        g.drawLine(
            x + shadowSize, y + h - shadowSize + i, x + w - shadowSize + i, y + h - shadowSize + i);
        alphaValue -= (alphaValue / 2);
      }

      g2D.setComposite(savedComposite);
    }
コード例 #30
0
 /**
  * Gets the logo color lo.
  *
  * @return the logo color lo
  */
 public Color getLogoColorLo() {
   return ColorHelper.darker(
       AbstractLookAndFeel.getTheme().getMenuSelectionBackgroundColor(), 20);
 }