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]

[GUI] Patch: javax.swing - reindent


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

Hi list,


I commited the attached patch to reindent some classes in Swing.


Michael


2004-06-10  Michael Koch  <konqueror@gmx.de>

	* javax/swing/ButtonGroup.java,
	javax/swing/ImageIcon.java,
	javax/swing/JEditorPane.java,
	javax/swing/JRootPane.java,
	javax/swing/JTextField.java,
	javax/swing/LookAndFeel.java,
	javax/swing/plaf/basic/BasicTextUI.java:
	Reindented.


- -- 
Homepage: http://www.worldforge.org/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFAyCEdWSOgCCdjSDsRAjHvAJ9ztcfXLjxf94SFYHZxiM1jJy5tgwCeM5X0
BLWjOl0WQU0tfAWd3chug6c=
=DfvA
-----END PGP SIGNATURE-----
Index: javax/swing/ButtonGroup.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/ButtonGroup.java,v
retrieving revision 1.4
diff -u -b -B -r1.4 ButtonGroup.java
--- javax/swing/ButtonGroup.java	5 Feb 2004 18:48:53 -0000	1.4
+++ javax/swing/ButtonGroup.java	10 Jun 2004 08:47:13 -0000
@@ -42,10 +41,11 @@
 import java.util.Enumeration;
 import java.util.Vector;
 
-public class ButtonGroup implements Serializable 
+
+public class ButtonGroup
+  implements Serializable
 {
   static final long serialVersionUID = 4259076101881721375L;
-
     Vector v = new Vector();
     ButtonModel sel;
     
@@ -49,7 +49,9 @@
     Vector v = new Vector();
     ButtonModel sel;
     
-    public ButtonGroup() {}
+  public ButtonGroup()
+  {
+  }
     
     public void add(AbstractButton b) 
     {
@@ -63,35 +65,33 @@
 	v.removeElement(b);
     }
 
-
-    public Enumeration getElements() {
+  public Enumeration getElements()
+  {
         return v.elements();
     }
 
-    public ButtonModel getSelection() {
+  public ButtonModel getSelection()
+  {
         return sel;
     }
 
     AbstractButton FindButton(ButtonModel m)
     {
-	for (int i=0;i<v.size();i++)
+    for (int i = 0; i < v.size(); i++)
 	    {
 	    AbstractButton a = (AbstractButton) v.get(i);
-	    if (a.getModel()== m)
-	    {
+	if (a.getModel() == m)
 		return a;
 	    }
-	}
 	return null;
     }
 
     public void setSelected(ButtonModel m, boolean b)
     {
-	if ((m == sel) &&
-	    (b == true))
+    if ((m == sel) && (b == true))
 	    {
 		// clicked on sam item twice.
-		System.out.println("PRESSED TWICE:" + m + ", sel="+sel);
+	System.out.println("PRESSED TWICE:" + m + ", sel=" + sel);
 		return;
 	    }	
 	
@@ -97,9 +97,8 @@
 	
 	if (sel != null)
 	    {
-
 		System.out.println("DESELECTING: " + sel);
-		sel.setSelected(!b);
+	sel.setSelected(! b);
 
 		AbstractButton but = FindButton(sel);
 		if (but != null)
@@ -110,9 +109,7 @@
 		    }
 	    }
 	else
-	    {
 		System.out.println("NO SELECTION YET");
-	    }
 	
 	sel = m;
     }
Index: javax/swing/ImageIcon.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/ImageIcon.java,v
retrieving revision 1.2.18.3
diff -u -b -B -r1.2.18.3 ImageIcon.java
--- javax/swing/ImageIcon.java	8 Jun 2004 22:31:47 -0000	1.2.18.3
+++ javax/swing/ImageIcon.java	10 Jun 2004 08:47:13 -0000
@@ -46,19 +45,20 @@
 import java.io.Serializable;
 import java.net.URL;
 
-public class ImageIcon implements Icon, Serializable
+
+public class ImageIcon
+  implements Icon, Serializable
 {
   private static final long serialVersionUID = 532615968316031794L;
-
     Image image;
-    String file, descr;
+  String file;
+  String descr;
     Component observer;
 
   public ImageIcon(String s)
     {
     	// if description is not specified, then file name becomes
 	// desciption for this icon
-	
 	this(s, s);
     }
 
@@ -66,16 +66,15 @@
   {
   }
 
-  public ImageIcon(String file,
-	      String descr)
+  public ImageIcon(String file, String descr)
     {
         this.file = file;
         this.descr = descr;
 
         image = Toolkit.getDefaultToolkit().getImage(file);
-        if (image == null) {
+    if (image == null)
             return;
-        }
+
         //loadImage(image);
     }
 
@@ -86,22 +85,31 @@
     }
 
     public Image getImage() 
-    {  return image;    }
+  {
+    return image;
+  }
 
     public String getDescription() 
-    {  return descr;    }
+  {
+    return descr;
+  }
+
     public void setDescription(String description) 
-    {  this.descr = description;    }
+  {
+    this.descr = description;
+  }
 
     public int getIconHeight()
-    {	return image.getHeight(observer);    }
+  {
+    return image.getHeight(observer);
+  }
+
     public int getIconWidth()
-    {	return image.getWidth(observer);    }
+  {
+    return image.getWidth(observer);
+  }
 
-    public void paintIcon(Component c, 
-			  Graphics g,
-			  int x, 
-			  int y)
+  public void paintIcon(Component c, Graphics g, int x, int y)
     {
 	g.drawImage(image, x, y, observer);
     }
Index: javax/swing/JEditorPane.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/JEditorPane.java,v
retrieving revision 1.5
diff -u -b -B -r1.5 JEditorPane.java
--- javax/swing/JEditorPane.java	12 Feb 2004 00:17:23 -0000	1.5
+++ javax/swing/JEditorPane.java	10 Jun 2004 08:47:13 -0000
@@ -40,15 +39,16 @@
 
 import java.awt.Dimension;
 import java.awt.event.KeyEvent;
-import java.io.InputStream;
 import java.io.IOException;
+import java.io.InputStream;
 import java.net.URL;
 import javax.accessibility.AccessibleContext;
+import javax.swing.event.HyperlinkEvent;
+import javax.swing.event.HyperlinkListener;
 import javax.swing.text.EditorKit;
 import javax.swing.text.JTextComponent;
 import javax.swing.text.PlainEditorKit;
-import javax.swing.event.HyperlinkEvent;
-import javax.swing.event.HyperlinkListener;
+
 
 public class JEditorPane extends JTextComponent
 {
@@ -65,8 +63,7 @@
     {
     }
 
-    public JEditorPane(String url)
-      throws IOException
+  public JEditorPane(String url) throws IOException
     {
 	this();
 	setPage(url);
@@ -78,36 +75,49 @@
 	setText(text);
     }
     
-    public JEditorPane(URL url)
-      throws IOException
+  public JEditorPane(URL url) throws IOException
     {
 	setPage(url);
     }
 
     protected  EditorKit createDefaultEditorKit()
-    {	return new PlainEditorKit();    }
+  {
+    return new PlainEditorKit();
+  }
     
     static EditorKit createEditorKitForContentType(String type)
-    {	return new PlainEditorKit();     }
+  {
+    return new PlainEditorKit();
+  }
     
   void fireHyperlinkUpdate(HyperlinkEvent e)
   {
   }
 
   public AccessibleContext getAccessibleContext()
-  {      return null;  }
+  {
+    return null;
+  }
 
   String getContentType()
-    {  return ctype;   }
+  {
+    return ctype;
+  }
 
   EditorKit getEditorKit()
-    {  return kit;    }
+  {
+    return kit;
+  }
     
   static String getEditorKitClassNameForContentType(String type)
-    { return "text/plain";  }
+  {
+    return "text/plain";
+  }
   
   EditorKit getEditorKitForContentType(String type)
-    { return kit;  }
+  {
+    return kit;
+  }
     
     public Dimension getPreferredSize()
     {
@@ -116,37 +126,57 @@
     }
 
   public boolean getScrollableTracksViewportHeight()
-    {  return false;  }
+  {
+    return false;
+  }
+
   public boolean getScrollableTracksViewportWidth()
-    {  return false;  }
+  {
+    return false;
+  }
 
   URL getPage()
-    { return page_url;  }
+  {
+    return page_url;
+  }
 
   protected  InputStream getStream(URL page)
     {	
-	try {
+    try
+      {
 	    return page.openStream();    
-	} catch (Exception e) {
+      }
+    catch (Exception e)
+      {
 	    System.out.println("Hhmmm, failed to open stream: " + e);
 	}	
 	return null;
     }
 
     public String getText()
-    { return super.getText();    }
+  {
+    return super.getText();
+  }
     
     public String getUIClassID()
-    {    return "EditorPaneUI";  }
+  {
+    return "EditorPaneUI";
+  }
 
     public boolean isFocusCycleRoot()
-    { return focus_root;    }
+  {
+    return focus_root;
+  }
 
     public boolean isManagingFocus()
-    { return manages_focus;  }
+  {
+    return manages_focus;
+  }
 
   protected  String paramString()
-    { return "JEditorPane";  }
+  {
+    return "JEditorPane";
+  }
     
   protected  void processComponentKeyEvent(KeyEvent e)
     {
@@ -168,7 +198,8 @@
 	//Establishes the default bindings of type to classname. 
     }
     
-    static void registerEditorKitForContentType(String type, String classname, ClassLoader loader)
+  static void registerEditorKitForContentType(String type, String classname,
+                                              ClassLoader loader)
     {
 	//Establishes the default bindings of type to classname.  
     }
@@ -203,14 +234,12 @@
 	setEditorKit(k);
     }
   
-  void setPage(String url)
-    throws IOException
+  void setPage(String url) throws IOException
     {
 	//  Sets the current URL being displayed.  
     }
     
-    void setPage(URL page)
-    throws IOException
+  void setPage(URL page) throws IOException
     {
 	//    Sets the current URL being displayed.  
     }
@@ -222,12 +251,12 @@
 
   public void addHyperlinkListener(HyperlinkListener listener)
   {
-    listenerList.add (HyperlinkListener.class, listener);
+    listenerList.add(HyperlinkListener.class, listener);
   }
     
-  public void removeHyperlinkListener (HyperlinkListener listener)
+  public void removeHyperlinkListener(HyperlinkListener listener)
   {
-    listenerList.remove (HyperlinkListener.class, listener);
+    listenerList.remove(HyperlinkListener.class, listener);
   }
 
   /**
@@ -235,7 +264,6 @@
    */
   public HyperlinkListener[] getHyperlinkListeners()
   {
-    return (HyperlinkListener[]) getListeners (HyperlinkListener.class);
+    return (HyperlinkListener[]) getListeners(HyperlinkListener.class);
   }
-    
-} // class JEditorPane
+}
Index: javax/swing/JRootPane.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/JRootPane.java,v
retrieving revision 1.4.2.3
diff -u -b -B -r1.4.2.3 JRootPane.java
--- javax/swing/JRootPane.java	7 Jun 2004 14:00:33 -0000	1.4.2.3
+++ javax/swing/JRootPane.java	10 Jun 2004 08:47:13 -0000
@@ -66,13 +65,14 @@
 public class JRootPane extends JComponent
 {
     //  The class used to obtain the accessible role for this object.
-    static protected class AccessibleJRootPane
+  protected static class AccessibleJRootPane
     {
     }
 
     // Custom Layout Manager for JRootPane. It positions contentPane and 
     // menuBar withing its layeredPane.
-    protected class RootLayout extends Object implements LayoutManager2
+  protected class RootLayout extends Object
+    implements LayoutManager2
     {
       public void addLayoutComponent(Component comp, Object constraints)
       {
@@ -190,9 +190,9 @@
 	        int maxWidth;
 	        menuBarSize = menuBar.getPreferredSize();
 	        maxWidth = Math.max(menuBarSize.width, contentPaneSize.width);
-	        prefSize = new Dimension(maxWidth,
-	                               contentPaneSize.height
-	                               + menuBarSize.height);
+	      prefSize =
+		new Dimension(maxWidth,
+		              contentPaneSize.height + menuBarSize.height);
 	      }
 	    else
 	      prefSize = contentPaneSize;
@@ -213,7 +213,6 @@
     protected  JMenuBar menuBar;  
     protected Container contentPane;
   
-    
     void setJMenuBar(JMenuBar m)
     {  
       menuBar = m; 
@@ -221,7 +220,9 @@
     }
 
     JMenuBar getJMenuBar()
-    {  return menuBar; }
+  {
+    return menuBar;
+  }
 
   public boolean isValidateRoot()
   {
@@ -232,9 +232,7 @@
     public Container getContentPane()
     {
 	if (contentPane == null)
-	    {
 		setContentPane(createContentPane());
-	    }
 	return contentPane;
     }
 
@@ -244,9 +242,7 @@
 	getLayeredPane().add(contentPane, JLayeredPane.FRAME_CONTENT_LAYER);
     }
 
-    protected void addImpl(Component comp,
-			  Object constraints,
-			  int index)
+  protected void addImpl(Component comp, Object constraints, int index)
     {
 	super.addImpl(comp, constraints, index);
     } 
@@ -295,14 +291,15 @@
 	updateUI();
     }
 
-    protected LayoutManager createRootLayout() {
+  protected LayoutManager createRootLayout()
+  {
         return new RootLayout();
     } 
 
     JComponent createContentPane()
     {
 	JPanel p = new JPanel();
-	p.setName(this.getName()+".contentPane");
+    p.setName(this.getName() + ".contentPane");
 	p.setLayout(new BorderLayout());
 	return p;
     }
@@ -310,7 +307,7 @@
     Component createGlassPane()
     {
 	JPanel p = new JPanel();
-	p.setName(this.getName()+".glassPane");
+    p.setName(this.getName() + ".glassPane");
 	p.setLayout(new BorderLayout());
 	p.setVisible(false);
 	return p;
Index: javax/swing/JTextField.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/JTextField.java,v
retrieving revision 1.2.18.2
diff -u -b -B -r1.2.18.2 JTextField.java
--- javax/swing/JTextField.java	8 Jun 2004 09:28:42 -0000	1.2.18.2
+++ javax/swing/JTextField.java	10 Jun 2004 08:47:13 -0000
@@ -72,7 +71,6 @@
   }
 
   private static final long serialVersionUID = 353853209832607592L;
-  
     Vector actions = new Vector();
 
   public JTextField()
Index: javax/swing/LookAndFeel.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/LookAndFeel.java,v
retrieving revision 1.2.18.1
diff -u -b -B -r1.2.18.1 LookAndFeel.java
--- javax/swing/LookAndFeel.java	7 Jun 2004 14:00:36 -0000	1.2.18.1
+++ javax/swing/LookAndFeel.java	10 Jun 2004 08:47:13 -0000
@@ -62,12 +64,15 @@
 	//Convenience method for installing a component's default Border object on the specified component if either the border is currently null or already an instance of UIResource. 
     }
 
-    public static void installColors(JComponent c, String defaultBgName, String defaultFgName)
+  public static void installColors(JComponent c, String defaultBgName,
+                                   String defaultFgName)
     {
 	//Convenience method for initializing a component's foreground and background color properties with values from the current defaults table. 
     }
 
-    public static void installColorsAndFont(JComponent c, String defaultBgName, String defaultFgName, String defaultFontName)
+  public static void installColorsAndFont(JComponent c, String defaultBgName,
+                                          String defaultFgName,
+                                          String defaultFontName)
     {
 	//Convenience method for initializing a components foreground background and font properties with values from the current defaults table. 
     }
@@ -80,7 +86,8 @@
 	//Loads the bindings in keys into retMap. 
     }
 
-    public static ComponentInputMap makeComponentInputMap(JComponent c, Object[] keys)
+  public static ComponentInputMap makeComponentInputMap(JComponent c,
+                                                        Object[] keys)
     {
 	//    Creates a ComponentInputMap from keys. 
 	return null;
@@ -104,7 +111,6 @@
 	return null;
     }
 
-  
     public String toString()
     {
 	//Returns a string that displays and identifies this object's properties. 
@@ -116,7 +122,6 @@
 	//UIManager.setLookAndFeel calls this method just before we're replaced by a new default look and feel. 
     }
 
-  
     public static void uninstallBorder(JComponent c)
     {
 	//Convenience method for un-installing a component's default border on the specified component if the border is currently an instance of UIResource.
Index: javax/swing/plaf/basic/BasicTextUI.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/plaf/basic/BasicTextUI.java,v
retrieving revision 1.4
diff -u -b -B -r1.4 BasicTextUI.java
--- javax/swing/plaf/basic/BasicTextUI.java	13 Jul 2003 15:29:11 -0000	1.4
+++ javax/swing/plaf/basic/BasicTextUI.java	10 Jun 2004 08:47:13 -0000
@@ -60,7 +60,9 @@
 {
     int gap = 3;
     View view = null; // was: new RootView();
-    Color textColor, disabledTextColor, normalBackgroundColor;
+  Color textColor;
+  Color disabledTextColor;
+  Color normalBackgroundColor;
     EditorKit kit = new DefaultEditorKit();
     
     /* *****************************************************************
@@ -99,14 +100,13 @@
 	return new BasicTextUI();
     }
 
-    
     public void installUI(final JComponent c) 
     {
 	super.installUI(c);
 
-	textColor                = new Color(0,0,0);
+    textColor = new Color(0, 0, 0);
 	disabledTextColor        = new Color(130, 130, 130);
-	normalBackgroundColor    = new Color(192,192,192);
+    normalBackgroundColor = new Color(192, 192, 192);
     }
     
     public Dimension getPreferredSize(JComponent c) 
@@ -118,10 +118,9 @@
 	float w = v.getPreferredSpan(View.X_AXIS);
 	float h = v.getPreferredSpan(View.Y_AXIS);
 
-	return new Dimension((int)w, (int) h);
+    return new Dimension((int) w, (int) h);
     }
     
-
     public void paint(Graphics g, JComponent c)
     {      
 	//	view.paint(
@@ -132,10 +131,8 @@
 	damageRange(t, p0, p1, null, null);
     }    
 
-    public void damageRange(JTextComponent t, 
-		     int p0, int p1, 
-		     Position.Bias firstBias,
-		     Position.Bias secondBias)
+  public void damageRange(JTextComponent t, int p0, int p1,
+                          Position.Bias firstBias, Position.Bias secondBias)
     {
     }
 
@@ -144,10 +141,8 @@
 	return kit;
     }
     
-    public int getNextVisualPositionFrom(JTextComponent t, 
-				  int pos,
-				  Position.Bias b, 
-				  int direction,
+  public int getNextVisualPositionFrom(JTextComponent t, int pos,
+                                       Position.Bias b, int direction,
 				  Position.Bias[] biasRet)
         throws BadLocationException
     {
@@ -181,7 +176,7 @@
 	return 0;
     } 
 
-  public View create (Element elem)
+  public View create(Element elem)
   {
     // subclasses have to implement this to get this functionality
     return null;

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