Rakesh
Rakesh

Reputation: 15057

how to draw a slanting line in blackberry using Graphics class

I want to know,how to draw the slanting line with thickness using the graphics.Any ideas how to achieve this?

Regards

Rakesh Shankar.P

Upvotes: 1

Views: 730

Answers (2)

devconsole
devconsole

Reputation: 7915

Another possibility would be to draw a rectangle:

int[] xPts = { 20, 40, 240, 220 };
int[] yPts = { 40, 20, 220, 240 };
graphics.setColor(Color.GREEN);
graphics.drawFilledPath(xPts, yPts, null, null);

Upvotes: 1

Scott W
Scott W

Reputation: 9872

The drawLine() method will draw a straight line in any direction, including on a "slant." If you want the line to be thicker than a single pixel, then simply call drawLine() multiple times, adjusting the start and end points. So for example, to draw a horizontal line that is two pixels thick:

g.drawLine(10, 10, 110, 10);
g.drawLine(10, 11, 110, 11);

Upvotes: 2

Related Questions