Solved

Swing GUI with multiple windows

Posted on 2004-04-18
2
3,464 Views
Last Modified: 2013-11-23
I'm creating a simple phonebook program and now I'm trying to create a GUI. I've looked at loads of tutorials, but I just can't seem to make any sense out of it.

I want to use a series of windows in the GUI. I havent't figured out if I should have more than one window (frame) or if should have one and change the contentPane.

At first I tried to use different frames, packing them and setting the visibility to true or false, which seemed to work great until I tried to use ActionListeners. I got an error that I couldn't work out, saying something about the class not beeing abstract...

Any help apprieciated.

0
Comment
Question by:kristofer
2 Comments
 
LVL 15

Accepted Solution

by:
Javatm earned 150 total points
ID: 10855356
> I havent't figured out if I should have more than one window (frame) or if should have one and change the contentPane.

There are 3 ways you can do that :

1.) You can use a JPanel combination using CardLayout to change panels depending on the requirement.
2.) You can also use setVisble(false); or setVisible(true); to each JPanel so that the Panel's would be interchangable.
3.) The easiest way is to use JTabbedPane which use several Tab's in a frame.

Here are the tutorials :

http://java.sun.com/docs/books/tutorial/uiswing/layout/card.html
http://java.sun.com/docs/books/tutorial/uiswing/components/tabbedpane.html

Hope that helps . . .
Javatm
0
 
LVL 1

Assisted Solution

by:developer007
developer007 earned 50 total points
ID: 10874500
Hi,

 I think for creating phone book program u may not require more panels/ frames ..

 U just need to extend the JFrame and use JPanel ..

 I hope u know eclipse-VE (Visual Editor ) U can do this application very fast using this.

 Hope this helps.


0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This video teaches viewers about errors in exception handling.

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question