
-----------------------------------
xHoly-Divinity
Sat Apr 01, 2006 3:39 pm

Quick question on Graphics
-----------------------------------

public void draw (int x, int y, Graphics g)
    {
    }


Suppose I did not want to include the Graphics as part of the call method, how would i incorporate it in the body of the method so that I could still draw things using the graphics.

So lets say


public void draw (int x, int y)
    {
    g.fillOval (4, 4, 4, 4);
    }


How would I go about achieving that? I would have to call graphics somewhere within the method, just not 100% sure of the syntax and it is driving me crazy!! :S. Thanks

-----------------------------------
McKenzie
Sat Apr 01, 2006 4:49 pm


-----------------------------------
Assuming it has a legitimate Graphics context (Applet, Frame ...) try
Graphics g = this.getGraphics ();

