Solved

Swing GUI with multiple windows

Posted on 2004-04-18
2
3,440 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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org (http://seleniumhq.org) Go to that link and select download selenium in the right hand columnThat will then direct you to their downlo…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

762 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now