Solved

setVisible(false) - how can I show it again

Posted on 2004-09-28
7
240 Views
Last Modified: 2010-03-31
I've got a Java Application that extends Frame.

At a certain point, I want to hide it without showing it on the taskbar so I setVisble to false.  Is there a way to get it back?  If possible, I'd like to use a icon on the desktop, double click it and show the window again.
0
Comment
Question by:mcgirk
[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
7 Comments
 
LVL 4

Expert Comment

by:JK2429
ID: 12174104
Yes.  Set up a boolean value.
After minimizing, if you click on the icon, it would execute the function which will make your window appear again thus as you click on the icon, your boolean value is set to true.
0
 

Author Comment

by:mcgirk
ID: 12174148
What does the icon point to?
The only thing I can think of is to make it a batch file and run a java command?  Can you give me an example?
0
 
LVL 3

Expert Comment

by:CI-Ia0s
ID: 12174798
You could make a JAR file with a class that sets visibility to true; however, you'd need to use sockets or CORBA to accomplish this. It'd be much better if you could keep it in one program (another frame perhaps, a timer, etc.).
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
LVL 92

Accepted Solution

by:
objects earned 50 total points
ID: 12174946
you could display a dialog when the frame was hidden with a button to redisplay the frame (and hide the dialog)
0
 
LVL 3

Expert Comment

by:CI-Ia0s
ID: 12175774
If you wanted to be really utilitarian (and take up as little screen space as possible),  you could create a frame and give it a window destroyer method that sets the first frame to be visible:

In your main class:

JFrame tempFrame = new JFrame();
tempFrame.setSize(1,1);
WinListener winListener = new WinListener();
tempFrame.addWindowListener(winListener);
tempFrame.setVisible(true);

Class WinListener:

import java.awt.*;
import java.awt.event.*;

public class WinListener extends WindowAdapter{

public void windowClosing(WindowEvent evt){
MainClass.invisibleFrame.setVisible(true);
}
}

NOTES: MainClass is the name of the main class and invisibleFrame is the name of the frame to make visible. invisibleFrame has to be declared outside of a method for this to work (i.e. globally).
0
 
LVL 92

Expert Comment

by:objects
ID: 12175799
that will show the frame in the task bar.
0
 
LVL 3

Expert Comment

by:CI-Ia0s
ID: 12175833
Hrmm... good point (but would it matter in this case? Isn't it only the hidden frame that needs to stay out of the taskbar?). My problem with a dialog is that he may be trying to run some other tasks while the frame is hidden which would require him to make a new thread (which while not very hard as you've taught me, could be a bit annoying if not necessary...).
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

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…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
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…
Suggested Courses

630 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