예제 #1
0
 protected void paintIcon(Component c, Graphics g, int x1, int y1, int x2, int y2) {
   GraphicsUtil.drawOptimizedLine(g, x1, y1, x2, y1);
   GraphicsUtil.drawOptimizedLine(g, x1, y1 + 1, x2, y1 + 1);
   GraphicsUtil.drawOptimizedLine(g, x1, y1 + 2, x1, y2);
   GraphicsUtil.drawOptimizedLine(g, x2, y1 + 2, x2, y2);
   GraphicsUtil.drawOptimizedLine(g, x1 + 1, y2, x2 - 1, y2);
 }
  protected void paintPolygon(Component c, Graphics2D g, Polygon polygon, int width, int height) {
    TabbedPanel tp = TabbedUtils.getParentTabbedPanel(c);
    if (tp != null) {
      Direction d = tp.getProperties().getTabAreaOrientation();

      int i = 0;

      Color c1 = topLeftColor.getColor();
      Color c2 = bottomRightColor.getColor();

      if (d == Direction.UP) {
        g.setColor(c1);
        while (i < (roundCorners ? 3 : 1)) {
          GraphicsUtil.drawOptimizedLine(
              g,
              polygon.xpoints[i],
              polygon.ypoints[i],
              polygon.xpoints[i + 1],
              polygon.ypoints[i + 1]);
          i++;
        }

        g.setColor(c2);
        while (i < polygon.npoints - 1) {
          GraphicsUtil.drawOptimizedLine(
              g,
              polygon.xpoints[i],
              polygon.ypoints[i],
              polygon.xpoints[i + 1],
              polygon.ypoints[i + 1]);
          i++;
        }

        g.setColor(c1);
        GraphicsUtil.drawOptimizedLine(
            g, polygon.xpoints[i], polygon.ypoints[i], polygon.xpoints[0], polygon.ypoints[0]);

      } else if (d == Direction.RIGHT) {
        g.setColor(c2);
        while (i < polygon.npoints - (open ? 2 : roundCorners ? 3 : 2)) {
          GraphicsUtil.drawOptimizedLine(
              g,
              polygon.xpoints[i],
              polygon.ypoints[i],
              polygon.xpoints[i + 1],
              polygon.ypoints[i + 1]);
          i++;
        }

        g.setColor(c1);
        for (int k = i - 1; k < polygon.npoints - 2; k++) {
          GraphicsUtil.drawOptimizedLine(
              g,
              polygon.xpoints[i],
              polygon.ypoints[i],
              polygon.xpoints[i + 1],
              polygon.ypoints[i + 1]);
          i++;
        }
        GraphicsUtil.drawOptimizedLine(
            g, polygon.xpoints[i], polygon.ypoints[i], polygon.xpoints[0], polygon.ypoints[0]);

      } else if (d == Direction.DOWN) {
        g.setColor(c2);
        while (i < (roundCorners ? 5 : 2)) {
          GraphicsUtil.drawOptimizedLine(
              g,
              polygon.xpoints[i],
              polygon.ypoints[i],
              polygon.xpoints[i + 1],
              polygon.ypoints[i + 1]);
          i++;
        }

        g.setColor(c1);
        while (i < polygon.npoints - 1) {
          GraphicsUtil.drawOptimizedLine(
              g,
              polygon.xpoints[i],
              polygon.ypoints[i],
              polygon.xpoints[i + 1],
              polygon.ypoints[i + 1]);
          i++;
        }

        GraphicsUtil.drawOptimizedLine(
            g, polygon.xpoints[i], polygon.ypoints[i], polygon.xpoints[0], polygon.ypoints[0]);
      } else {
        g.setColor(c1);
        while (i < (roundCorners ? 3 : 1)) {
          GraphicsUtil.drawOptimizedLine(
              g,
              polygon.xpoints[i],
              polygon.ypoints[i],
              polygon.xpoints[i + 1],
              polygon.ypoints[i + 1]);
          i++;
        }

        g.setColor(c2);
        while (i < polygon.npoints - 1) {
          GraphicsUtil.drawOptimizedLine(
              g,
              polygon.xpoints[i],
              polygon.ypoints[i],
              polygon.xpoints[i + 1],
              polygon.ypoints[i + 1]);
          i++;
        }

        g.setColor(c1);

        GraphicsUtil.drawOptimizedLine(
            g, polygon.xpoints[i], polygon.ypoints[i], polygon.xpoints[0], polygon.ypoints[0]);
      }
    }
  }