The attached patch fixes JLayeredPane.getLayer(). It now searches through the components parents first to find the component that is actually contained in the JLayeredPane. Otherwise we would get IllegalArgumentExceptions for all components that are only indirectly contained in a JLayeredPane.
2005-07-01 Roman Kennke <[EMAIL PROTECTED]> * javax/swing/JLayeredPane.java (getLayer): Also search through the components parents to find the one that is actually directly contained in the JLayeredPane. /Roman
Index: javax/swing/JLayeredPane.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/JLayeredPane.java,v retrieving revision 1.21 diff -u -r1.21 JLayeredPane.java --- javax/swing/JLayeredPane.java 30 May 2005 12:16:17 -0000 1.21 +++ javax/swing/JLayeredPane.java 1 Jul 2005 10:31:13 -0000 @@ -124,9 +124,18 @@ */ public int getLayer(Component c) { - if (! componentToLayer.containsKey (c)) - throw new IllegalArgumentException (); - return ((Integer) componentToLayer.get(c)).intValue(); + Component myComp = c; + while(! componentToLayer.containsKey(myComp)) + { + myComp = myComp.getParent(); + if (myComp == null) + break; + } + if (myComp == null) + throw new IllegalArgumentException + ("component is not in this JLayeredPane"); + Integer layerObj = (Integer) componentToLayer.get(myComp); + return layerObj.intValue(); } /**
_______________________________________________ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches