Package java.awt

Examples of java.awt.Graphics2D.drawLine()


      g.setColor(getRandColor(150, 200)); // ---3
      int x = random.nextInt(width - lineWidth - 1) + 1; // 保证画在边框之内
      int y = random.nextInt(height - lineWidth - 1) + 1;
      int xl = random.nextInt(lineWidth);
      int yl = random.nextInt(lineWidth);
      g.drawLine(x, y, x + xl, y + yl);
    }

    // 取随机产生的认证码(4位数字)
    String sRand = "";
View Full Code Here


    // background of track
    g2.setColor(Color.WHITE);
    g2.fillRect(0, (int) (start * scaleFactor), effectiveWidth, getHeight());

    g2.setColor(Color.LIGHT_GRAY);
    g2.drawLine(effectiveWidth - 1, (int) (start * scaleFactor), effectiveWidth - 1, getHeight());

    drawDots(g2, start, end);
    drawGuideLines(g2);
    drawNumbers(g2, start, end);

View Full Code Here

        StrictGeomUtility.toInternalValue(Math.max(80, getHeight() - 20)), g2);

    g2.setColor(Color.LIGHT_GRAY);
    g2.fillRect(25, 25, Math.max(50, getWidth() - 50), Math.max(50, getHeight() - 50));

    g2.drawLine(20, 0, 20, getHeight());
    g2.drawLine(0, 20, getWidth(), 20);
    g2.drawLine(rightSelectorEdge, 0, rightSelectorEdge, getHeight());
    g2.drawLine(0, bottomSelectorEdge, getWidth(), bottomSelectorEdge);
    g2.dispose();
  }
View Full Code Here

    g2.setColor(Color.LIGHT_GRAY);
    g2.fillRect(25, 25, Math.max(50, getWidth() - 50), Math.max(50, getHeight() - 50));

    g2.drawLine(20, 0, 20, getHeight());
    g2.drawLine(0, 20, getWidth(), 20);
    g2.drawLine(rightSelectorEdge, 0, rightSelectorEdge, getHeight());
    g2.drawLine(0, bottomSelectorEdge, getWidth(), bottomSelectorEdge);
    g2.dispose();
  }
View Full Code Here

    g2.setColor(Color.LIGHT_GRAY);
    g2.fillRect(25, 25, Math.max(50, getWidth() - 50), Math.max(50, getHeight() - 50));

    g2.drawLine(20, 0, 20, getHeight());
    g2.drawLine(0, 20, getWidth(), 20);
    g2.drawLine(rightSelectorEdge, 0, rightSelectorEdge, getHeight());
    g2.drawLine(0, bottomSelectorEdge, getWidth(), bottomSelectorEdge);
    g2.dispose();
  }

  public void commitValues(final ElementStyleSheet styleSheet)
View Full Code Here

    g2.fillRect(25, 25, Math.max(50, getWidth() - 50), Math.max(50, getHeight() - 50));

    g2.drawLine(20, 0, 20, getHeight());
    g2.drawLine(0, 20, getWidth(), 20);
    g2.drawLine(rightSelectorEdge, 0, rightSelectorEdge, getHeight());
    g2.drawLine(0, bottomSelectorEdge, getWidth(), bottomSelectorEdge);
    g2.dispose();
  }

  public void commitValues(final ElementStyleSheet styleSheet)
  {
View Full Code Here

    if (lFont.isUnderline())
    {  // Underline.
      y += metrics.getDescent() / 8 + 1;
      //state.prepareDraw();
      g2.setStroke(new BasicStroke(metrics.getHeight() / 14));
      g2.drawLine(x, y, x + textWidth, y);
      //state.postDraw();
    }
    if (lFont.isStrikeOut())
    {  // Underline.
      //state.prepareDraw();
View Full Code Here

    if (lFont.isStrikeOut())
    {  // Underline.
      //state.prepareDraw();
      y -= metrics.getAscent() / 2.5 + 1;
      g2.setStroke(new BasicStroke(metrics.getHeight() / 14));
      g2.drawLine(x, y, x + textWidth, y);
      //state.postDraw();
    }

    state.postDrawText();
  }
View Full Code Here

    final Point p = getScaledTarget();
    final Graphics2D g = file.getGraphics2D();
    final MfDcState state = file.getCurrentState();

    state.prepareDraw();
    g.drawLine(p.x, p.y, p.x, p.y);
    state.postDraw();
  }

  /**
   * Creates a empty unintialized copy of this command implementation.
View Full Code Here

                             Math.round(numbers*Math.sin(theta)+margin*2));
            }
            for (int i=0;i < 60;i++) {
                g.setColor(getForeground());
                g.setStroke(ticks);
                g.drawLine(radius-margin*2, 0, radius-margin, 0);
                if ((i % 5) == 0) {
                    g.drawLine(radius-margin*3, 0, radius-margin, 0);
                }
                if ((i + 15) % 60 == minute) {
                    g.setStroke(minuteHand);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.