250 |
ret[1] = getComponents ().length; |
ret[1] = getComponents ().length; |
251 |
Iterator i = layers.entrySet ().iterator (); |
Iterator i = layers.entrySet ().iterator (); |
252 |
while (i.hasNext()) |
while (i.hasNext()) |
253 |
{ |
{ |
254 |
Map.Entry pair = (Map.Entry) i.next(); |
Map.Entry pair = (Map.Entry) i.next(); |
255 |
Integer layerNum = (Integer) pair.getKey (); |
Integer layerNum = (Integer) pair.getKey (); |
256 |
Integer layerSz = (Integer) pair.getValue (); |
Integer layerSz = (Integer) pair.getValue (); |
257 |
if (layerNum.intValue() == layer.intValue()) |
int layerInt = layerNum.intValue(); |
258 |
|
if (layerInt == layer.intValue()) |
259 |
{ |
{ |
260 |
ret[0] = ret[1] - layerSz.intValue (); |
ret[0] = ret[1] - layerSz.intValue (); |
261 |
return ret; |
break; |
262 |
|
} |
263 |
|
// In the following case there exists no layer with the specified |
264 |
|
// number, so we return an empty interval here with the index at which |
265 |
|
// such a layer would be inserted |
266 |
|
else if (layerInt > layer.intValue()) |
267 |
|
{ |
268 |
|
ret[1] = ret[0]; |
269 |
|
break; |
270 |
} |
} |
271 |
else |
else |
272 |
{ |
{ |
273 |
ret[1] -= layerSz.intValue (); |
ret[1] -= layerSz.intValue (); |
274 |
} |
} |
275 |
} |
} |
276 |
// should have found the layer during iteration |
return ret; |
|
throw new IllegalArgumentException (); |
|
277 |
} |
} |
278 |
|
|
279 |
/** |
/** |
637 |
* @param index an ignored parameter, for compatibility. |
* @param index an ignored parameter, for compatibility. |
638 |
*/ |
*/ |
639 |
protected void addImpl(Component comp, Object layerConstraint, int index) |
protected void addImpl(Component comp, Object layerConstraint, int index) |
640 |
{ |
{ |
641 |
Integer layer; |
Integer layer; |
642 |
if (layerConstraint != null && layerConstraint instanceof Integer) |
if (layerConstraint != null && layerConstraint instanceof Integer) |
643 |
layer = (Integer) layerConstraint; |
layer = (Integer) layerConstraint; |
651 |
componentToLayer.put (comp, layer); |
componentToLayer.put (comp, layer); |
652 |
incrLayer (layer); |
incrLayer (layer); |
653 |
|
|
654 |
super.addImpl(comp, null, newIdx); |
super.addImpl(comp, null, newIdx); |
655 |
} |
} |
656 |
|
|
657 |
/** |
/** |
658 |
* Sets the layer property for a JComponent. |
* Sets the layer property for a JComponent. |