This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes How Donot open JFrame More then one time? please help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How Donot open JFrame More then one time? please help" Watch "How Donot open JFrame More then one time? please help" New topic
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: 10170
    
    8

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


[How to ask questions] [Donate a pint, save a life!] [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: 19654
    
  18

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 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
Consider Paul's rocket mass heater.
 
subject: How Donot open JFrame More then one time? please help
 
Similar Threads
Strange issue in JSF pagenation
different popups for different browser session?
How Donot open JFrame More then one time? please help
manipulating frames
jpanel position