Solved

How do I clear my entire application view area

Posted on 2015-02-13
6
103 Views
Last Modified: 2015-02-18
Hi,

I have an application I have created where I wish to create a "restart" process and simply clear out all the visible screen area and start completely over from scratch.

Is there a simple command that will accomplish this or do I need to clear all the objects individually?

Would deleting all the layouts and panels accomplish this?

Thanks,

Chris
0
Comment
Question by:Christopher Schene
[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
  • 3
  • 2
6 Comments
 
LVL 36

Expert Comment

by:mccarl
ID: 40609279
What sort of application are we talking about here? My guess is Swing but let me know if that assumption is incorrect. If you could provide some code it would help.

Do you mean that you want to be able to clear out all user input from fields, etc or do you want to totally remove all fields controls from the window?
0
 

Author Comment

by:Christopher Schene
ID: 40610134
The code is on my work PC. I'll grab a snippet and post it.
0
 

Author Comment

by:Christopher Schene
ID: 40610500
Of course since it is company software, I need obfuscate somethings.
0
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 
LVL 37

Accepted Solution

by:
zzynx earned 500 total points
ID: 40614386
>> Is there a simple command that will accomplish this?
If you're talking about a JInternalFrame, try calling:
yourInternalFrame.getContentPane().removeAll();

Open in new window


>> Would deleting all the layouts and panels accomplish this?
You just have to remove the child items from your highest level panel by calling removeAll();

Eg. If you have built up your panel like this:

JPanel innerPnl1 = new JPanel();
// Here you're adding several panels or other controls to innerPnl1
JPanel innerPnl2 = new JPanel();
// Here you're adding several panels or other controls to innerPnl2

JPanel yourHighestLevelPanel = new JPanel(new BorderLayout());
yourHighestLevelPanel.add(innerPnl1, BorderLayout.NORTH);
yourHighestLevelPanel.add(innerPnl2, BorderLayout.CENTER);

Open in new window

All you have to do is:
yourHighestLevelPanel.removeAll();

Open in new window

0
 

Author Closing Comment

by:Christopher Schene
ID: 40615814
Thanks
0
 
LVL 37

Expert Comment

by:zzynx
ID: 40616015
You're welcome.
Thanx 4 axxepting.
0

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
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.

635 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