943,565 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 408
  • Java RSS
May 14th, 2009
0

accesing Jpanel/Jframe from a class....

Expand Post »
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!
Similar Threads
Reputation Points: 10
Solved Threads: 2
Junior Poster in Training
zyaday is offline Offline
70 posts
since Jun 2008
May 14th, 2009
0

Re: accesing Jpanel/Jframe from a class....

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?
Featured Poster
Reputation Points: 1907
Solved Threads: 948
Posting Expert
JamesCherrill is offline Offline
5,754 posts
since Apr 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: Static method doesn't actually return anything
Next Thread in Java Forum Timeline: Help with AverageGrade Swing Program





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC