An SSCCE should be something you can copy and paste into (and out of) the forums. A lot of people (myself included) are accessing the site from work or school, so they might be behind a firewall that...
Type: Posts; User: KevinWorkman
An SSCCE should be something you can copy and paste into (and out of) the forums. A lot of people (myself included) are accessing the site from work or school, so they might be behind a firewall that...
If you post an SSCCE, I'll play around with it. The code you posted contains classes that I don't have, which might be irrelevant to the problem anyway.
Hmm I'm not sure without seeing the SSCCE. You could try calling requestFocusInWindow() on the JPanel in question. Does it work without the CardLayout, if you just add it to another JPanel directly?...
Ah, sorry if I didn't post it before, but it's the first result for googling "Java CardLayout": How to Use CardLayout (The Java™ Tutorials > Creating a GUI With JFC/Swing > Laying Out Components...
JPanel cards are shown by Strings. Each JPanel has to have a unique String identifier (that can be "panel1", "panel2", or "startPanel", "gamePanel", etc, whatever you want). I'm not sure what you're...
The code you have seems to add it just fine. What isn't working, exactly?
What happened when you tried both?
I don't know what your Room Objects are, so I can't really help you. But the general idea is that you'd have one main class that sets up the CardLayout, and from there you'd instantiate whatever...
That's what the OP is asking how to do. The answer is to use CardLayout.
Or you can have CardLayout do that for you.
Sounds like a job for CardLayout!