summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog30
-rw-r--r--javax/swing/JApplet.java63
-rw-r--r--javax/swing/JFrame.java4
-rw-r--r--javax/swing/JInternalFrame.java5
-rw-r--r--javax/swing/JWindow.java265
5 files changed, 144 insertions, 223 deletions
diff --git a/ChangeLog b/ChangeLog
index 664be0dcb..c9f2d7429 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,33 @@
+2004-12-21 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/JApplet.java
+ (HIDE_ON_CLOSE): Removed.
+ (EXIT_ON_CLOSE): Likewise.
+ (DISPOSE_ON_CLOSE): Likewise.
+ (DO_NOTHING_ON_CLOSE): Likewise.
+ (close_action): Likewise.
+ (getDefaultCloseOperation): Likewise.
+ (setDefaultCloseOperation): Likewise.
+ (processWindowEvent): Likewise.
+ (getPreferredSize): Simplified.
+ * javax/swing/JDialog.java
+ (setDefaultLookAndFeelDecorated): Throw exception on wrong argument
+ value.
+ * javax/swing/JFrame.java
+ (setDefaultLookAndFeelDecorated): Likewise.
+ * javax/swing/JInternalFrame.java
+ (setDefaultCloseOperation): Fixed throwing exception on wrong argument
+ value.
+ * javax/swing/JWindow.java
+ (HIDE_ON_CLOSE): Removed.
+ (EXIT_ON_CLOSE): Likewise.
+ (DISPOSE_ON_CLOSE): Likewise.
+ (DO_NOTHING_ON_CLOSE): Likewise.
+ (close_action): Likewise.
+ (processKeyEvent): Likewise.
+ (setDefaultCloseOperation): Likewise.
+ (getPreferredSize): Simplified.
+
2004-12-21 Chris Burdess <dog@gnu.org>
* configure.ac: Check for presence of crt_externs.h on Darwin.
diff --git a/javax/swing/JApplet.java b/javax/swing/JApplet.java
index 42d7426ab..f65cff88d 100644
--- a/javax/swing/JApplet.java
+++ b/javax/swing/JApplet.java
@@ -55,13 +55,6 @@ public class JApplet extends Applet
{
private static final long serialVersionUID = 7269359214497372587L;
- public static final int HIDE_ON_CLOSE = 0;
- public static final int EXIT_ON_CLOSE = 1;
- public static final int DISPOSE_ON_CLOSE = 2;
- public static final int DO_NOTHING_ON_CLOSE = 3;
-
- private int close_action = EXIT_ON_CLOSE;
-
protected JRootPane rootPane;
protected boolean rootPaneCheckingEnabled;
@@ -83,10 +76,7 @@ public class JApplet extends Applet
public Dimension getPreferredSize()
{
- Dimension d = super.getPreferredSize();
- System.out.println("JFrame.getPrefSize(): " + d + " , comp="
- + getComponentCount() + ", layout=" + getLayout());
- return d;
+ return super.getPreferredSize();
}
public void setLayout(LayoutManager manager)
@@ -155,11 +145,6 @@ public class JApplet extends Applet
return null;
}
- int getDefaultCloseOperation()
- {
- return close_action;
- }
-
public JMenuBar getJMenuBar()
{
return getRootPane().getJMenuBar();
@@ -179,56 +164,12 @@ public class JApplet extends Applet
{
super.processKeyEvent(e);
}
-
- 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())
- {
- case WindowEvent.WINDOW_CLOSING:
- {
- switch (close_action)
- {
- case EXIT_ON_CLOSE:
- {
- System.out.println("user requested exit on close");
- System.exit(1);
- break;
- }
- case DISPOSE_ON_CLOSE:
- {
- System.out.println("user requested dispose on close");
- //dispose();
- break;
- }
- case HIDE_ON_CLOSE:
- 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;
- }
- }
-
+
public void remove(Component comp)
{
getContentPane().remove(comp);
}
- void setDefaultCloseOperation(int operation)
- {
- close_action = operation;
- }
-
protected boolean isRootPaneCheckingEnabled()
{
return rootPaneCheckingEnabled;
diff --git a/javax/swing/JFrame.java b/javax/swing/JFrame.java
index aa641caa3..a32f401cc 100644
--- a/javax/swing/JFrame.java
+++ b/javax/swing/JFrame.java
@@ -189,6 +189,10 @@ public class JFrame extends Frame
public static void setDefaultLookAndFeelDecorated(boolean decorated)
{
+ if (operation != DO_NOTHING_ON_CLOSE
+ && operation != HIDE_ON_CLOSE
+ && operation != DISPOSE_ON_CLOSE),
+ throw new Error("Close operation must be one of DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE, or DISPOSE_ON_CLOSE");
defaultLookAndFeelDecorated = decorated;
}
diff --git a/javax/swing/JInternalFrame.java b/javax/swing/JInternalFrame.java
index ac47a8f95..1592c2b16 100644
--- a/javax/swing/JInternalFrame.java
+++ b/javax/swing/JInternalFrame.java
@@ -1272,8 +1272,9 @@ public class JInternalFrame extends JComponent implements Accessible,
*/
public void setDefaultCloseOperation(int operation)
{
- if (operation != DO_NOTHING_ON_CLOSE || operation != HIDE_ON_CLOSE
- || operation != DISPOSE_ON_CLOSE)
+ if (operation != DO_NOTHING_ON_CLOSE
+ && operation != HIDE_ON_CLOSE
+ && operation != DISPOSE_ON_CLOSE),
throw new Error("Close operation must be one of DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE, or DISPOSE_ON_CLOSE");
defaultCloseOperation = operation;
}
diff --git a/javax/swing/JWindow.java b/javax/swing/JWindow.java
index 3601b6941..a00a1b03e 100644
--- a/javax/swing/JWindow.java
+++ b/javax/swing/JWindow.java
@@ -62,180 +62,125 @@ public class JWindow extends Window implements Accessible, RootPaneContainer
{
private static final long serialVersionUID = 5420698392125238833L;
- public static final int HIDE_ON_CLOSE = 0;
- public static final int EXIT_ON_CLOSE = 1;
- public static final int DISPOSE_ON_CLOSE = 2;
- public static final int DO_NOTHING_ON_CLOSE = 3;
-
- protected AccessibleContext accessibleContext;
-
- private int close_action = EXIT_ON_CLOSE;
-
-
- /***************************************************
- *
- *
- * constructors
- *
- *
- *************/
-
- public JWindow()
- {
- super(SwingUtilities.getOwnerFrame());
- }
-
- // huuu ?
- public JWindow(Frame f)
- {
- super(f);
- }
-
- /***************************************************
- *
- *
- * methods, this part is shared with JDialog, JFrame
- *
- *
- *************/
+ protected AccessibleContext accessibleContext;
+
+ public JWindow()
+ {
+ super(SwingUtilities.getOwnerFrame());
+ }
+
+ public JWindow(Frame f)
+ {
+ super(f);
+ }
+
+ private boolean checking;
+ protected JRootPane rootPane;
+
+ protected void frameInit()
+ {
+ super.setLayout(new BorderLayout(1, 1));
+ getRootPane(); // will do set/create
+ }
-
- private boolean checking;
- protected JRootPane rootPane;
-
-
- protected void frameInit()
- {
- super.setLayout(new BorderLayout(1, 1));
- getRootPane(); // will do set/create
- }
-
public Dimension getPreferredSize()
{
- Dimension d = super.getPreferredSize();
- return d;
+ return super.getPreferredSize();
}
- public void setLayout(LayoutManager manager)
- { super.setLayout(manager); }
+ public void setLayout(LayoutManager manager)
+ {
+ super.setLayout(manager);
+ }
- public void setLayeredPane(JLayeredPane layeredPane)
- { getRootPane().setLayeredPane(layeredPane); }
-
- public JLayeredPane getLayeredPane()
- { return getRootPane().getLayeredPane(); }
-
- public JRootPane getRootPane()
- {
- if (rootPane == null)
- setRootPane(createRootPane());
- return rootPane;
- }
-
- public void setRootPane(JRootPane root)
- {
- if (rootPane != null)
- remove(rootPane);
-
- rootPane = root;
- add(rootPane, BorderLayout.CENTER);
- }
-
- public JRootPane createRootPane()
- { return new JRootPane(); }
-
- public Container getContentPane()
- { return getRootPane().getContentPane(); }
-
- public void setContentPane(Container contentPane)
- { getRootPane().setContentPane(contentPane); }
-
- public Component getGlassPane()
- { return getRootPane().getGlassPane(); }
-
- public void setGlassPane(Component glassPane)
- { getRootPane().setGlassPane(glassPane); }
+ public void setLayeredPane(JLayeredPane layeredPane)
+ {
+ getRootPane().setLayeredPane(layeredPane);
+ }
-
- protected void addImpl(Component comp, Object constraints, int index)
- { super.addImpl(comp, constraints, index); }
+ public JLayeredPane getLayeredPane()
+ {
+ return getRootPane().getLayeredPane();
+ }
+ public JRootPane getRootPane()
+ {
+ if (rootPane == null)
+ setRootPane(createRootPane());
+ return rootPane;
+ }
- public void remove(Component comp)
- { getContentPane().remove(comp); }
-
- protected boolean isRootPaneCheckingEnabled()
- { return checking; }
+ public void setRootPane(JRootPane root)
+ {
+ if (rootPane != null)
+ remove(rootPane);
+
+ rootPane = root;
+ add(rootPane, BorderLayout.CENTER);
+ }
+
+ public JRootPane createRootPane()
+ {
+ return new JRootPane();
+ }
+ public Container getContentPane()
+ {
+ return getRootPane().getContentPane();
+ }
- protected void setRootPaneCheckingEnabled(boolean enabled)
- { checking = enabled; }
+ public void setContentPane(Container contentPane)
+ {
+ getRootPane().setContentPane(contentPane);
+ }
+ public Component getGlassPane()
+ {
+ return getRootPane().getGlassPane();
+ }
- public void update(Graphics g)
- { paint(g); }
+ public void setGlassPane(Component glassPane)
+ {
+ getRootPane().setGlassPane(glassPane);
+ }
- protected void processKeyEvent(KeyEvent e)
- { super.processKeyEvent(e); }
+ protected void addImpl(Component comp, Object constraints, int index)
+ {
+ super.addImpl(comp, constraints, index);
+ }
- /////////////////////////////////////////////////////////////////////////////////
-
- public AccessibleContext getAccessibleContext()
- { return null; }
-
- int getDefaultCloseOperation()
- { return close_action; }
-
- protected String paramString()
- { return "JWindow"; }
-
-
- 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())
- {
- case WindowEvent.WINDOW_CLOSING:
- {
- switch(close_action)
- {
- case EXIT_ON_CLOSE:
- {
- System.out.println("user requested exit on close");
- System.exit(1);
- break;
- }
- case DISPOSE_ON_CLOSE:
- {
- System.out.println("user requested 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;
- }
- }
-
-
- void setDefaultCloseOperation(int operation)
- { close_action = operation; }
+ public void remove(Component comp)
+ {
+ getContentPane().remove(comp);
+ }
+ protected boolean isRootPaneCheckingEnabled()
+ {
+ return checking;
+ }
+
+ protected void setRootPaneCheckingEnabled(boolean enabled)
+ {
+ checking = enabled;
+ }
+
+ public void update(Graphics g)
+ {
+ paint(g);
+ }
+
+ protected void processKeyEvent(KeyEvent e)
+ {
+ super.processKeyEvent(e);
+ }
+
+ public AccessibleContext getAccessibleContext()
+ {
+ return null;
+ }
+
+ protected String paramString()
+ {
+ return "JWindow";
+ }
}