954,518 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

accesing Jpanel/Jframe from a class....

I have two classes in here..One extends from a Jpanel , it is where I do all the paints and staffs on my screen. The other one is just a class. But in that class I want to define a draw function..say

[ public void draw(Graphics g){
g.drawImage(image,100,100,30,30,?????);

}]
Now, I want to use this draw function to draw on my Panel.
What I want to know is, is there any built in function where I can fill in the fifth argument (which takes in the image Observer) in the draw function to access my Jpanel?
Hope you get my question..THanks LOTS!

zyaday
Junior Poster in Training
70 posts since Jun 2008
Reputation Points: 10
Solved Threads: 2
 

The Java API reference for Graphics includes
drawImage(Image img, int x, int y, int width, int height, ImageObserver observer)
did you have a look at his?

JamesCherrill
Posting Genius
Moderator
6,371 posts since Apr 2008
Reputation Points: 2,130
Solved Threads: 1,073
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You