Results 1 to 2 of 2
Thread: Help with setEnabled
- 07-08-2012, 09:45 AM #1
Member
- Join Date
- May 2012
- Posts
- 15
- Rep Power
- 0
Help with setEnabled
Hi guys!
I have this problem... I want to disable my main window when another window from another class is called.
This is the code of my main_window.java that opens the new JFrame:
And this is the code of my secondary window called second_window.java this closes the new window and tries to go back to the main:Java Code:if(e.getSource()== OpenFrame){ second_window.main(null); //it calls a new JFrame and you aren't supposed to use the main window while the new one is active. this.setEnabled(false); // this is why with this we disable the main window }
Thanks in advanceJava Code:if(e.getSource() == btnGoBack){ this.dispose(); // it closes the second window // Here is the problem------- main_window.main(null); // if I call main_window again now there are 2 of them, one enabled, one disabled, obviously I don't want that. // I need to find a way to enable from here (I guess) the main window }
-
Re: Help with setEnabled
No, no, no, don't futz with setEnabled for this. Instead use a modal JDialog as this is precisely what they were built for.
Similar Threads
-
setEnabled() makes fonts to light to read
By rellicott in forum SWT / JFaceReplies: 0Last Post: 02-13-2012, 05:21 PM -
setting JButton setEnabled() outside of main class
By danborgir in forum New To JavaReplies: 11Last Post: 05-07-2011, 04:03 PM -
JButton setEnabled
By kbro3 in forum New To JavaReplies: 5Last Post: 03-23-2011, 12:53 AM -
Problem with button.setEnabled
By Dycu in forum SWT / JFaceReplies: 0Last Post: 07-19-2010, 12:49 PM -
Question regarding JButton .setVisible() and .setEnabled()
By JFReturns in forum Java AppletsReplies: 4Last Post: 02-26-2009, 11:46 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks