Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

setVisible(false) - how can I show it again

Posted on 2004-09-28
7
Medium Priority
?
243 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
Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

 
LVL 92

Accepted Solution

by:
objects earned 200 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

The top UI technologies you need to be aware of

An important part of the job as a front-end developer is to stay up to date and in contact with new tools, trends and workflows. That’s why you cannot miss this upcoming webinar to explore the latest trends in UI technologies!

Question has a verified solution.

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

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…
In this post we will learn different types of Android Layout and some basics of an Android App.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Suggested Courses

722 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