[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Swing GUI with multiple windows

Posted on 2004-04-18
2
Medium Priority
?
3,494 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 600 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 200 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
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 …
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses

656 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