aboutsummaryrefslogtreecommitdiff
path: root/libjava/javax/swing/JWindow.java
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/javax/swing/JWindow.java')
-rw-r--r--libjava/javax/swing/JWindow.java286
1 files changed, 125 insertions, 161 deletions
diff --git a/libjava/javax/swing/JWindow.java b/libjava/javax/swing/JWindow.java
index 3601b694105..94efa3aa795 100644
--- a/libjava/javax/swing/JWindow.java
+++ b/libjava/javax/swing/JWindow.java
@@ -1,5 +1,5 @@
/* JWindow.java --
- Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,10 +44,10 @@ import java.awt.Container;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.Graphics;
+import java.awt.GraphicsConfiguration;
import java.awt.LayoutManager;
import java.awt.Window;
import java.awt.event.KeyEvent;
-import java.awt.event.WindowEvent;
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
@@ -62,180 +62,144 @@ 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 JRootPane rootPane;
+ protected boolean rootPaneCheckingEnabled;
+ protected AccessibleContext accessibleContext;
+ public JWindow()
+ {
+ super(SwingUtilities.getOwnerFrame());
+ windowInit();
+ }
+
+ public JWindow(GraphicsConfiguration gc)
+ {
+ super(SwingUtilities.getOwnerFrame(), gc);
+ windowInit();
+ }
- private boolean checking;
- protected JRootPane rootPane;
-
-
- protected void frameInit()
- {
- super.setLayout(new BorderLayout(1, 1));
- getRootPane(); // will do set/create
- }
-
+ public JWindow(Frame owner)
+ {
+ super(owner);
+ windowInit();
+ }
+
+ public JWindow(Window owner)
+ {
+ super(owner);
+ windowInit();
+ }
+
+ public JWindow(Window owner, GraphicsConfiguration gc)
+ {
+ super(owner, gc);
+ windowInit();
+ }
+
+ protected void windowInit()
+ {
+ 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;
+ }
+ protected void setRootPane(JRootPane root)
+ {
+ if (rootPane != null)
+ remove(rootPane);
- public void remove(Component comp)
- { getContentPane().remove(comp); }
-
- protected boolean isRootPaneCheckingEnabled()
- { return checking; }
+ rootPane = root;
+ add(rootPane, BorderLayout.CENTER);
+ }
+ protected JRootPane createRootPane()
+ {
+ return new JRootPane();
+ }
- protected void setRootPaneCheckingEnabled(boolean enabled)
- { checking = enabled; }
+ public Container getContentPane()
+ {
+ return getRootPane().getContentPane();
+ }
+ public void setContentPane(Container contentPane)
+ {
+ getRootPane().setContentPane(contentPane);
+ }
- public void update(Graphics g)
- { paint(g); }
+ public Component getGlassPane()
+ {
+ return getRootPane().getGlassPane();
+ }
- protected void processKeyEvent(KeyEvent e)
- { super.processKeyEvent(e); }
+ public void setGlassPane(Component glassPane)
+ {
+ getRootPane().setGlassPane(glassPane);
+ }
- /////////////////////////////////////////////////////////////////////////////////
-
- 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; }
+ protected void addImpl(Component comp, Object constraints, int index)
+ {
+ super.addImpl(comp, constraints, index);
+ }
+
+ public void remove(Component comp)
+ {
+ getContentPane().remove(comp);
+ }
+ protected boolean isRootPaneCheckingEnabled()
+ {
+ return rootPaneCheckingEnabled;
+ }
+
+ protected void setRootPaneCheckingEnabled(boolean enabled)
+ {
+ rootPaneCheckingEnabled = 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";
+ }
}