146 |
if (lp == null) |
if (lp == null) |
147 |
return 0; |
return 0; |
148 |
else |
else |
149 |
return lp.getLayer(comp); |
// The cast here forces the call to the instance method getLayer() |
150 |
|
// instead of the static method (this would lead to infinite |
151 |
|
// recursion). |
152 |
|
return lp.getLayer((Component) comp); |
153 |
|
} |
154 |
|
|
155 |
|
/** |
156 |
|
* Returns the first JLayeredPane that contains the Component |
157 |
|
* <code>comp</code> or <code>null</code> if <code>comp</code> is |
158 |
|
* not contained in a JLayeredPane. |
159 |
|
* |
160 |
|
* @param comp the component for which we are searching the JLayeredPane |
161 |
|
* ancestor |
162 |
|
* |
163 |
|
* @return the first JLayeredPane that contains the Component |
164 |
|
* <code>comp</code> or <code>null</code> if <code>comp</code> is |
165 |
|
* not contained in a JLayeredPane |
166 |
|
*/ |
167 |
|
public static JLayeredPane getLayeredPaneAbove(Component comp) |
168 |
|
{ |
169 |
|
JLayeredPane lp = (JLayeredPane) SwingUtilities.getAncestorOfClass |
170 |
|
(JLayeredPane.class, comp); |
171 |
|
return lp; |
172 |
} |
} |
173 |
|
|
174 |
/** |
/** |