Quick question on Graphics
Author |
Message |
xHoly-Divinity
|
Posted: Sat Apr 01, 2006 3:39 pm Post subject: Quick question on Graphics |
|
|
code: |
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
code: |
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 |
|
|
|
|
|
Sponsor Sponsor
|
|
|
McKenzie
|
Posted: Sat Apr 01, 2006 4:49 pm Post subject: (No subject) |
|
|
Assuming it has a legitimate Graphics context (Applet, Frame ...) try
code: | Graphics g = this.getGraphics ();
|
|
|
|
|
|
|
|
|