Index: javax/swing/JApplet.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/JApplet.java,v
retrieving revision 1.8
diff -u -r1.8 JApplet.java
--- javax/swing/JApplet.java 26 Jun 2004 16:06:48 -0000 1.8
+++ javax/swing/JApplet.java 25 Sep 2004 13:25:40 -0000
@@ -1,4 +1,4 @@
-/* JApplet.java --
+/* JApplet.java --
Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,7 +35,6 @@
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
-
package javax.swing;
import java.applet.Applet;
@@ -49,167 +48,196 @@
import java.awt.event.WindowEvent;
import javax.accessibility.AccessibleContext;
-public class JApplet extends Applet implements RootPaneContainer
+
+public class JApplet extends Applet
+ implements RootPaneContainer
{
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;
+ private boolean checking;
+ protected JRootPane rootPane;
+
+ public JApplet()
+ {
+ frameInit();
+ }
- public final static int HIDE_ON_CLOSE = 0;
- public final static int EXIT_ON_CLOSE = 1;
- public final static int DISPOSE_ON_CLOSE = 2;
- public final static int DO_NOTHING_ON_CLOSE = 3;
-
- private int close_action = EXIT_ON_CLOSE;
- private boolean checking;
- protected JRootPane rootPane;
-
- public JApplet()
- {
- frameInit();
- }
-
- public JApplet(String title)
- {
- frameInit();
- }
-
- protected void frameInit()
- {
- super.setLayout(new BorderLayout(1, 1));
- getRootPane(); // will do set/create
- }
+ public JApplet(String title)
+ {
+ frameInit();
+ }
+
+ protected void frameInit()
+ {
+ super.setLayout(new BorderLayout(1, 1));
+ getRootPane(); // will do set/create
+ }
public Dimension getPreferredSize()
{
Dimension d = super.getPreferredSize();
- System.out.println("JFrame.getPrefSize(): " + d + " , comp="+ getComponentCount () + ", layout=" + getLayout());
+ System.out.println("JFrame.getPrefSize(): " + d + " , comp="
+ + getComponentCount() + ", layout=" + getLayout());
return d;
}
- 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 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); }
-
-
- /////////////////////////////////////////////////////////////////////////////////
- protected void addImpl(Component comp, Object constraints, int index)
- { super.addImpl(comp, constraints, index); }
-
- public AccessibleContext getAccessibleContext()
- { return null; }
-
- int getDefaultCloseOperation()
- { return close_action; }
-
-
- public JMenuBar getJMenuBar()
- { return getRootPane().getJMenuBar(); }
-
- public void setJMenuBar(JMenuBar menubar)
- { getRootPane().setJMenuBar(menubar); }
-
-
- protected String paramString()
- { return "JFrame"; }
-
- protected void processKeyEvent(KeyEvent e)
- { 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 checking; }
+ public void setRootPane(JRootPane root)
+ {
+ if (rootPane != null)
+ remove(rootPane);
+
+ rootPane = root;
+ add(rootPane, BorderLayout.CENTER);
+ }
+ public JRootPane createRootPane()
+ {
+ return new JRootPane();
+ }
- protected void setRootPaneCheckingEnabled(boolean enabled)
- { checking = enabled; }
+ public Container getContentPane()
+ {
+ return getRootPane().getContentPane();
+ }
- public void update(Graphics g)
- { paint(g); }
+ public void setContentPane(Container contentPane)
+ {
+ getRootPane().setContentPane(contentPane);
+ }
+
+ public Component getGlassPane()
+ {
+ return getRootPane().getGlassPane();
+ }
+
+ public void setGlassPane(Component glassPane)
+ {
+ getRootPane().setGlassPane(glassPane);
+ }
+
+ /////////////////////////////////////////////////////////////////////////////////
+ protected void addImpl(Component comp, Object constraints, int index)
+ {
+ super.addImpl(comp, constraints, index);
+ }
+
+ public AccessibleContext getAccessibleContext()
+ {
+ return null;
+ }
+
+ int getDefaultCloseOperation()
+ {
+ return close_action;
+ }
+
+ public JMenuBar getJMenuBar()
+ {
+ return getRootPane().getJMenuBar();
+ }
+
+ public void setJMenuBar(JMenuBar menubar)
+ {
+ getRootPane().setJMenuBar(menubar);
+ }
+
+ protected String paramString()
+ {
+ return "JFrame";
+ }
+
+ protected void processKeyEvent(KeyEvent e)
+ {
+ 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 checking;
+ }
+
+ protected void setRootPaneCheckingEnabled(boolean enabled)
+ {
+ checking = enabled;
+ }
+
+ public void update(Graphics g)
+ {
+ paint(g);
+ }
}
Index: javax/swing/JFrame.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/JFrame.java,v
retrieving revision 1.13
diff -u -r1.13 JFrame.java
--- javax/swing/JFrame.java 26 Jun 2004 16:06:49 -0000 1.13
+++ javax/swing/JFrame.java 25 Sep 2004 13:25:40 -0000
@@ -35,7 +35,6 @@
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
-
package javax.swing;
import java.awt.AWTEvent;
@@ -48,24 +47,22 @@
import java.awt.LayoutManager;
import java.awt.event.KeyEvent;
import java.awt.event.WindowEvent;
-
import javax.accessibility.AccessibleContext;
+
/**
* Unlike JComponent derivatives, JFrame inherits from
* java.awt.Frame. But also lets a look-and-feel component to its work.
*
* @author Ronald Veldema (address@hidden)
*/
-public class JFrame extends Frame implements WindowConstants, RootPaneContainer
+public class JFrame extends Frame
+ implements WindowConstants, RootPaneContainer
{
private static final long serialVersionUID = -3362141868504252139L;
-
- protected AccessibleContext accessibleContext;
-
- private int close_action = HIDE_ON_CLOSE;
-
- private static boolean defaultLookAndFeelDecorated = false;
+ protected AccessibleContext accessibleContext;
+ private int close_action = HIDE_ON_CLOSE;
+ private static boolean defaultLookAndFeelDecorated = false;
public static void setDefaultLookAndFeelDecorated(boolean d)
{
@@ -77,47 +74,41 @@
return defaultLookAndFeelDecorated;
}
- /***************************************************
- *
- * initia
- *
- *
- *************/
-
-
- public JFrame()
- {
- super("JFrame");
- frameInit();
- }
-
- public JFrame(String title)
- {
- super(title);
- frameInit();
- }
-
-
- /***************************************************
- *
- *
- * methods, this part is shared with JDialog, JFrame
- *
- *
- *************/
-
-
- private boolean checking;
- protected JRootPane rootPane;
-
-
- protected void frameInit()
- {
- super.setLayout(new BorderLayout(1, 1));
- enableEvents(AWTEvent.WINDOW_EVENT_MASK);
- getRootPane(); // will do set/create
- }
-
+ /***************************************************
+ *
+ * initia
+ *
+ *
+ *************/
+ public JFrame()
+ {
+ super("JFrame");
+ frameInit();
+ }
+
+ public JFrame(String title)
+ {
+ super(title);
+ frameInit();
+ }
+
+ /***************************************************
+ *
+ *
+ * methods, this part is shared with JDialog, JFrame
+ *
+ *
+ *************/
+ private boolean checking;
+ protected JRootPane rootPane;
+
+ protected void frameInit()
+ {
+ super.setLayout(new BorderLayout(1, 1));
+ enableEvents(AWTEvent.WINDOW_EVENT_MASK);
+ getRootPane(); // will do set/create
+ }
+
public Dimension getPreferredSize()
{
Dimension d = super.getPreferredSize();
@@ -125,154 +116,179 @@
}
public JMenuBar getJMenuBar()
- { return getRootPane().getJMenuBar(); }
-
+ {
+ return getRootPane().getJMenuBar();
+ }
+
public void setJMenuBar(JMenuBar menubar)
- { getRootPane().setJMenuBar(menubar); }
-
+ {
+ getRootPane().setJMenuBar(menubar);
+ }
- 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 void setLayeredPane(JLayeredPane layeredPane)
- { getRootPane().setLayeredPane(layeredPane); }
-
public JLayeredPane getLayeredPane()
- { return getRootPane().getLayeredPane(); }
-
+ {
+ return getRootPane().getLayeredPane();
+ }
+
public JRootPane getRootPane()
- {
- if (rootPane == null)
- setRootPane(createRootPane());
- return rootPane;
- }
+ {
+ if (rootPane == null)
+ setRootPane(createRootPane());
+ return rootPane;
+ }
public void setRootPane(JRootPane root)
- {
- if (rootPane != null)
- remove(rootPane);
-
- rootPane = root;
- add(rootPane, BorderLayout.CENTER);
- }
+ {
+ if (rootPane != null)
+ remove(rootPane);
+
+ rootPane = root;
+ add(rootPane, BorderLayout.CENTER);
+ }
public JRootPane createRootPane()
- { return new JRootPane(); }
+ {
+ return new JRootPane();
+ }
public Container getContentPane()
- { return getRootPane().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); }
+ {
+ getRootPane().setContentPane(contentPane);
+ }
-
- protected void addImpl(Component comp, Object constraints, int index)
- { super.addImpl(comp, constraints, index); }
+ public Component getGlassPane()
+ {
+ return getRootPane().getGlassPane();
+ }
+ public void setGlassPane(Component glassPane)
+ {
+ getRootPane().setGlassPane(glassPane);
+ }
- public void remove(Component comp)
- { getContentPane().remove(comp); }
-
- protected boolean isRootPaneCheckingEnabled()
- { return checking; }
+ protected void addImpl(Component comp, Object constraints, int index)
+ {
+ super.addImpl(comp, constraints, index);
+ }
+ public void remove(Component comp)
+ {
+ getContentPane().remove(comp);
+ }
- protected void setRootPaneCheckingEnabled(boolean enabled)
- { checking = enabled; }
+ protected boolean isRootPaneCheckingEnabled()
+ {
+ return checking;
+ }
+ protected void setRootPaneCheckingEnabled(boolean enabled)
+ {
+ checking = enabled;
+ }
- public void update(Graphics g)
- { paint(g); }
+ public void update(Graphics g)
+ {
+ paint(g);
+ }
- protected void processKeyEvent(KeyEvent e)
- { super.processKeyEvent(e); }
+ protected void processKeyEvent(KeyEvent e)
+ {
+ super.processKeyEvent(e);
+ }
- /////////////////////////////////////////////////////////////////////////////////
-
+ /////////////////////////////////////////////////////////////////////////////////
public AccessibleContext getAccessibleContext()
{
return accessibleContext;
}
-
- public int getDefaultCloseOperation()
- { return close_action; }
-
-
-
- protected String paramString()
- { return "JFrame"; }
+ public int getDefaultCloseOperation()
+ {
+ return close_action;
+ }
+
+ protected String paramString()
+ {
+ return "JFrame";
+ }
- protected void processWindowEvent(WindowEvent e)
- {
- super.processWindowEvent(e);
- switch (e.getID())
+ protected void processWindowEvent(WindowEvent e)
+ {
+ super.processWindowEvent(e);
+ switch (e.getID())
+ {
+ case WindowEvent.WINDOW_CLOSING:
+ {
+ switch (close_action)
{
- case WindowEvent.WINDOW_CLOSING:
- {
- switch(close_action)
- {
- 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;
- }
- 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:
+ 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;
}
- }
-
- /**
- * Defines what happens when this frame is closed. Can be one off
- * EXIT_ON_CLOSE
,
- * DISPOSE_ON_CLOSE
,
- * HIDE_ON_CLOSE
or
- * DO_NOTHING_ON_CLOSE
.
- * The default is HIDE_ON_CLOSE
.
- * When EXIT_ON_CLOSE
is specified this method calls
- * SecurityManager.checkExit(0)
which might throw a
- * SecurityException
. When the specified operation is
- * not one of the above a IllegalArgumentException
is
- * thrown.
- */
- public void setDefaultCloseOperation(int operation)
- {
- SecurityManager sm = System.getSecurityManager();
- if (sm != null && operation == EXIT_ON_CLOSE)
- sm.checkExit(0);
-
- if (operation != EXIT_ON_CLOSE && operation != DISPOSE_ON_CLOSE
- && operation != HIDE_ON_CLOSE && operation != DO_NOTHING_ON_CLOSE)
- throw new IllegalArgumentException("operation = " + operation);
-
- close_action = operation;
- }
+ 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;
+ }
+ }
+
+ /**
+ * Defines what happens when this frame is closed. Can be one off
+ * EXIT_ON_CLOSE
,
+ * DISPOSE_ON_CLOSE
,
+ * HIDE_ON_CLOSE
or
+ * DO_NOTHING_ON_CLOSE
.
+ * The default is HIDE_ON_CLOSE
.
+ * When EXIT_ON_CLOSE
is specified this method calls
+ * SecurityManager.checkExit(0)
which might throw a
+ * SecurityException
. When the specified operation is
+ * not one of the above a IllegalArgumentException
is
+ * thrown.
+ */
+ public void setDefaultCloseOperation(int operation)
+ {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null && operation == EXIT_ON_CLOSE)
+ sm.checkExit(0);
+
+ if (operation != EXIT_ON_CLOSE && operation != DISPOSE_ON_CLOSE
+ && operation != HIDE_ON_CLOSE && operation != DO_NOTHING_ON_CLOSE)
+ throw new IllegalArgumentException("operation = " + operation);
+ close_action = operation;
+ }
}