Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Java - Multiple Windows, modal dialog causes all to be disabled??

Options
  • 09-03-2006 4:06pm
    #1
    Registered Users Posts: 841 ✭✭✭


    Hi,

    Ok, this is kinda difficult to explain! I have a program which runs and displays a simple JFrame (class mainFrame.java). When I click a button, this class instantiates another JFrame object (secondFrame.java) and displays it. 2 Buttons now appear on the task bar and I can click between the 2 Windows and work away on either at the same time. Which is fine. That's what I want!
    However, when a modal dialog appears on ONE of the windows (e.g. an error message with an 'Ok' button), BOTH windows are disabled until I click 'ok' (or close the dialog).

    Does anybody know how I can have 2 or more windows/frames which are part of the same VM but don't all freeze when a modal dialog appears on one of them?


Comments

  • Registered Users Posts: 21,264 ✭✭✭✭Hobbes




  • Registered Users Posts: 841 ✭✭✭Dr Pepper


    That's great, thanks Hobbes..

    Fairly complicated stuff (for me anyway!) although the Blocker/Test example classes at the end makes it all quite clear.
    The only drawback is.. I don't see how it can be used when displaying Print Dialogs or JOptionPane messageDialogs which are always modal and can't be changed (as far as I know). I suppose I can make a simple message dialog class of my own though and make it 'semi-modal' (as describe in above link). I can live with the print dialogs causing all related frames to 'freeze' too.


  • Registered Users Posts: 4,188 ✭✭✭pH


    Depending on what you're doing and why you could d/l an early Mustang sdk which solves this issue.


    http://java.sun.com/developer/technicalArticles/J2SE/Desktop/mustang/modality/?feed=JSC


  • Registered Users Posts: 841 ✭✭✭Dr Pepper


    Hmmm.. Looks very tempting alright. Thanks pH. Not sure if I want to change everything to a new SDK / JRE.. I'm not too well-up on such things and fear all my other programs will stop working :(

    Might give it a try anyway and see how I get on. This Mustang seems to have some nifty features and I suppose it will probably pay off in the future.


Advertisement