java - Using a single JFrame across multiple classes -



java - Using a single JFrame across multiple classes -

i working on video game in java far has main menu class , class game. have set right now, each class uses own jframe, means when user clicks "start game", main menu jframe closes , games jframe opens. not ideal , have both classes utilize same jframe, don't know how go , net searches have not been helpful.

the class main menu is:

public class frame extends javax.swing.jframe { ... }

i have set right game class imports frame class, when seek create jframe display elements game nil comes up. question is:

how utilize 1 single jframe across multiple classes?

any help much appreciated!

rather needing pass reference of main frame each of kid panels, might expose parts of programme don't want them have access (as example), should utilize cardlayout , utilize main frame main display hub, switching out panels need to

check out how utilize cardlayout more examples

java swing user-interface jframe

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -