/[classpath]/classpath/java/awt/Container.java
ViewVC logotype

Diff of /classpath/java/awt/Container.java

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

revision 1.37.2.17 by gnu_andrew, Wed Nov 2 21:44:47 2005 UTC revision 1.37.2.18 by gnu_andrew, Sun Nov 27 21:00:36 2005 UTC
# Line 125  public class Container extends Component Line 125  public class Container extends Component
125     */     */
126    public Container()    public Container()
127    {    {
128        // Nothing to do here.
129    }    }
130    
131    /**    /**
# Line 429  public class Container extends Component Line 430  public class Container extends Component
430          for (int j = 0; j < list.length; j++)          for (int j = 0; j < list.length; j++)
431                r.removeComponentListener(list[j]);                r.removeComponentListener(list[j]);
432                    
433          r.removeNotify();          if (r.isShowing())
434              r.removeNotify();
435    
436          System.arraycopy(component, index + 1, component, index,          System.arraycopy(component, index + 1, component, index,
437                           ncomponents - index - 1);                           ncomponents - index - 1);
# Line 740  public class Container extends Component Line 742  public class Container extends Component
742     */     */
743    public float getAlignmentX()    public float getAlignmentX()
744    {    {
745      return super.getAlignmentX();      LayoutManager layout = getLayout();
746        float alignmentX = 0.0F;
747        if (layout != null && layout instanceof LayoutManager2)
748          {
749            LayoutManager2 lm2 = (LayoutManager2) layout;
750            alignmentX = lm2.getLayoutAlignmentX(this);
751          }
752        else
753          alignmentX = super.getAlignmentX();
754        return alignmentX;
755    }    }
756    
757    /**    /**
# Line 752  public class Container extends Component Line 763  public class Container extends Component
763     */     */
764    public float getAlignmentY()    public float getAlignmentY()
765    {    {
766      return super.getAlignmentY();      LayoutManager layout = getLayout();
767        float alignmentY = 0.0F;
768        if (layout != null && layout instanceof LayoutManager2)
769          {
770            LayoutManager2 lm2 = (LayoutManager2) layout;
771            alignmentY = lm2.getLayoutAlignmentY(this);
772          }
773        else
774          alignmentY = super.getAlignmentY();
775        return alignmentY;
776    }    }
777    
778    /**    /**
# Line 830  public class Container extends Component Line 850  public class Container extends Component
850     */     */
851    public void paintComponents(Graphics g)    public void paintComponents(Graphics g)
852    {    {
853      super.paint(g);      paint(g);
854      visitChildren(g, GfxPaintAllVisitor.INSTANCE, true);      visitChildren(g, GfxPaintAllVisitor.INSTANCE, true);
855    }    }
856    
# Line 878  public class Container extends Component Line 898  public class Container extends Component
898    }    }
899    
900    /**    /**
901     * Returns an array of all the objects currently registered as FooListeners     * Returns all registered {@link EventListener}s of the given
902     * upon this Container. FooListeners are registered using the addFooListener     * <code>listenerType</code>.
    * method.  
    *  
    * @exception ClassCastException If listenerType doesn't specify a class or  
    * interface that implements @see java.util.EventListener.  
903     *     *
904       * @param listenerType the class of listeners to filter (<code>null</code>
905       *                     not permitted).
906       *                    
907       * @return An array of registered listeners.
908       *
909       * @throws ClassCastException if <code>listenerType</code> does not implement
910       *                            the {@link EventListener} interface.
911       * @throws NullPointerException if <code>listenerType</code> is
912       *                              <code>null</code>.
913       *                            
914       * @see #getContainerListeners()
915       *
916     * @since 1.3     * @since 1.3
917     */     */
918    public <T extends EventListener> T[] getListeners(Class<T> listenerType)    public <T extends EventListener> T[] getListeners(Class<T> listenerType)
# Line 1076  public class Container extends Component Line 1104  public class Container extends Component
1104        {        {
1105          if (!contains(x, y))          if (!contains(x, y))
1106            return null;            return null;
1107              
1108          for (int i = 0; i < ncomponents; ++i)          for (int i = 0; i < ncomponents; ++i)
1109            {            {
1110              // Ignore invisible children...              // Ignore invisible children...
# Line 1099  public class Container extends Component Line 1127  public class Container extends Component
1127            }            }
1128    
1129          //don't return transparent components with no MouseListeners          //don't return transparent components with no MouseListeners
1130          if (this.getMouseListeners().length == 0)          if (getMouseListeners().length == 0
1131                && getMouseMotionListeners().length == 0)
1132            return null;            return null;
1133          return this;          return this;
1134        }        }
# Line 1958  public class Container extends Component Line 1987  public class Container extends Component
1987         */         */
1988        protected AccessibleContainerHandler()        protected AccessibleContainerHandler()
1989        {        {
1990            // Nothing to do here.
1991        }        }
1992    
1993        /**        /**
# Line 2025  class LightweightDispatcher implements S Line 2055  class LightweightDispatcher implements S
2055     * location, otherwise the appropriate component from the conditions     * location, otherwise the appropriate component from the conditions
2056     * above.     * above.
2057     */     */
2058    Component getDeepestComponentForMouseEventAt (    Component getDeepestComponentForMouseEventAt(Component parent, int x, int y)
                                                               Component parent, int x, int y)  
2059    {    {
2060      if (parent == null || (! parent.contains(x, y)))      if (parent == null || (! parent.contains(x, y)))
2061        return null;        return null;
# Line 2050  class LightweightDispatcher implements S Line 2079  class LightweightDispatcher implements S
2079      Point p = me.getPoint();      Point p = me.getPoint();
2080      while (candidate == null && parent != null)      while (candidate == null && parent != null)
2081        {        {
2082          candidate =          candidate = getDeepestComponentForMouseEventAt(parent, p.x, p.y);
           getDeepestComponentForMouseEventAt(parent, p.x, p.y);  
2083          if (candidate == null || (candidate.eventMask & me.getID()) == 0)          if (candidate == null || (candidate.eventMask & me.getID()) == 0)
2084            {            {
2085              candidate = null;              candidate = null;
# Line 2133  class LightweightDispatcher implements S Line 2161  class LightweightDispatcher implements S
2161          break;          break;
2162        }        }
2163    
2164      if (me.getID() == MouseEvent.MOUSE_RELEASED      if (me.getID() == MouseEvent.MOUSE_PRESSED && modifiers > 0
         || me.getID() == MouseEvent.MOUSE_PRESSED && modifiers > 0  
2165          || me.getID() == MouseEvent.MOUSE_DRAGGED)          || me.getID() == MouseEvent.MOUSE_DRAGGED)
2166        {        {
2167          // If any of the following events occur while a button is held down,          // If any of the following events occur while a button is held down,
2168          // they should be dispatched to the same component to which the          // they should be dispatched to the same component to which the
2169          // original MOUSE_PRESSED event was dispatched:          // original MOUSE_PRESSED event was dispatched:
         //   - MOUSE_RELEASED  
2170          //   - MOUSE_PRESSED: another button pressed while the first is held          //   - MOUSE_PRESSED: another button pressed while the first is held
2171          //     down          //     down
2172          //   - MOUSE_DRAGGED          //   - MOUSE_DRAGGED
# Line 2152  class LightweightDispatcher implements S Line 2178  class LightweightDispatcher implements S
2178          // Don't dispatch CLICKED events whose target is not the same as the          // Don't dispatch CLICKED events whose target is not the same as the
2179          // target for the original PRESSED event.          // target for the original PRESSED event.
2180          if (candidate != pressedComponent)          if (candidate != pressedComponent)
2181            mouseEventTarget = null;            {
2182                mouseEventTarget = null;
2183                pressCount = 0;
2184              }
2185          else if (pressCount == 0)          else if (pressCount == 0)
2186            pressedComponent = null;            pressedComponent = null;
2187        }        }
# Line 2187  class LightweightDispatcher implements S Line 2216  class LightweightDispatcher implements S
2216                  // there is a CLICKED event after this, it will do clean up.                  // there is a CLICKED event after this, it will do clean up.
2217                  if (--pressCount == 0                  if (--pressCount == 0
2218                      && mouseEventTarget != pressedComponent)                      && mouseEventTarget != pressedComponent)
2219                    pressedComponent = null;                    {
2220                        pressedComponent = null;
2221                        pressCount = 0;
2222                      }
2223                  break;                  break;
2224                }                }
2225    

Legend:
Removed from v.1.37.2.17  
changed lines
  Added in v.1.37.2.18

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