| Author |
How Donot open JFrame More then one time? please help
|
vijay Panner
Ranch Hand
Joined: Sep 29, 2010
Posts: 30
|
|
Hi,
I am developing one Desktop Application Using Swing. In my application, I designed Menu frame, whenever i click one menu_item respective page will load, suppose again i click same menu_item then one more same frame is opened.But i need only one frame , if already exist then i will show one pop_up Dialog to display "Already opened" or to show the frame in front of all opened frame.how i solve this ?
|
 |
Maneesh Godbole
Saloon Keeper
Joined: Jul 26, 2007
Posts: 8435
|
|
Vijay,
Please UseAMeaningfulSubjectLine
You can change your subject line by clicking on the
How is the frame being opened? Some action such as button click? Or do you mean to say running the application twice opens two frames?
Please TellTheDetails
|
[Donate a pint, save a life!] [How to ask questions] [Onff-turn it on!]
|
 |
vijay Panner
Ranch Hand
Joined: Sep 29, 2010
Posts: 30
|
|
vijay Panner wrote:Hi,
I am developing one Desktop Application Using Swing. In my application, I designed Menu frame, whenever i click one menu_item respective page will load, suppose again i click same menu_item then one more same frame is opened.But i need only one frame , if already exist then i will show one pop_up Dialog to display "Already opened" or to show the frame in front of all opened frame.how i solve this ?
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
Keep a reference to the frame. Initially, if it's null, you create it and show it. Any future call it won't be null so you can just show it. Something like this:
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
 |
|
|
subject: How Donot open JFrame More then one time? please help
|
|
|