コード例 #1
0
ファイル: SLGView.java プロジェクト: pdewan/Shapes
  private static void paintRoundedRectangle2D(Graphics g, RemoteRectangle rectangle, boolean fill) {
    Graphics2D g2d = (Graphics2D) g;
    try {
      // Rectangle bounds = rectangle.getBounds();
      RoundRectangle2D.Double rectangle2D =
          new RoundRectangle2D.Double(
              rectangle.getX(),
              rectangle.getY(),
              rectangle.getWidth(),
              rectangle.getHeight(),
              ARC_WIDTH,
              ARC_HEIGHT);

      if (fill) {
        g2d.fill(rectangle2D);
        Color origColor = g.getColor();
        g.setColor(Color.BLACK);
        g2d.draw(rectangle2D);
        g.setColor(origColor);
        // g2d.draw(rectangle2D);
      } else g2d.draw(rectangle2D);
    } catch (Exception e) {
      e.printStackTrace();
      // System.out.println(e);
    }
  }
コード例 #2
0
ファイル: SLGView.java プロジェクト: pdewan/Shapes
  private static void paintRectangle(Graphics g, RemoteRectangle rectangle, boolean fill) {

    try {
      Rectangle bounds = rectangle.getBounds();
      if (fill) g.fillRect(bounds.x, bounds.y, bounds.width, bounds.height);
      else
        // g.drawRect(bounds.x, bounds.y, bounds.width, bounds.height);
        g.draw3DRect(bounds.x, bounds.y, bounds.width, bounds.height, false);
    } catch (Exception e) {
      e.printStackTrace();
      // System.out.println(e);
    }
  }
コード例 #3
0
ファイル: SLGView.java プロジェクト: pdewan/Shapes
  private static void paintRectangle2D(Graphics g, RemoteRectangle rectangle, boolean fill) {

    Graphics2D g2d = (Graphics2D) g;
    try {
      if (rectangle.isRounded()) {
        paintRoundedRectangle2D(g, rectangle, fill);
        return;
      }
      // Rectangle bounds = rectangle.getBounds();
      Rectangle2D.Double rectangle2D =
          new Rectangle2D.Double(
              rectangle.getX(), rectangle.getY(), rectangle.getWidth(), rectangle.getHeight());

      if (fill) {
        g2d.fill(rectangle2D);
        Color origColor = g.getColor();
        g.setColor(Color.BLACK);
        if (rectangle.is3D())
          g2d.fill3DRect(
              rectangle.getX(),
              rectangle.getY(),
              rectangle.getWidth(),
              rectangle.getHeight(),
              rectangle.isRaised());
        else g2d.draw(rectangle2D);
        g.setColor(origColor);
        // g2d.draw(rectangle2D);
      } else {
        if (rectangle.is3D())
          g2d.draw3DRect(
              rectangle.getX(),
              rectangle.getY(),
              rectangle.getWidth(),
              rectangle.getHeight(),
              rectangle.isRaised());
        else g2d.draw(rectangle2D);
      }
    } catch (Exception e) {
      e.printStackTrace();
      // System.out.println(e);
    }
  }