Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // PRINTING RULER
- int x1, y1, x2, y2; int block = 40;
- Line2D line;
- // Horizontal
- x1 = y1 = 0;
- x2 = 0; y2 = 5;
- int center = 0;
- for (int i = 0; i < 40; i++)
- {
- line = new Line2D.Double(x1, y1, x2, y2);
- g2.draw(line);
- if (i < 10)
- center = x1 - 3;
- else
- center = x1 - 6;
- g2.drawString(i+"", center, 20);
- x1 += block;
- x2 += block;
- }
- // Vertical
- x1 = y1 = 0;
- x2 = 5; y2 = 0;
- for (int i = 0; i < 20; i++)
- {
- line = new Line2D.Double(x1, y1, x2, y2);
- g2.draw(line);
- g2.drawString(i+"", 8, y1 + 5);
- y1 += block;
- y2 += block;
- }
Advertisement
Add Comment
Please, Sign In to add comment