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 |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
McKenzie
![](http://www.wizards.com/global/images/swtcg_article_27_pic3_en.gif)
|
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 ();
|
|
|
|
|
|
![](images/spacer.gif) |
|
|