[hotjoe.com] HotJoe Java Help Forums
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Visit java.com
Please send email if you are having login problems - see the posts below for more info.
Hotmail and Yahoo! users - please see the Hotmail post or the Yahoo! post for information on lost emails.
Switching JPanels Help  XML
Forum Index » New to Java
Author Message
kashimoto503

Newbie

Joined: 07/13/2010 19:41:10
Messages: 1
Location: Tennessee
Offline

I am trying to write a game and have multiple states. The JFrame is in the overall state controller and all the panels that should appear exist in classes that will be called depending on the current state. I am wondering if it is possible to pass the class that contains the JFrame into the constructor of other classes so the other classes can place the correct panel.

My GSC is the class that starts the JFrame. I have a LSC that is a State Controller class (it calls the correct method depending on which state it is in) and this class calls one of three classes to get the panel that needs to be displayed. I have the GSC passed to the LSC and stored there. Is it correct to call GSC.add(<panel>, <placement> inside the LSC to place the panel on the JFrame? If I need to post some code I can. Please let me know any information you may have.
[Yahoo!]
 
Forum Index » New to Java
Go to:   
Powered by JForum 2.1.9 © JForum Team
This site run by Scott Dunbar of Xigole Systems. © 2005-2011 - Scott Dunbar
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners
hotjoe.com, xigole.com, and Scott Dunbar have no affiliation with Oracle