Solved

Swing GUI with multiple windows

Posted on 2004-04-18
2
3,474 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
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.

705 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