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]

Re: [PATCH] swing frame fixes


Sascha Brawer <brawer@dandelis.ch> writes:

> Do you have any Mauve test code for your class? This question may sound
> malicious, but I really think that we all should writing more test cases.
> (This includes myself, I finally should clean up my test suite for
> java.util.logging).

ok, I've attached a testcase for mauve which gives JLayeredPane class
(also attached) a good workout; I tested this on sun's jdk and my own
code, and picked a bunch of bugs out of both the test and my own code
as a result.

also I javadoc'ed all the methods, as you requested. one additional
hunk is required, a change to java.awt.Container, to permit in-place
child component swapping:

--- Container.java      10 Aug 2003 09:26:55 -0000      1.22
+++ Container.java      28 Nov 2003 03:21:16 -0000
@@ -159,6 +160,25 @@
   }
 
   /**
+   * Swaps the components at position i and j, in the container.
+   */
+
+  protected void swapComponents (int i, int j)
+  {   
+    synchronized (getTreeLock ())
+      {
+        if (i < 0 
+            || i >= component.length
+            || j < 0 
+            || j >= component.length)
+          throw new ArrayIndexOutOfBoundsException ();
+        Component tmp = component[i];
+        component[i] = component[j];
+        component[j] = tmp;
+      }
+  }


ok to commit this, along with the frame changes previously posted?
(and also: if anyone has write access to mauve, feel like committing
the testcase?)

-graydon

Attachment: JLayeredPane.java
Description: Binary data

Attachment: JLayeredPane.java
Description: Binary data


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