Reputation: 1193
I am trying to draw a line two pixels wide. How can I do this?
Upvotes: 1
Views: 557
Reputation: 41
There is no methods to set the width for a line. But if you want you can draw like below code. I don't think this is correct way. But it will help you.
Graphics c = new Graphics();
c.drawLine(5, 20, width-10, 20);
c.drawLine(5, 21, width-10, 20);
Upvotes: 2
Reputation: 11796
There is no method to set the width of your line. You do have two options though:
1) If your line is horizontal/vertical, then you can use fillRect to draw your lines.
2) You can draw multiple lines offset by a pixel in the x or y direction to make the appearance of a thicker line.
They may not be ideal, but they get the job done.
Upvotes: 4