Example #1
0
  private void drawDarkerSide(
      Graphics graphics, Color[] br, int top, int left, int bottom, int right) {
    graphics.setLineWidth(1);
    graphics.setAlpha(200);
    Color color;
    for (int i = 0; i < br.length; i++) {
      color = br[i];
      graphics.setForegroundColor(color);

      graphics.drawArc(
          right - i - corner.width,
          bottom - i - corner.height,
          corner.width,
          corner.height,
          270,
          90);
      Point rightButtomRight = new Point(right - i, bottom - i - corner.height / 2);
      Point rightTopRight = new Point(right - i, top + i + corner.height / 2);
      graphics.drawLine(rightButtomRight, rightTopRight);
      graphics.drawArc(right - i - corner.width, top - i, corner.width, corner.height, 0, 45);

      Point rightButtomButtom = new Point(right - i - corner.width / 2, bottom - i);
      Point leftBottomLeft = new Point(left + i + corner.width / 2, bottom - i);
      graphics.drawLine(rightButtomButtom, leftBottomLeft);
      graphics.drawArc(
          left - i, bottom - i - corner.height, corner.width, corner.height, 180 + 45, 45);
    }
  }
Example #2
0
  @Override
  protected void paint(Graphics graphics, IFigure fig, Insets insets, Color[] tl, Color[] br) {
    graphics.setLineStyle(Graphics.LINE_SOLID);
    graphics.setXORMode(false);

    Rectangle rect = getPaintRectangle(fig, insets);

    int top = rect.y;
    int left = rect.x;
    int bottom = rect.bottom() - 1;
    int right = rect.right() - 1;
    drawDarkerSide(graphics, br, top, left, bottom, right);
    drawLighterSide(graphics, tl, top, left, bottom, right);
  }
Example #3
0
  protected void paintFigure(Graphics graphics) {
    label.setBounds(
        new Rectangle(bounds.x, bounds.y + bounds.height - labelHeight, bounds.width, labelHeight));

    Rectangle rect = getBounds().getCopy();
    rect.height--;
    rect.width--;
    graphics.drawRectangle(rect);
  }
Example #4
0
  private void drawLighterSide(
      Graphics graphics, Color[] tl, int top, int left, int bottom, int right) {
    graphics.setAlpha(255);
    right--;
    bottom--;
    Color color;
    graphics.setLineWidth(1);

    for (int i = 0; i < tl.length; i++) {
      color = tl[i];
      graphics.setForegroundColor(color);

      graphics.drawArc(left - i, top - i, corner.width, corner.height, 90, 90);
      Point leftTopLeft = new Point(left - i, top - i + corner.height / 2);
      Point leftBottomLeft = new Point(left - i, bottom + i - corner.height / 2);
      graphics.drawLine(leftTopLeft, leftBottomLeft);
      graphics.drawArc(left - i, bottom - i - corner.height, corner.width, corner.height, 180, 45);

      Point rightTopTop = new Point(right - i - corner.width / 2, top - i);
      Point leftTopTop = new Point(left + i + corner.width / 2, top - i);
      graphics.drawLine(rightTopTop, leftTopTop);
      graphics.drawArc(right - i - corner.width, top - i, corner.width, corner.height, 0 + 45, 45);
    }
  }