jQuery in Action, 3rd edition
The moose likes Swing / AWT / SWT and the fly likes Card layout... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Card layout..." Watch "Card layout..." New topic

Card layout...

Andy Powell

Joined: Apr 18, 2010
Posts: 20
Hi everyone,
I'm having problems using cardlayout, I am trying to make a GUI for a pretend bike shop where you can build your own bikes.
I thought it would be a good idea to have separate panels so that once one step has been done, it moves to the next panel.

I haven't added all my components onto each panel yet but as a test I just wanted to see if I could get it to swap to the next one.

I am starting it with this...

The Problem that I'm having is that well, basically it doesn't do anything.
Both classes compile fine but when I come to run it, it executes, nothing happens and then it finishes.
I just don't get anything.

Can anyone tell me where I'm going wrong, its probably really simple.

Thanks in advance
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42958
A JPanel is not something that can be displayed directly - only dialogs or frames can. Have the GUIness class extend JFrame instead of JPanel.
Andy Powell

Joined: Apr 18, 2010
Posts: 20
aaah, thank you very much. I knew that as well! My stupidity coming out in full force today.

Thanks again
I agree. Here's the link: http://aspose.com/file-tools
subject: Card layout...
jQuery in Action, 3rd edition