Imported GNU Classpath 0.19 + gcj-import-20051115.
* sources.am: Regenerated. * Makefile.in: Likewise. * scripts/makemake.tcl: Use glob -nocomplain. From-SVN: r107049
This commit is contained in:
parent
02e549bfaa
commit
8f523f3a10
1241 changed files with 97711 additions and 25284 deletions
|
@ -38,6 +38,7 @@ exception statement from your version. */
|
|||
|
||||
package java.awt;
|
||||
|
||||
import java.awt.event.ComponentListener;
|
||||
import java.awt.event.ContainerEvent;
|
||||
import java.awt.event.ContainerListener;
|
||||
import java.awt.event.KeyEvent;
|
||||
|
@ -394,17 +395,20 @@ public class Container extends Component
|
|||
layoutMgr.addLayoutComponent(null, comp);
|
||||
}
|
||||
|
||||
if (isShowing ())
|
||||
{
|
||||
// Post event to notify of adding the component.
|
||||
ContainerEvent ce = new ContainerEvent(this,
|
||||
ContainerEvent.COMPONENT_ADDED,
|
||||
comp);
|
||||
getToolkit().getSystemEventQueue().postEvent(ce);
|
||||
// We previously only sent an event when this container is showing.
|
||||
// Also, the event was posted to the event queue. A Mauve test shows
|
||||
// that this event is not delivered using the event queue and it is
|
||||
// also sent when the container is not showing.
|
||||
ContainerEvent ce = new ContainerEvent(this,
|
||||
ContainerEvent.COMPONENT_ADDED,
|
||||
comp);
|
||||
ContainerListener[] listeners = getContainerListeners();
|
||||
for (int i = 0; i < listeners.length; i++)
|
||||
listeners[i].componentAdded(ce);
|
||||
|
||||
// Repaint this container.
|
||||
repaint();
|
||||
}
|
||||
// Repaint this container.
|
||||
repaint(comp.getX(), comp.getY(), comp.getWidth(),
|
||||
comp.getHeight());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -419,6 +423,10 @@ public class Container extends Component
|
|||
{
|
||||
Component r = component[index];
|
||||
|
||||
ComponentListener[] list = r.getComponentListeners();
|
||||
for (int j = 0; j < list.length; j++)
|
||||
r.removeComponentListener(list[j]);
|
||||
|
||||
r.removeNotify();
|
||||
|
||||
System.arraycopy(component, index + 1, component, index,
|
||||
|
@ -730,7 +738,16 @@ public class Container extends Component
|
|||
*/
|
||||
public float getAlignmentX()
|
||||
{
|
||||
return super.getAlignmentX();
|
||||
LayoutManager layout = getLayout();
|
||||
float alignmentX = 0.0F;
|
||||
if (layout != null && layout instanceof LayoutManager2)
|
||||
{
|
||||
LayoutManager2 lm2 = (LayoutManager2) layout;
|
||||
alignmentX = lm2.getLayoutAlignmentX(this);
|
||||
}
|
||||
else
|
||||
alignmentX = super.getAlignmentX();
|
||||
return alignmentX;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -742,7 +759,16 @@ public class Container extends Component
|
|||
*/
|
||||
public float getAlignmentY()
|
||||
{
|
||||
return super.getAlignmentY();
|
||||
LayoutManager layout = getLayout();
|
||||
float alignmentY = 0.0F;
|
||||
if (layout != null && layout instanceof LayoutManager2)
|
||||
{
|
||||
LayoutManager2 lm2 = (LayoutManager2) layout;
|
||||
alignmentY = lm2.getLayoutAlignmentY(this);
|
||||
}
|
||||
else
|
||||
alignmentY = super.getAlignmentY();
|
||||
return alignmentY;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1047,6 +1073,53 @@ public class Container extends Component
|
|||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the visible child component that contains the specified position.
|
||||
* The top-most child is returned in the case where there is overlap.
|
||||
* If the top-most child is transparent and has no MouseListeners attached,
|
||||
* we discard it and return the next top-most component containing the
|
||||
* specified position.
|
||||
* @param x the x coordinate
|
||||
* @param y the y coordinate
|
||||
* @return null if the <code>this</code> does not contain the position,
|
||||
* otherwise the top-most component (out of this container itself and
|
||||
* its descendants) meeting the criteria above.
|
||||
*/
|
||||
Component findComponentForMouseEventAt(int x, int y)
|
||||
{
|
||||
synchronized (getTreeLock())
|
||||
{
|
||||
if (!contains(x, y))
|
||||
return null;
|
||||
|
||||
for (int i = 0; i < ncomponents; ++i)
|
||||
{
|
||||
// Ignore invisible children...
|
||||
if (!component[i].isVisible())
|
||||
continue;
|
||||
|
||||
int x2 = x - component[i].x;
|
||||
int y2 = y - component[i].y;
|
||||
// We don't do the contains() check right away because
|
||||
// findComponentAt would redundantly do it first thing.
|
||||
if (component[i] instanceof Container)
|
||||
{
|
||||
Container k = (Container) component[i];
|
||||
Component r = k.findComponentForMouseEventAt(x2, y2);
|
||||
if (r != null)
|
||||
return r;
|
||||
}
|
||||
else if (component[i].contains(x2, y2))
|
||||
return component[i];
|
||||
}
|
||||
|
||||
//don't return transparent components with no MouseListeners
|
||||
if (this.getMouseListeners().length == 0)
|
||||
return null;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public Component findComponentAt(Point p)
|
||||
{
|
||||
|
@ -1955,6 +2028,30 @@ class LightweightDispatcher implements Serializable
|
|||
eventMask |= l;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the deepest visible descendent of parent that contains the
|
||||
* specified location and that is not transparent and MouseListener-less.
|
||||
* @param parent the root component to begin the search
|
||||
* @param x the x coordinate
|
||||
* @param y the y coordinate
|
||||
* @return null if <code>parent</code> doesn't contain the location,
|
||||
* parent if parent is not a container or has no child that contains the
|
||||
* location, otherwise the appropriate component from the conditions
|
||||
* above.
|
||||
*/
|
||||
Component getDeepestComponentForMouseEventAt (
|
||||
Component parent, int x, int y)
|
||||
{
|
||||
if (parent == null || (! parent.contains(x, y)))
|
||||
return null;
|
||||
|
||||
if (! (parent instanceof Container))
|
||||
return parent;
|
||||
|
||||
Container c = (Container) parent;
|
||||
return c.findComponentForMouseEventAt(x, y);
|
||||
}
|
||||
|
||||
Component acquireComponentForMouseEvent(MouseEvent me)
|
||||
{
|
||||
int x = me.getX ();
|
||||
|
@ -1968,7 +2065,7 @@ class LightweightDispatcher implements Serializable
|
|||
while (candidate == null && parent != null)
|
||||
{
|
||||
candidate =
|
||||
AWTUtilities.getDeepestComponentAt(parent, p.x, p.y);
|
||||
getDeepestComponentForMouseEventAt(parent, p.x, p.y);
|
||||
if (candidate == null || (candidate.eventMask & me.getID()) == 0)
|
||||
{
|
||||
candidate = null;
|
||||
|
@ -2069,7 +2166,10 @@ class LightweightDispatcher implements Serializable
|
|||
// Don't dispatch CLICKED events whose target is not the same as the
|
||||
// target for the original PRESSED event.
|
||||
if (candidate != pressedComponent)
|
||||
mouseEventTarget = null;
|
||||
{
|
||||
mouseEventTarget = null;
|
||||
pressCount = 0;
|
||||
}
|
||||
else if (pressCount == 0)
|
||||
pressedComponent = null;
|
||||
}
|
||||
|
@ -2107,7 +2207,7 @@ class LightweightDispatcher implements Serializable
|
|||
pressedComponent = null;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
MouseEvent newEvt =
|
||||
AWTUtilities.convertMouseEvent(nativeContainer, me,
|
||||
mouseEventTarget);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue