Jan
31
|
You cannot have a modal JFrame. Use a JDialog if you need a modal window.
Array ( ) One Response to “How to create modal JFrame?”
Leave a Reply
You must be logged in to post a comment.
CategoriesArchives
|
You cannot have a modal JFrame. Use a JDialog if you need a modal window. Array ( ) One Response to “How to create modal JFrame?”Leave a ReplyYou must be logged in to post a comment. |
|
March 8th, 2011 at 4:52 am
We can have modal Internal Frame !
Worked example:
private synchronized void startModal() {
try {
Object obj = AccessController.doPrivileged(new ModalPrivilegedAction(Container.class, “startLWModal”));
if (obj != null) {
((Method) obj).invoke(this, (Object[]) null);
}
if (innerDialog || optionPainOpened) {
// Blocking the thread in case of nested dialogs
if (SwingUtilities.isEventDispatchThread()) {
EventQueue theQueue = getToolkit().getSystemEventQueue();
while (isVisible()) {
AWTEvent event = theQueue.getNextEvent();
Object source = event.getSource();
if (event instanceof ActiveEvent) {
((ActiveEvent) event).dispatch();
}
else if (source instanceof Component) {
((Component) source).dispatchEvent(event);
}
else if (source instanceof MenuComponent) {
((MenuComponent) source).dispatchEvent(event);
}
else {
System.err.println(“Unable to dispatch: ” + event);
}
}
}
}
}
catch (Exception ex) {
ex.printStackTrace();
}
}