[Patch][gui] more swing cleanups

Michael Koch konqueror@gmx.de
Wed Jan 26 20:59:00 GMT 2005


Hi list,


I did some more Swing API cleanups. We do make local stuff public
available too often.


Michael


2005-01-26  Michael Koch  <konqueror@gmx.de>

	* javax/swing/DefaultButtonModel.java
	(changeState): Made private.
	* javax/swing/DefaultDesktopManager.java
	(setWasIcon): Fixed second argument to be java.lang.Boolean.
	* javax/swing/JLayeredPane.java
	(layerToRange): Made private.
	(incrLayer): Likewise.
	(decrLayer): Likewise.
	* javax/swing/JTable.java
	(dragEnabled): Likewise.
	(preferredViewportSize): Renamed from preferredScrollableViewportSize.
	* javax/swing/KeyStroke.java
	(Keystroke): Made private.
	* javax/swing/TransferHandler.java
	(COMMAND_COPY): Likewise.
	(COMMAND_CUT): Likewise.
	(COMMAND_PASTE): Likewise.

-------------- next part --------------
Index: javax/swing/DefaultButtonModel.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/DefaultButtonModel.java,v
retrieving revision 1.5.2.8
diff -u -r1.5.2.8 DefaultButtonModel.java
--- javax/swing/DefaultButtonModel.java	25 Jan 2005 07:07:42 -0000	1.5.2.8
+++ javax/swing/DefaultButtonModel.java	26 Jan 2005 20:57:25 -0000
@@ -315,7 +315,7 @@
    * @param stateflag DOCUMENT ME!
    * @param b DOCUMENT ME!
    */
-  protected void changeState(int stateflag, boolean b)
+  private void changeState(int stateflag, boolean b)
   {
     int oldstate = stateMask;
     int newstate;
Index: javax/swing/DefaultDesktopManager.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/DefaultDesktopManager.java,v
retrieving revision 1.3.8.4
diff -u -r1.3.8.4 DefaultDesktopManager.java
--- javax/swing/DefaultDesktopManager.java	27 Dec 2004 11:25:00 -0000	1.3.8.4
+++ javax/swing/DefaultDesktopManager.java	26 Jan 2005 20:57:25 -0000
@@ -1,5 +1,5 @@
 /* DefaultDesktopManager.java --
-   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -35,6 +35,7 @@
 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.Component;
@@ -90,7 +91,7 @@
    */
   public DefaultDesktopManager()
   {
-  } // DefaultDesktopManager()
+  }
 
   /**
    * This method is not normally called since the user will typically add the
@@ -111,7 +112,7 @@
     c.remove(frame.getDesktopIcon());
     c.add(frame);
     frame.setVisible(true);
-  } // openFrame()
+  }
 
   /**
    * This method removes the JInternalFrame and JDesktopIcon (if one is
@@ -132,7 +133,7 @@
 	  c.remove(frame);
 	c.repaint();
       }
-  } // closeFrame()
+  }
 
   /**
    * This method resizes the JInternalFrame to match its parent's bounds.
@@ -171,7 +172,7 @@
 	    // Do nothing.
 	  }
       }
-  } // maximizeFrame()
+  }
 
   /**
    * This method restores the JInternalFrame's bounds to what they were
@@ -200,7 +201,7 @@
 
     setBoundsForFrame(frame, normalBounds.x, normalBounds.y,
                       normalBounds.width, normalBounds.height);
-  } // minimizeFrame()
+  }
 
   /**
    * This method removes the JInternalFrame from its parent and adds its
@@ -231,7 +232,7 @@
       {
 	Rectangle r = getBoundsForIconOf(frame);
 	icon.setBounds(r);
-	setWasIcon(frame, true);
+	setWasIcon(frame, Boolean.TRUE);
       }
 
     if (c != null)
@@ -243,7 +244,7 @@
 	  }
 	c.remove(frame);
       }
-  } // iconifyFrame()
+  }
 
   /**
    * This method removes the JInternalFrame's JDesktopIcon representation and
@@ -279,7 +280,7 @@
       }
 
     c.invalidate();
-  } // deiconifyFrame()
+  }
 
   /**
    * This method activates the JInternalFrame by moving it to the front and
@@ -305,7 +306,7 @@
       }
 
     frame.toFront();
-  } // activateFrame()
+  }
 
   /**
    * This method is called when the JInternalFrame loses focus.
@@ -330,7 +331,7 @@
 	  {
 	  }
       }
-  } // deactivateFrame()
+  }
 
   /**
    * This method is called to indicate that the DesktopManager should prepare
@@ -354,7 +355,7 @@
       currentDragMode = JDesktopPane.LIVE_DRAG_MODE;
     else
       currentDragMode = ((JDesktopPane) pane).getDragMode();
-  } // beginDraggingFrame()
+  }
 
   /**
    * This method is called to drag the JInternalFrame to a new location.
@@ -378,7 +379,7 @@
 	  setBoundsForFrame((JInternalFrame) component, newX, newY, b.width,
 	                    b.height);
       }
-  } // dragFrame()
+  }
 
   /**
    * This method indicates that the dragging is done. Any state information
@@ -396,7 +397,7 @@
 	dragCache = null;
       }
     component.repaint();
-  } // endDraggingFrame()
+  }
 
   /**
    * This method is called to indicate that the given JComponent will be
@@ -417,7 +418,7 @@
       currentDragMode = JDesktopPane.LIVE_DRAG_MODE;
     else
       currentDragMode = ((JDesktopPane) pane).getDragMode();
-  } // beginResizingFrame()
+  }
 
   /**
    * This method resizes the give JComponent.
@@ -440,7 +441,7 @@
     else
       setBoundsForFrame(component, dragCache.x, dragCache.y, dragCache.width,
                         dragCache.height);
-  } // resizeFrame()
+  }
 
   /**
    * This method is called to indicate that the given JComponent has finished
@@ -459,7 +460,7 @@
 	dragCache = null;
       }
     component.repaint();
-  } // endResizingFrame()
+  }
 
   /**
    * This method calls setBounds with the given parameters and repaints the
@@ -482,7 +483,7 @@
       component.getParent().repaint();
     else
       component.repaint();
-  } // setBoundsForFrame()
+  }
 
   /**
    * This is a helper method that removes the JDesktopIcon of the given
@@ -496,7 +497,7 @@
     Container c = icon.getParent();
     if (c != null && icon != null)
       c.remove(icon);
-  } // removeIconFor()
+  }
 
   /**
    * This method is called by iconifyFrame to determine the bounds of the
@@ -570,7 +571,7 @@
       }
 
     return ideal;
-  } // getBoundsForIconOf()
+  }
 
   /**
    * This method sets the bounds of the JInternalFrame right before the
@@ -582,7 +583,7 @@
   protected void setPreviousBounds(JInternalFrame frame, Rectangle rect)
   {
     frame.setNormalBounds(rect);
-  } // setPreviousBounds()
+  }
 
   /**
    * This method returns the normal bounds of the JInternalFrame from before
@@ -595,7 +596,7 @@
   protected Rectangle getPreviousBounds(JInternalFrame frame)
   {
     return frame.getNormalBounds();
-  } // getPreviousBounds()
+  }
 
   /**
    * This method sets the value to true if the given JInternalFrame has been
@@ -605,10 +606,10 @@
    * @param value True if the JInternalFrame has been iconized and the bounds
    *        of the JDesktopIcon are valid.
    */
-  protected void setWasIcon(JInternalFrame frame, boolean value)
+  protected void setWasIcon(JInternalFrame frame, Boolean value)
   {
-    frame.setWasIcon(value, WAS_ICON_ONCE_PROPERTY);
-  } // setWasIcon()
+    frame.setWasIcon(value.booleanValue(), WAS_ICON_ONCE_PROPERTY);
+  }
 
   /**
    * This method returns true if the given JInternalFrame has been iconized
@@ -622,5 +623,5 @@
   protected boolean wasIcon(JInternalFrame frame)
   {
     return frame.getWasIcon();
-  } // wasIcon()
-} // DefaultDesktopManager
+  }
+}
Index: javax/swing/JLayeredPane.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/JLayeredPane.java,v
retrieving revision 1.6.8.8
diff -u -r1.6.8.8 JLayeredPane.java
--- javax/swing/JLayeredPane.java	13 Dec 2004 19:09:07 -0000	1.6.8.8
+++ javax/swing/JLayeredPane.java	26 Jan 2005 20:57:25 -0000
@@ -143,7 +143,7 @@
    * @throws IllegalArgumentException if layer does not refer to an active layer
    * in this container.
    */
-  protected int[] layerToRange (Integer layer)
+  private int[] layerToRange (Integer layer)
   {
     int[] ret = new int[2];
     ret[1] = getComponents ().length;
@@ -173,7 +173,7 @@
    * @param layer the layer number to increment.
    * @see #incrLayer()
    */
-  protected void incrLayer(Integer layer)
+  private void incrLayer(Integer layer)
   {
     int sz = 1;
     if (layers.containsKey (layer))
@@ -187,7 +187,7 @@
    * @param layer the layer number to decrement.
    * @see #decrLayer()
    */
-  protected void decrLayer(Integer layer)
+  private void decrLayer(Integer layer)
   {
     int sz = 0;
     if (layers.containsKey (layer))
Index: javax/swing/JTable.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/JTable.java,v
retrieving revision 1.4.18.20
diff -u -r1.4.18.20 JTable.java
--- javax/swing/JTable.java	24 Jan 2005 21:57:22 -0000	1.4.18.20
+++ javax/swing/JTable.java	26 Jan 2005 20:57:25 -0000
@@ -279,7 +279,7 @@
    * @see #setDragEnabled()
    * @see #getDragEnabled()
    */
-  protected boolean dragEnabled;
+  private boolean dragEnabled;
 
   /**
    * The color to paint the grid lines of the table, when either {@link
@@ -297,7 +297,7 @@
    * @see #setPreferredScrollableViewportSize()
    * @see #getPreferredScrollableViewportSize()
    */
-  protected Dimension preferredScrollableViewportSize;
+  protected Dimension preferredViewportSize;
 
   /**
    * The color to paint the background of selected cells. Fires a property
@@ -438,7 +438,7 @@
     // this.accessibleContext = new AccessibleJTable();
     this.cellEditor = null;
     this.dragEnabled = false;
-    this.preferredScrollableViewportSize = new Dimension(450,400);
+    this.preferredViewportSize = new Dimension(450,400);
     this.showHorizontalLines = true;
     this.showVerticalLines = true;
     this.editingColumn = -1;
@@ -1124,13 +1124,13 @@
   }
 
   /**
-   * Get the value of the {@link #preferredScrollableViewportSize} property.
+   * Get the value of the {@link #preferredViewportSize} property.
    *
    * @return The current value of the property
    */
   public Dimension getPreferredScrollableViewportSize()
   {
-    return preferredScrollableViewportSize;
+    return preferredViewportSize;
   }
 
   /**
@@ -1447,13 +1447,13 @@
   }
 
   /**
-   * Set the value of the {@link #preferredScrollableViewportSize} property.
+   * Set the value of the {@link #preferredViewportSize} property.
    *
-   * @param p The new value of the preferredScrollableViewportSize property
+   * @param p The new value of the preferredViewportSize property
    */ 
   public void setPreferredScrollableViewportSize(Dimension p)
   {
-    preferredScrollableViewportSize = p;
+    preferredViewportSize = p;
     revalidate();
     repaint();
   }
Index: javax/swing/KeyStroke.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/KeyStroke.java,v
retrieving revision 1.3.18.5
diff -u -r1.3.18.5 KeyStroke.java
--- javax/swing/KeyStroke.java	27 Dec 2004 11:25:01 -0000	1.3.18.5
+++ javax/swing/KeyStroke.java	26 Jan 2005 20:57:25 -0000
@@ -1,5 +1,5 @@
 /* KeyStroke.java --
-   Copyright (C) 2002, 2004  Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -35,6 +35,7 @@
 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.AWTKeyStroke;
@@ -47,12 +48,13 @@
 {
   private static final long serialVersionUID = -9060180771037902530L;
   
+  // Called by java.awt.AWTKeyStroke.registerSubclass via reflection.
   private KeyStroke()
   {
   }
   
-  protected KeyStroke(char keyChar, int keyCode, int modifiers,
-                      boolean onKeyRelease)
+  private KeyStroke(char keyChar, int keyCode, int modifiers,
+                    boolean onKeyRelease)
   {
     super(keyChar, keyCode, modifiers, onKeyRelease);
   }
Index: javax/swing/TransferHandler.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/TransferHandler.java,v
retrieving revision 1.1.2.5
diff -u -r1.1.2.5 TransferHandler.java
--- javax/swing/TransferHandler.java	29 Dec 2004 17:39:18 -0000	1.1.2.5
+++ javax/swing/TransferHandler.java	26 Jan 2005 20:57:25 -0000
@@ -104,9 +104,9 @@
   
   private static final long serialVersionUID = -7908749299918704233L;
 
-  public static final String COMMAND_COPY = "copy";
-  public static final String COMMAND_CUT = "cut";
-  public static final String COMMAND_PASTE = "paste";
+  private static final String COMMAND_COPY = "copy";
+  private static final String COMMAND_CUT = "cut";
+  private static final String COMMAND_PASTE = "paste";
   
   public static final int NONE = 0;
   public static final int COPY = 1;


More information about the Java-patches mailing list