accesing Jpanel/Jframe from a class....

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jun 2008
Posts: 46
Reputation: zyaday is an unknown quantity at this point 
Solved Threads: 1
zyaday zyaday is offline Offline
Light Poster

accesing Jpanel/Jframe from a class....

 
0
  #1
May 14th, 2009
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!
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 972
Reputation: JamesCherrill is just really nice JamesCherrill is just really nice JamesCherrill is just really nice JamesCherrill is just really nice JamesCherrill is just really nice 
Solved Threads: 145
JamesCherrill JamesCherrill is offline Offline
Posting Shark

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

 
0
  #2
May 14th, 2009
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?
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC