[Patch][gui] java.awt - little fixes

Michael Koch konqueror@gmx.de
Sun Nov 21 18:56:00 GMT 2004


Hi list,


I jsut did some little fixes to java.awt.


Michael


2004-11-21  Michael Koch  <konqueror@gmx.de>

	* java/awt/CardLayout.java:
	Made some constants static.
	(serialVersionUID): Made private.
	(addLayoutComponent): Simplified code.
	* java/awt/event/InputEvent.java
	(getModifiersEx): Added missing @param tag.
	* java/awt/image/RGBImageFilter.java
	(filterRGBPixels): Reformatted, removed wrong @param tag.

-------------- next part --------------
Index: java/awt/CardLayout.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/CardLayout.java,v
retrieving revision 1.9.2.3
diff -u -r1.9.2.3 CardLayout.java
--- java/awt/CardLayout.java	17 Nov 2004 08:00:35 -0000	1.9.2.3
+++ java/awt/CardLayout.java	21 Nov 2004 18:38:56 -0000
@@ -53,7 +53,7 @@
  */
 public class CardLayout implements LayoutManager2, Serializable
 {
-  static final long serialVersionUID = -4328196481005934313L;
+  private static final long serialVersionUID = -4328196481005934313L;
 
   /**
    * Initializes a new instance of <code>CardLayout</code> with horizontal
@@ -111,10 +111,7 @@
   {
     tab.put (name, comp);
     // First component added is the default component.
-    if (tab.size() == 1)
-      comp.setVisible(true);
-    else
-      comp.setVisible(false);
+    comp.setVisible(tab.size() == 1);
   }
 
   /**
@@ -474,13 +471,13 @@
   private Hashtable tab;
 
   // These constants are used by the private gotoComponent method.
-  private int FIRST = 0;
-  private int LAST = 1;
-  private int NEXT = 2;
-  private int PREV = 3;
+  private static final int FIRST = 0;
+  private static final int LAST = 1;
+  private static final int NEXT = 2;
+  private static final int PREV = 3;
 
   // These constants are used by the private getSize method.
-  private int MIN = 0;
-  private int MAX = 1;
-  private int PREF = 2;
+  private static final int MIN = 0;
+  private static final int MAX = 1;
+  private static final int PREF = 2;
 }
Index: java/awt/event/InputEvent.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/event/InputEvent.java,v
retrieving revision 1.7.46.1
diff -u -r1.7.46.1 InputEvent.java
--- java/awt/event/InputEvent.java	27 Sep 2004 15:14:29 -0000	1.7.46.1
+++ java/awt/event/InputEvent.java	21 Nov 2004 18:38:56 -0000
@@ -350,6 +350,7 @@
    * XXX Sun claims this can be localized via the awt.properties file - how
    * do we implement that?
    *
+   * @param modifiers the modifiers
    * @return a string representation of the modifiers in this bitmask
    * @since 1.4
    */
Index: java/awt/image/RGBImageFilter.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/image/RGBImageFilter.java,v
retrieving revision 1.2.14.3
diff -u -r1.2.14.3 RGBImageFilter.java
--- java/awt/image/RGBImageFilter.java	24 Jun 2004 05:30:19 -0000	1.2.14.3
+++ java/awt/image/RGBImageFilter.java	21 Nov 2004 18:38:56 -0000
@@ -140,28 +140,19 @@
        @param y the y coordinate of the rectangle
        @param w the width of the rectangle
        @param h the height of the rectangle
-       @param model the <code>ColorModel</code> used to translate the pixels
        @param pixels the array of pixel values
        @param offset the index of the first pixels in the <code>pixels</code> array
        @param scansize the width to use in extracting pixels from the <code>pixels</code> array
     */
-    public void filterRGBPixels(int x,
-				int y,
-				int w,
-				int h,
-				int[] pixels,
-				int off,
-				int scansize)
-    {
-	int xp, yp, i;
-
-	i = 0;
-	for( xp = x; xp < ( x + w); xp++ )
-	    for( yp = y; yp < (y + h); yp++ )
-	    {
-		pixels[i] = filterRGB( xp, yp, pixels[i] );
-		i++;
-	    }
+    public void filterRGBPixels(int x, int y, int w, int h, int[] pixels,
+				int offset, int scansize)
+    {
+      for (int xp = x; xp < (x + w); xp++)
+	for (int yp = y; yp < (y + h); yp++)
+	  {
+	    pixels[offset] = filterRGB(xp, yp, pixels[offset]);
+	    offset++;
+	  }
     }
 
 


More information about the Java-patches mailing list