aboutsummaryrefslogtreecommitdiff
path: root/libjava/classpath/javax/swing/JDialog.java
diff options
context:
space:
mode:
authorTom Tromey <tromey@gcc.gnu.org>2007-01-09 19:58:05 +0000
committerTom Tromey <tromey@gcc.gnu.org>2007-01-09 19:58:05 +0000
commit97b8365cafc3a344a22d3980b8ed885f5c6d8357 (patch)
tree996a5f57d4a68c53473382e45cb22f574cb3e4db /libjava/classpath/javax/swing/JDialog.java
parentc648dedbde727ca3f883bb5fd773aa4af70d3369 (diff)
downloadgcc-97b8365cafc3a344a22d3980b8ed885f5c6d8357.zip
gcc-97b8365cafc3a344a22d3980b8ed885f5c6d8357.tar.gz
gcc-97b8365cafc3a344a22d3980b8ed885f5c6d8357.tar.bz2
Merged gcj-eclipse branch to trunk.
From-SVN: r120621
Diffstat (limited to 'libjava/classpath/javax/swing/JDialog.java')
-rw-r--r--libjava/classpath/javax/swing/JDialog.java55
1 files changed, 23 insertions, 32 deletions
diff --git a/libjava/classpath/javax/swing/JDialog.java b/libjava/classpath/javax/swing/JDialog.java
index 08dada2..495c9c7 100644
--- a/libjava/classpath/javax/swing/JDialog.java
+++ b/libjava/classpath/javax/swing/JDialog.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package javax.swing;
+import java.awt.AWTEvent;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dialog;
@@ -97,7 +98,7 @@ public class JDialog extends Dialog implements Accessible, WindowConstants,
protected boolean rootPaneCheckingEnabled = false;
/** The default action taken when closed. */
- private int close_action = HIDE_ON_CLOSE;
+ private int closeAction = HIDE_ON_CLOSE;
/** Whether JDialogs are decorated by the Look and Feel. */
private static boolean decorated;
@@ -245,6 +246,10 @@ public class JDialog extends Dialog implements Accessible, WindowConstants,
*/
protected void dialogInit()
{
+ // We need to explicitly enable events here so that our processKeyEvent()
+ // and processWindowEvent() gets called.
+ enableEvents(AWTEvent.WINDOW_EVENT_MASK);
+
// FIXME: Do a check on GraphicsEnvironment.isHeadless()
setLocale(JComponent.getDefaultLocale());
getRootPane(); // Will do set/create.
@@ -507,37 +512,23 @@ public class JDialog extends Dialog implements Accessible, WindowConstants,
*/
protected void processWindowEvent(WindowEvent e)
{
- // System.out.println("PROCESS_WIN_EV-1: " + e);
super.processWindowEvent(e);
- // System.out.println("PROCESS_WIN_EV-2: " + e);
- switch (e.getID())
+ if (e.getID() == WindowEvent.WINDOW_CLOSING)
{
- case WindowEvent.WINDOW_CLOSING:
- {
- switch (getDefaultCloseOperation())
- {
- case DISPOSE_ON_CLOSE:
- {
- dispose();
- break;
- }
- case HIDE_ON_CLOSE:
- {
- setVisible(false);
- break;
- }
- case DO_NOTHING_ON_CLOSE:
- break;
- }
- break;
- }
- case WindowEvent.WINDOW_CLOSED:
- case WindowEvent.WINDOW_OPENED:
- case WindowEvent.WINDOW_ICONIFIED:
- case WindowEvent.WINDOW_DEICONIFIED:
- case WindowEvent.WINDOW_ACTIVATED:
- case WindowEvent.WINDOW_DEACTIVATED:
- break;
+ switch (closeAction)
+ {
+ case EXIT_ON_CLOSE:
+ System.exit(0);
+ break;
+ case DISPOSE_ON_CLOSE:
+ dispose();
+ break;
+ case HIDE_ON_CLOSE:
+ setVisible(false);
+ break;
+ case DO_NOTHING_ON_CLOSE:
+ break;
+ }
}
}
@@ -554,7 +545,7 @@ public class JDialog extends Dialog implements Accessible, WindowConstants,
must return the invalid code, and the behaviour
defaults to DO_NOTHING_ON_CLOSE. processWindowEvent
above handles this */
- close_action = operation;
+ closeAction = operation;
}
/**
@@ -565,7 +556,7 @@ public class JDialog extends Dialog implements Accessible, WindowConstants,
*/
public int getDefaultCloseOperation()
{
- return close_action;
+ return closeAction;
}
/**