Graphics vs Graphics2D
- There are 2 main differences between drawing with the Graphics class
and the Graphics2D class:
- The Graphics2D drawing looks a bit more polished and supports more advanced
drawing (like curves and paths).
- The Graphics2D class lets you create shapes and then draw them.
- In general the method name indicates which it is - for instance
you can draw a line with drawRect() or draw2DRect().
- To draw a shape, first your instantiate it, the use either the
draw() or fill() method of the Graphics2D class.
- In Java, "draw" means to draw an outline while "fill" means to draw
it as a solid shape.
- Your book does a good job covering Graphics2D, so please read that
for more details.
- The rest of the notes are for the Graphics class; many of the concepts
translate to the Graphics2D class too.