Jump to content

  • Log In with Google      Sign In   
  • Create Account

Open a new panel on top of another


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 Manhattanisgr8   Members   -  Reputation: 487

Like
0Likes
Like

Posted 22 July 2014 - 08:07 PM

I am currently making a text based game using swing and I am running into a problem. I currently have a JFrame and 2 different panels(much more will be added). However, I can't figure out how to switch between the two panels. The first panel has a JList for a list of characters with some buttons at the bottom. One button in particular is an Add button. When the user clicks on the button, I want the first panel not to be visible, and for the second panel to become visible. Once they click save on the second panel, I want the second panel not to be visible, and the first panel to become visible. I am using a method to pass the character information back to the first panel to add the new character to the list. Just having trouble displaying the two panels. I am trying not to make the classes static. With a bunch on other panels to add and display, I want to be able to dispose of the panels not being used to free up memory. Any advice would greatly be appreciated.


Cpl Alt, Travis A

USMC


Sponsor:

#2 Glass_Knife   Moderators   -  Reputation: 4416

Like
1Likes
Like

Posted 23 July 2014 - 07:16 AM

You want a card layout.

 

http://docs.oracle.com/javase/tutorial/uiswing/layout/card.html

 

With Java, you spend more time trying to find the thing you need when you first start.


I think, therefore I am. I think? - "George Carlin"
Indie Game Programming




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS