Quote:
|
Originally Posted by titaniumdecoy
What is the difference between Graphics and Graphics2D? They both appear to be for 2D drawing...
|
From memory, i recall one of the differences is the reuse of objects.
Graphics:
// normal draw large rectangle
g.drawRect(10,10,300,300);
g.drawString("First Rectangle",10,10);
Graphics 2D:
// define a Rectangle2D object and ask g2D to draw it
Rectangle2D r = new Rectangle2D.Float( 200.0F,30.0F,50.0F,50.0F);
g2D.draw(r);
// redefine the position of the rectangle
r.setRect(20.0F,150.0F,50.0F,50.0F);
Lisa