/[classpath]/classpath/javax/swing/JLayeredPane.java
ViewVC logotype

Diff of /classpath/javax/swing/JLayeredPane.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.31 by rabbit78, Tue Oct 25 13:49:47 2005 UTC revision 1.32 by rabbit78, Tue Nov 8 12:28:57 2005 UTC
# Line 250  public class JLayeredPane extends JCompo Line 250  public class JLayeredPane extends JCompo
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    /**    /**
# Line 629  public class JLayeredPane extends JCompo Line 637  public class JLayeredPane extends JCompo
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;
# Line 643  public class JLayeredPane extends JCompo Line 651  public class JLayeredPane extends JCompo
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.

Legend:
Removed from v.1.31  
changed lines
  Added in v.1.32

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26