Pass JOptionPane.getRootFrame() to JOptionPane.show*()
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
1 post
• Page 1 of 1
Pass JOptionPane.getRootFrame() to JOptionPane.show*()
by drdev » 08 Oct 2013, 00:55
I just committed a fix so all the JOptionPane dialogs now properly appear centered over and on top of the main Forge window (r23436). Previously, many of those dialogs would appear centered on your main monitor even if Forge was elsewhere, such as a second monitor.
To maintain this fix for future dialogs, please be sure to pass JOptionPane.getRootFrame() as the first parameter to all JOptionPane.show*() functions instead of null (in cases where a more specific parent doesn't exist).
Also be sure any custom JOptionPane instances (see CardListView and ListChooser classes) pass JOptionPane.getRootFrame() as the first parameter to optionPane.createDialog(). Previously these places were just passing optionPane.getParent(), which was always null because none had been set.
Also use the new FDialog class as the base class for any other custom dialogs not created using optionPane.createDialog() (see DeckImport class). That class will wrap the logic necessary to have the main window automatically parent it, in addition to ensuring it appears centered over it by default.
Eventually I hope to support skinning these dialogs to make them look nicer, at which point the API may change. I'll let you know if and when this occurs.
EDIT: The issue where Full Screen Forge minimizes when a JOptionPane dialog is opened has now been fixed (r23437). In the process, I've also fixed it so if you have multiple monitors with Forge open Full Screen on one, it doesn't minimize when activating an application on the other monitor.
To maintain this fix for future dialogs, please be sure to pass JOptionPane.getRootFrame() as the first parameter to all JOptionPane.show*() functions instead of null (in cases where a more specific parent doesn't exist).
Also be sure any custom JOptionPane instances (see CardListView and ListChooser classes) pass JOptionPane.getRootFrame() as the first parameter to optionPane.createDialog(). Previously these places were just passing optionPane.getParent(), which was always null because none had been set.
Also use the new FDialog class as the base class for any other custom dialogs not created using optionPane.createDialog() (see DeckImport class). That class will wrap the logic necessary to have the main window automatically parent it, in addition to ensuring it appears centered over it by default.
Eventually I hope to support skinning these dialogs to make them look nicer, at which point the API may change. I'll let you know if and when this occurs.
EDIT: The issue where Full Screen Forge minimizes when a JOptionPane dialog is opened has now been fixed (r23437). In the process, I've also fixed it so if you have multiple monitors with Forge open Full Screen on one, it doesn't minimize when activating an application on the other monitor.
- drdev
- Programmer
- Posts: 1958
- Joined: 27 Jul 2013, 02:07
- Has thanked: 189 times
- Been thanked: 565 times
1 post
• Page 1 of 1
Who is online
Users browsing this forum: Google Adsense [Bot] and 59 guests