I would like to ask whether it is possible to draw a line using double variables instead of integers. If yes how?
Asked
Active
Viewed 3,134 times
2 Answers
2
You can use Line2D.Double. Use Graphics2D.draw() to draw it.
See Drawing Geometric Primitives for more details and examples.

tenorsax
- 21,123
- 9
- 60
- 107
1
Like this ?
Line2D line = new Line2D.Double();
Graphics2D g2 = aPaintContext.getGraphics();
for (double x = bx; x < rightBorder; x += 5) {
line.setLine(x, by, x, bottomBorder);
g2.draw(line);

Sergii Zagriichuk
- 5,389
- 5
- 28
- 45