Create RoundRectangle2D with GeneralPath

can i create a RoundRectangle2D.Double with GeneralPath?GeneralPath rec = new GeneralPath();rec .moveTo(0, 100);rec .lineTo(0, 0);rec .lineTo(100, 0);rec .lineTo(100, 100); rec .lineTo(0, 0);
[273 byte] By [dr1234] at [2007-9-30 23:20:16]
# 1

You can create a general path which has an outline of a round rectangle, but it won't be an object of the class RoundRectangle.

The easiest way is

new GeneralPath(new RoundRectangle.Double(x, y, w, h, rx, ry));

Pete

pm_kirkham at 2007-7-7 13:53:09 > top of Java-index,Security,Event Handling...
# 2
Thanks, do you think i can do it like this?If yes how?GeneralPath rec = new GeneralPath();rec .moveTo(0, 100);rec .lineTo(0, 0);rec .lineTo(100, 0);rec .lineTo(100, 100); rec .lineTo(0, 0);
dr1234 at 2007-7-7 13:53:09 > top of Java-index,Security,Event Handling...
# 3
You will also need to use Arc2D and the append method for the corners, or approximate them with curves.But it's more work and produces the same result as passing in a RoundRect2D to the constructor.Pete
pm_kirkham at 2007-7-7 13:53:09 > top of Java-index,Security,Event Handling...