/[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.13.2.8 by gnu_andrew, Tue Sep 20 18:46:31 2005 UTC revision 1.13.2.9 by gnu_andrew, Wed Nov 2 00:43:46 2005 UTC
# Line 40  package javax.swing; Line 40  package javax.swing;
40    
41  import java.awt.Component;  import java.awt.Component;
42  import java.awt.Container;  import java.awt.Container;
43    import java.awt.Graphics;
44  import java.util.Hashtable;  import java.util.Hashtable;
45  import java.util.Iterator;  import java.util.Iterator;
46  import java.util.Map;  import java.util.Map;
# Line 164  public class JLayeredPane extends JCompo Line 165  public class JLayeredPane extends JCompo
165      setLayout(null);      setLayout(null);
166    }    }
167    
   
168    /**    /**
169     * Looks up the layer a child component is currently assigned to.     * Looks up the layer a child component is currently assigned to.
170     *     *
# Line 272  public class JLayeredPane extends JCompo Line 272  public class JLayeredPane extends JCompo
272     * Increments the recorded size of a given layer.     * Increments the recorded size of a given layer.
273     *     *
274     * @param layer the layer number to increment.     * @param layer the layer number to increment.
275     * @see #incrLayer()     * @see #incrLayer
276     */     */
277    private void incrLayer(Integer layer)    private void incrLayer(Integer layer)
278    {    {
# Line 286  public class JLayeredPane extends JCompo Line 286  public class JLayeredPane extends JCompo
286     * Decrements the recorded size of a given layer.     * Decrements the recorded size of a given layer.
287     *     *
288     * @param layer the layer number to decrement.     * @param layer the layer number to decrement.
289     * @see #decrLayer()     * @see #incrLayer
290     */     */
291    private void decrLayer(Integer layer)    private void decrLayer(Integer layer)
292    {    {
# Line 573  public class JLayeredPane extends JCompo Line 573  public class JLayeredPane extends JCompo
573     *     *
574     * @param index the index of the child component to remove.     * @param index the index of the child component to remove.
575     */     */
576    public void remove (int index)    public void remove(int index)
577    {    {
578      Component c = getComponent (index);      Component c = getComponent(index);
579      int layer = getLayer (c);      int layer = getLayer(c);
580      decrLayer (new Integer(layer));      decrLayer(new Integer(layer));
581      componentToLayer.remove (c);      componentToLayer.remove(c);
582      super.remove (index);      super.remove(index);
583        // FIXME: Figure out if this call is correct.
584      revalidate();      revalidate();
     repaint();  
   }  
   
   /**  
    * Removes a child from this container. The child is specified directly.  
    * After removal, the child no longer occupies a layer.  
    *  
    * @param comp the child to remove.  
    */  
   public void remove (Component comp)  
   {  
     remove (getIndexOf (comp));  
585    }    }
586    
587    /**    /**
# Line 655  public class JLayeredPane extends JCompo Line 644  public class JLayeredPane extends JCompo
644      incrLayer (layer);      incrLayer (layer);
645                    
646      super.addImpl(comp, null, newIdx);        super.addImpl(comp, null, newIdx);  
     revalidate();  
     repaint();  
647    }        }    
648    
649    /**    /**
# Line 681  public class JLayeredPane extends JCompo Line 668  public class JLayeredPane extends JCompo
668        accessibleContext = new AccessibleJLayeredPane();        accessibleContext = new AccessibleJLayeredPane();
669      return accessibleContext;      return accessibleContext;
670    }    }
671    
672      /**
673       * This method is overridden order to provide a reasonable painting
674       * mechanism for <code>JLayeredPane</code>. This is necessary since
675       * <code>JLayeredPane</code>'s do not have an own UI delegate.
676       *
677       * Basically this method clears the background for the
678       * <code>JLayeredPane</code> and then calls <code>super.paint(g)</code>.
679       *
680       * @param g the graphics context to use
681       */
682      public void paint(Graphics g)
683      {
684        g.setColor(getBackground());
685        g.fillRect(0, 0, getWidth(), getHeight());
686        super.paint(g);
687      }
688    
689      /**
690       * Overridden to return <code>false</code>, since <code>JLayeredPane</code>
691       * cannot guarantee that its children don't overlap.
692       *
693       * @return <code>false</code>
694       */
695      public boolean isOptimizedDrawingEnabled()
696      {
697        return false;
698      }
699  }  }

Legend:
Removed from v.1.13.2.8  
changed lines
  Added in v.1.13.2.9

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