Solved

Swing GUI with multiple windows

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
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…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

863 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

25 Experts available now in Live!

Get 1:1 Help Now