classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] FYI: Added getLayer static method to javax.swing.JLayeredPa


From: Roman Kennke
Subject: [cp-patches] FYI: Added getLayer static method to javax.swing.JLayeredPane
Date: Mon, 23 May 2005 15:38:27 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021204

2005-05-23  Roman Kennke  <address@hidden>

       * javax/swing/JLayeredPane.java
       (getLayer): Added and implemented new (static) method.

/Roman

Index: javax/swing/JLayeredPane.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/JLayeredPane.java,v
retrieving revision 1.18
diff -u -r1.18 JLayeredPane.java
--- javax/swing/JLayeredPane.java       26 Jan 2005 20:57:45 -0000      1.18
+++ javax/swing/JLayeredPane.java       23 May 2005 13:36:27 -0000
@@ -130,6 +130,26 @@
   }
 
   /**
+   * Looks up the layer of <code>comp</code> in the component's nearest
+   * JLayeredPane ancestor. If <code>comp</code> is not contained
+   * in a JLayeredPane, the value 0 (default layer) is returned.
+   *
+   * @param comp the component for which the layer is looked up
+   *
+   * @return the layer of <code>comp</code> in its nearest JLayeredPane
+   *     ancestor
+   */
+  public static int getLayer(JComponent comp)
+  {
+    JLayeredPane lp = (JLayeredPane) SwingUtilities.getAncestorOfClass
+      (JLayeredPane.class, comp);
+    if (lp == null)
+      return 0;
+    else
+      return lp.getLayer(comp);
+  }
+
+  /**
    * <p>Returns a pair of ints representing a half-open interval 
    * <code>[top, bottom)</code>, which is the range of component indices 
    * the provided layer number corresponds to.</p>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]