Link to home
Start Free TrialLog in
Avatar of efreet
efreet

asked on

Loading a frame inside a panel

Hi all

I'm trying to build an application where the main buttons remain on the main frame and a new
(internal)frame shows or loads within the application when one is clicked. In this frame
there might be some input boxes where data is entered and the "next" button is clicked which
will take to another set of functions or just show a confirmation message.

I'm not sure I'm explaining this right so i'll just show a sketch.

http://www.geocities.com/e_freet/roughsketch.gif 

I'm using Netbeans IDE to build the GUI using swing.

It will have a wizard like interface. With around five or six main options and each one will take user to a wizard like interface inside the main application. I'm thinking using internal frames for each one would make the code a little bulky. Is there any way to do this without using internal frames? I mean by loading a frame from outside to a panel or something inside the main frame for each option?

Thanks in advance :)
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

You should probably use a CardLayout for a wizard:


http://java.sun.com/docs/books/tutorial/uiswing/layout/card.html
Avatar of efreet
efreet

ASKER

Yes, I'm using the card layout on each frame. But I want know if it is possible to use an outside frame with the card layout and load it in a panel or something in the main frame. Because there would be lots of frames and creating lots of internal frames may not be good, I'm thinking.

Any suggestions?

Thanks again :)
SOLUTION
Avatar of Mayank S
Mayank S
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
>> actionPreformed

actionPerformed
Avatar of efreet

ASKER

Thanks all

I got it now. I created a new panel class

public class externalPanel extends javax.swing.JPanel

with all my buttons and other GUI stuff in it and then created an instance of it in my frame class
externalPanel somepanel = new externalPanel();

and put it in another panel in the main frame class
thepanel.add(somepanel);

Thanks for the help :)