A application that exist with or without JFrames
Hey,
I'm doing some little piece of software.
Thought, i want to do something i very appreciate in few application.
"The application does not close when his principale Frame is closed"
and
"If the application is focused again, show the principal Frame"
I first tryed to make it happens by using first "setVisible(false);" when i push on "close the window", and then with a "FocusListener" say "if focused, then, setVisible(true)".
My issue is that i can't focus something inivisible, it seems.
I don't know if it's understandable or not, ask for any other formulation, i'm up to it :o
Re: A application that exist with or without JFrames
Example of application doing that : MSN, Pidgin... (and maybe Skype, thought)
Re: A application that exist with or without JFrames
Moved from New to Java
db
Re: A application that exist with or without JFrames
Quote:
Originally Posted by
Otyugh
My issue is that i can't focus something inivisible, it seems.
I don't see how you could even think this could be possible. Where would you possibly click the mouse or tab to in order to transfer the focus to a UI element that's not displayed?
You might want to take a look at the java.awt.TrayIcon API.
db
Re: A application that exist with or without JFrames
Let my show you a situation.
Class App(){
public static void main(String[] args) {
JFrame jf = new JFrame();
jf.setVisible(false);
}
Now, i have a "App" launched (without any windows) and the user can see AND select it.
When the user "select the application" I want it to set jf.setVisible(true);.
I don't know how to do that ! I mean, when you select the "application" a focus go to one of the "Windows of the application". This MUST be a listener somewhere. I don't know which.
Re: A application that exist with or without JFrames
Quote:
Originally Posted by
Otyugh
Let my show you a situation.
Class App(){
public static void main(String[] args) {
JFrame jf = new JFrame();
jf.setVisible(false);
}
Now, i have a "App" launched (without any windows) and the user can see AND select it.
How can the user see or select anything if there is no visible window? I do not understand what you are trying to do.
Re: A application that exist with or without JFrames
You know theses "icones" that appear in the bottom of your "main os interface" ?
A very usual example would be theses calendars that you "display" only time to time, but which are always "launched but without window" in fact.
Re: A application that exist with or without JFrames
So you want to launch the GUI, *not* make it invisible but rather you wish to iconify it. That's a big difference. You will want to call the JFrame's setState(...) method and pass in the constant JFrame.ICONIFIED.
Re: A application that exist with or without JFrames
Quote:
Originally Posted by
Otyugh
Let my show you a situation.
Class App(){
public static void main(String[] args) {
JFrame jf = new JFrame();
jf.setVisible(false);
}
Now, i have a "App" launched (without any windows) and the user can see AND select it.
...
How will the user be able to select the frame when the frame is not yet displayable? [jf.setVisible(false);] Where will the user "select" the App? I guess maybe you are trying to create an App with "undecorated frame" :(happy):