[PATCH] swing frame fixes
graydon hoare
graydon@redhat.com
Fri Nov 28 03:31:00 GMT 2003
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: JLayeredPane.java
Type: application/octet-stream
Size: 17694 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/java-patches/attachments/20031128/bea3033d/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: JLayeredPane.java
Type: application/octet-stream
Size: 3702 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/java-patches/attachments/20031128/bea3033d/attachment-0001.obj>
More information about the Java-patches
mailing list