src/share/classes/java/awt/Dialog.java

Print this page




 907             if (visible) {
 908                 toFront();
 909                 retval = false;
 910             } else {
 911                 visible = retval = true;
 912 
 913                 // check if this dialog should be modal blocked BEFORE calling peer.show(),
 914                 // otherwise, a pair of FOCUS_GAINED and FOCUS_LOST may be mistakenly
 915                 // generated for the dialog
 916                 if (!isModal()) {
 917                     checkShouldBeBlocked(this);
 918                 } else {
 919                     modalDialogs.add(this);
 920                     modalShow();
 921                 }
 922 
 923                 if (toFocus != null && time != null && isFocusable() &&
 924                     isEnabled() && !isModalBlocked()) {
 925                     // keep the KeyEvents from being dispatched
 926                     // until the focus has been transfered
 927                     time.set(Toolkit.getEventQueue().getMostRecentEventTimeEx());
 928                     KeyboardFocusManager.getCurrentKeyboardFocusManager().
 929                         enqueueKeyEvents(time.get(), toFocus);
 930                 }
 931 
 932                 // This call is required as the show() method of the Dialog class
 933                 // does not invoke the super.show(). So wried... :(
 934                 mixOnShowing();
 935 
 936                 peer.setVisible(true); // now guaranteed never to block
 937                 if (isModalBlocked()) {
 938                     modalBlocker.toFront();
 939                 }
 940 
 941                 setLocationByPlatform(false);
 942                 for (int i = 0; i < ownedWindowList.size(); i++) {
 943                     Window child = ownedWindowList.elementAt(i).get();
 944                     if ((child != null) && child.showWithParent) {
 945                         child.show();
 946                         child.showWithParent = false;
 947                     }       // endif




 907             if (visible) {
 908                 toFront();
 909                 retval = false;
 910             } else {
 911                 visible = retval = true;
 912 
 913                 // check if this dialog should be modal blocked BEFORE calling peer.show(),
 914                 // otherwise, a pair of FOCUS_GAINED and FOCUS_LOST may be mistakenly
 915                 // generated for the dialog
 916                 if (!isModal()) {
 917                     checkShouldBeBlocked(this);
 918                 } else {
 919                     modalDialogs.add(this);
 920                     modalShow();
 921                 }
 922 
 923                 if (toFocus != null && time != null && isFocusable() &&
 924                     isEnabled() && !isModalBlocked()) {
 925                     // keep the KeyEvents from being dispatched
 926                     // until the focus has been transfered
 927                     time.set(Toolkit.getEventQueue().getMostRecentKeyEventTime());
 928                     KeyboardFocusManager.getCurrentKeyboardFocusManager().
 929                         enqueueKeyEvents(time.get(), toFocus);
 930                 }
 931 
 932                 // This call is required as the show() method of the Dialog class
 933                 // does not invoke the super.show(). So wried... :(
 934                 mixOnShowing();
 935 
 936                 peer.setVisible(true); // now guaranteed never to block
 937                 if (isModalBlocked()) {
 938                     modalBlocker.toFront();
 939                 }
 940 
 941                 setLocationByPlatform(false);
 942                 for (int i = 0; i < ownedWindowList.size(); i++) {
 943                     Window child = ownedWindowList.elementAt(i).get();
 944                     if ((child != null) && child.showWithParent) {
 945                         child.show();
 946                         child.showWithParent = false;
 947                     }       // endif