Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

repaint() in static method

843806Aug 14 2007 — edited Aug 14 2007
I suppose this is a stupid question, but is there any way of using something like "repaint()" inside a static method?
I am making a little game and I have a JFrame (the main frame) that contains a JPanel for every screen (i.e. the start menu, play screen, ...). Now I want to force the main frame to repaint the JPanel that is currently loaded inside the JFrame. The problem is that the JPanel is created by the previous JPanel that was displayed, so I can't call it directly from the main frame. I thought I could make a static method in the JPanel that repaints the panel, but I don't think this is possible... Any suggestions?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 11 2007
Added on Aug 14 2007
5 comments
420 views