Пример #1
0
 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);
 }
Пример #2
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);
    }