1

I'm developing a game as college work, I've a fully autonomus panel that handles all process of the game, but I want to add a menu that allows to select the differents levels and difficulties, and there's the problem. I only have one frame, so I've to manage two panels in this. How can I change the panels? I've read something about CardLayout, but I don't know if it's that I need really. I'm doing tests adding and removing the panels , but It doesn't work fine. How can I do it?

Edit I think that the problem is the previous panel is not removed, so the add/remove way doesn't work.

jramirez
  • 486
  • 9
  • 24
  • *"fully autonomus panel"* What is a 'fully autonomus panel'? It sounds like this is shoving application logic into a place it is not supposed to be (and doing it sideways). – Andrew Thompson Apr 16 '13 at 14:09
  • 1
    Your question is tough to answer without some idea of the type of layout you're looking for. Take a look at this Swing tutorial page, and imagine that the JButtons are JPanels. http://docs.oracle.com/javase/tutorial/uiswing/layout/visual.html – Gilbert Le Blanc Apr 16 '13 at 14:10

1 Answers1

1

CardLayout, but I don't know if it's that I need really. ..

Yes, it is.

I'm doing tests adding and removing the panels , but It doesn't work fine.

please is there some, for why reason to simulate CardLayout

Community
  • 1
  • 1
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433