I am working on a 15 puzzle. I need to change the JPanel in the JFrame for a new game. The reason is that some games have 16 buttons while others have 9 or 25. Sometimes the buttons have a number, but sometimes they have pieces of a picture. I would like to set up my JPanel, then set it into the JFrame. The only way that I have been able to achieve this so far is to create a new JFrame, but that outputs a new window. Is it possible to change the JPanel in the JFrame in java?
Asked
Active
Viewed 195 times
0
-
1Google `Swing CardLayout Tutorial`. First hit. – Hovercraft Full Of Eels Feb 26 '14 at 04:32
-
1See this question: http://stackoverflow.com/questions/218155/how-do-i-change-jpanel-inside-a-jframe-on-the-fly – Vikram Singh Feb 26 '14 at 04:33
-
1Or look at my answer and code [here](http://stackoverflow.com/a/8027858/522444), or this one [here](http://stackoverflow.com/a/6893133/522444). – Hovercraft Full Of Eels Feb 26 '14 at 04:35
-
1Or [this one](http://stackoverflow.com/a/11803735/522444) is kind of colorful, and shows swapping views with either JButtons or a JComboBox. – Hovercraft Full Of Eels Feb 26 '14 at 04:42