More specifically, what’s the most elegant way to cast the Graphics object in a paint() call up to a Graphics2D object?
public void paint(Graphics g) { // How do I convert/cast/etc the g variable to a Graphics2D object? }
Or am I missing the point here? Is there a better way to handle this in general?
There is no need to be fancy about it.
You will always receive a G2D in the paint method.
I even like to call the
Graphicsparameterg2and then cast to aGraphics2Dnamedgto make using it simpler.