[Patch][gui] swing cleanups
Michael Koch
konqueror@gmx.de
Fri Jan 28 09:45:00 GMT 2005
Hi list,
I just commited the attached patch to improve our API a bit more. All
bugs were found by japitools and verified by looking at SUNs javadocs.
Michael
2005-01-28 Michael Koch <konqueror@gmx.de>
* java/awt/image/ReplicateScaleFilter.java
(replicatePixels): Made private.
* javax/swing/colorchooser/DefaultRGBChooserPanel.java
(DefaultRGBChooserPanel): Made package private.
* javax/swing/colorchooser/DefaultSwatchChooserPanel.java
(RecentSwatchPanel): Likewise.
* javax/swing/event/MouseInputAdapter.java: Reformatted.
(MouseInputAdapter): Made abstract.
* javax/swing/tree/DefaultMutableTreeNode.java
(random): Removed.
(growTree): Likewise.
-------------- next part --------------
Index: java/awt/image/ReplicateScaleFilter.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/image/ReplicateScaleFilter.java,v
retrieving revision 1.1.84.2
diff -u -r1.1.84.2 ReplicateScaleFilter.java
--- java/awt/image/ReplicateScaleFilter.java 6 May 2004 17:13:49 -0000 1.1.84.2
+++ java/awt/image/ReplicateScaleFilter.java 28 Jan 2005 09:41:04 -0000
@@ -201,10 +201,10 @@
model, destPixels, 0, destScansize);
}
- protected byte[] replicatePixels(int srcx, int srcy, int srcw, int srch,
- ColorModel model, byte[] srcPixels,
- int srcOffset, int srcScansize,
- double rx, double ry, int destScansize)
+ private byte[] replicatePixels(int srcx, int srcy, int srcw, int srch,
+ ColorModel model, byte[] srcPixels,
+ int srcOffset, int srcScansize,
+ double rx, double ry, int destScansize)
{
byte[] destPixels =
new byte[(int) Math.ceil(srcw/rx) * (int) Math.ceil(srch/ry)];
@@ -221,10 +221,10 @@
return destPixels;
}
- protected int[] replicatePixels(int srcx, int srcy, int srcw, int srch,
- ColorModel model, int[] srcPixels,
- int srcOffset, int srcScansize,
- double rx, double ry, int destScansize)
+ private int[] replicatePixels(int srcx, int srcy, int srcw, int srch,
+ ColorModel model, int[] srcPixels,
+ int srcOffset, int srcScansize,
+ double rx, double ry, int destScansize)
{
int[] destPixels =
new int[(int) Math.ceil(srcw/rx) * (int) Math.ceil(srch/ry)];
Index: javax/swing/colorchooser/DefaultRGBChooserPanel.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/colorchooser/DefaultRGBChooserPanel.java,v
retrieving revision 1.1.2.3
diff -u -r1.1.2.3 DefaultRGBChooserPanel.java
--- javax/swing/colorchooser/DefaultRGBChooserPanel.java 22 Oct 2004 12:41:20 -0000 1.1.2.3
+++ javax/swing/colorchooser/DefaultRGBChooserPanel.java 28 Jan 2005 09:41:04 -0000
@@ -1,5 +1,5 @@
/* DefaultRGHChooserPanel.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -57,7 +57,7 @@
* This is the default RGB panel for the JColorChooser. The color is selected
* using three sliders that represent the RGB values.
*/
-public class DefaultRGBChooserPanel extends AbstractColorChooserPanel
+class DefaultRGBChooserPanel extends AbstractColorChooserPanel
{
/**
* This class handles the slider value changes for all three sliders.
Index: javax/swing/colorchooser/DefaultSwatchChooserPanel.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/colorchooser/DefaultSwatchChooserPanel.java,v
retrieving revision 1.1.2.2
diff -u -r1.1.2.2 DefaultSwatchChooserPanel.java
--- javax/swing/colorchooser/DefaultSwatchChooserPanel.java 22 Oct 2004 12:41:20 -0000 1.1.2.2
+++ javax/swing/colorchooser/DefaultSwatchChooserPanel.java 28 Jan 2005 09:41:04 -0000
@@ -1,5 +1,5 @@
/* DefaultSwatchChooserPanel.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -432,7 +432,7 @@
/**
* This class is the recent swatch panel. It holds recently selected colors.
*/
- public static class RecentSwatchPanel extends SwatchPanel
+ static class RecentSwatchPanel extends SwatchPanel
{
/** The array for storing recently stored colors. */
Color[] colors;
Index: javax/swing/event/MouseInputAdapter.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/event/MouseInputAdapter.java,v
retrieving revision 1.2
diff -u -r1.2 MouseInputAdapter.java
--- javax/swing/event/MouseInputAdapter.java 11 Jun 2003 13:20:40 -0000 1.2
+++ javax/swing/event/MouseInputAdapter.java 28 Jan 2005 09:41:04 -0000
@@ -1,5 +1,5 @@
/* MouseInputAdapter.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,72 +44,76 @@
* MouseInputAdapter
* @author Andrew Selkirk
*/
-public class MouseInputAdapter extends Object
- implements MouseInputListener {
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor MouseInputAdapter
- */
- public MouseInputAdapter() {
- } // MouseInputAdapter()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Mouse clicked
- * @param event Mouse event
- */
- public void mouseClicked(MouseEvent event) {
- } // mouseClicked()
-
- /**
- * Mouse dragged
- * @param event Mouse event
- */
- public void mouseDragged(MouseEvent event) {
- } // mouseDragged()
-
- /**
- * Mouse entered
- * @param event Mouse event
- */
- public void mouseEntered(MouseEvent event) {
- } // mouseEntered()
-
- /**
- * Mouse exited
- * @param event Mouse event
- */
- public void mouseExited(MouseEvent event) {
- } // mouseExited()
-
- /**
- * Mouse moved
- * @param event Mouse event
- */
- public void mouseMoved(MouseEvent event) {
- } // mouseMoved()
-
- /**
- * Mouse pressed
- * @param event Mouse event
- */
- public void mousePressed(MouseEvent event) {
- } // mousePressed()
-
- /**
- * Mouse released
- * @param event Mouse event
- */
- public void mouseReleased(MouseEvent event) {
- } // mouseReleased()
-
-
-} // MouseInputAdapterEvent
+public abstract class MouseInputAdapter implements MouseInputListener
+{
+ /**
+ * Constructor MouseInputAdapter
+ */
+ public MouseInputAdapter()
+ {
+ // Do nothing here.
+ }
+
+ /**
+ * Mouse clicked
+ * @param event Mouse event
+ */
+ public void mouseClicked(MouseEvent event)
+ {
+ // Do nothing by default.
+ }
+
+ /**
+ * Mouse dragged
+ * @param event Mouse event
+ */
+ public void mouseDragged(MouseEvent event)
+ {
+ // Do nothing by default.
+ }
+
+ /**
+ * Mouse entered
+ * @param event Mouse event
+ */
+ public void mouseEntered(MouseEvent event)
+ {
+ // Do nothing by default.
+ }
+
+ /**
+ * Mouse exited
+ * @param event Mouse event
+ */
+ public void mouseExited(MouseEvent event)
+ {
+ // Do nothing by default.
+ }
+
+ /**
+ * Mouse moved
+ * @param event Mouse event
+ */
+ public void mouseMoved(MouseEvent event)
+ {
+ // Do nothing by default.
+ }
+
+ /**
+ * Mouse pressed
+ * @param event Mouse event
+ */
+ public void mousePressed(MouseEvent event)
+ {
+ // Do nothing by default.
+ }
+
+ /**
+ * Mouse released
+ * @param event Mouse event
+ */
+ public void mouseReleased(MouseEvent event)
+ {
+ // Do nothing by default.
+ }
+}
Index: javax/swing/tree/DefaultMutableTreeNode.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/tree/DefaultMutableTreeNode.java,v
retrieving revision 1.4.14.2
diff -u -r1.4.14.2 DefaultMutableTreeNode.java
--- javax/swing/tree/DefaultMutableTreeNode.java 30 Nov 2004 20:17:33 -0000 1.4.14.2
+++ javax/swing/tree/DefaultMutableTreeNode.java 28 Jan 2005 09:41:04 -0000
@@ -1,5 +1,5 @@
/* DefaultMutableTreeNode.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.
@@ -502,33 +502,6 @@
return depth;
}
- static Random random = new Random(System.currentTimeMillis());
-
- public static void growTree(DefaultMutableTreeNode root)
- {
- DefaultMutableTreeNode node;
-
- DefaultMutableTreeNode current = root;
- int index = 0;
-
- do
- {
- if (random.nextBoolean())
- {
- node = new DefaultMutableTreeNode(String.valueOf(index));
- index++;
- current.add(node);
- current = node;
- }
- else
- {
- current = (DefaultMutableTreeNode) current.getParent();
- }
- }
- while (current != root
- && current != null);
- }
-
/**
* getLevel
*
More information about the Java-patches
mailing list