Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

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

  • 09-03-2006 03:06PM
    #1
    Registered Users, Registered Users 2 Posts: 821 ✭✭✭


    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, Registered Users 2 Posts: 21,264 ✭✭✭✭Hobbes




  • Registered Users, Registered Users 2 Posts: 821 ✭✭✭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, Registered Users 2 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, Registered Users 2 Posts: 821 ✭✭✭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