Results 1 to 4 of 4
- 01-27-2010, 11:10 AM #1
diapose the child frame if already opened or block to open a new one
how can i check whether a Jframe is opened or not
on clicking a button a new frame is pop up and some function that's ok but i clicked the same button the same frame is opened again again on clicking the same button how can i block this means if already opened
Thanks in advance
- 01-28-2010, 01:38 AM #2Senior Member
- Join Date
- Aug 2009
- Pittsburgh, PA
- Rep Power
The simplest (if not best) answer is to extend the Frame by adding a boolean variable.
Initialize it to false. When the Frame is opened, set it true.
If the variable is true, do not open the window.
Do you want instead to use a modal JDialog here instead of a JFrame? That would prevent any action from occurring on the main GUI until the dialog has been completely dealt with. Or if you must use a non-modal dialog, you could disable the button, and attach a listener to the dialog to see when it closes, and then re-enable the button.
- 01-28-2010, 06:13 AM #4
- By mravihpcl in forum New To JavaReplies: 0Last Post: 03-23-2009, 05:19 PM
- By ravian in forum Advanced JavaReplies: 6Last Post: 01-30-2008, 03:05 PM
- By Java Tip in forum Java TipReplies: 0Last Post: 01-25-2008, 07:50 PM
- By Java Tip in forum Java TipReplies: 0Last Post: 12-04-2007, 12:11 PM
- By sandeepspatil in forum Advanced JavaReplies: 1Last Post: 08-02-2007, 02:51 PM