This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch: javax.swing - JApplet and JFrame


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi list,


I just commited the attached patch to make it easier to review 
upcoming patches to these two classes.


Michael


2004-09-12  Michael Koch  <konqueror@gmx.de>

	* javax/swing/JApplet.java, javax/swing/JFrame.java:
	Re-indented.
- -- 
Homepage: http://www.worldforge.org/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFBRJyKWSOgCCdjSDsRAg+LAJsEWGAO1kRYuBeXDzqPHpReKxSQfACff75h
Tb7G6/W+IAz1TucLFESQzdc=
=b1yQ
-----END PGP SIGNATURE-----
Index: javax/swing/JApplet.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/JApplet.java,v
retrieving revision 1.3.2.3
diff -u -r1.3.2.3 JApplet.java
--- javax/swing/JApplet.java	10 Jun 2004 14:59:46 -0000	1.3.2.3
+++ javax/swing/JApplet.java	12 Sep 2004 18:51:41 -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: /cvs/gcc/gcc/libjava/javax/swing/JFrame.java,v
retrieving revision 1.4.2.6
diff -u -r1.4.2.6 JFrame.java
--- javax/swing/JFrame.java	15 Jun 2004 22:28:05 -0000	1.4.2.6
+++ javax/swing/JFrame.java	12 Sep 2004 18:51:41 -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 (rveldema@cs.vu.nl)
  */
-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  void processWindowEvent(WindowEvent e)
-    {
-	super.processWindowEvent(e); 
-	switch (e.getID())
+  protected String paramString()
+  {
+    return "JFrame";
+  }
+
+  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
-     * <code>EXIT_ON_CLOSE</code>,
-     * <code>DISPOSE_ON_CLOSE</code>,
-     * <code>HIDE_ON_CLOSE</code> or
-     * <code>DO_NOTHING_ON_CLOSE</code>.
-     * The default is <code>HIDE_ON_CLOSE</code>.
-     * When <code>EXIT_ON_CLOSE</code> is specified this method calls
-     * <code>SecurityManager.checkExit(0)</code> which might throw a
-     * <code>SecurityException</code>. When the specified operation is
-     * not one of the above a <code>IllegalArgumentException</code> 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
+   * <code>EXIT_ON_CLOSE</code>,
+   * <code>DISPOSE_ON_CLOSE</code>,
+   * <code>HIDE_ON_CLOSE</code> or
+   * <code>DO_NOTHING_ON_CLOSE</code>.
+   * The default is <code>HIDE_ON_CLOSE</code>.
+   * When <code>EXIT_ON_CLOSE</code> is specified this method calls
+   * <code>SecurityManager.checkExit(0)</code> which might throw a
+   * <code>SecurityException</code>. When the specified operation is
+   * not one of the above a <code>IllegalArgumentException</code> 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;
+  }
 }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]