本文整理汇总了Java中java.awt.event.HierarchyBoundsListener类的典型用法代码示例。如果您正苦于以下问题:Java HierarchyBoundsListener类的具体用法?Java HierarchyBoundsListener怎么用?Java HierarchyBoundsListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
HierarchyBoundsListener类属于java.awt.event包,在下文中一共展示了HierarchyBoundsListener类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addHierarchyBoundsListener
import java.awt.event.HierarchyBoundsListener; //导入依赖的package包/类
/**
* Adds the specified listener to this component. This is harmless if the
* listener is null, but if the listener has already been registered, it
* will now be registered twice.
*
* @param listener the new listener to add
* @see HierarchyEvent
* @see #removeHierarchyBoundsListener(HierarchyBoundsListener)
* @see #getHierarchyBoundsListeners()
* @since 1.3
*/
public synchronized void
addHierarchyBoundsListener(HierarchyBoundsListener listener)
{
if (listener != null)
{
hierarchyBoundsListener =
AWTEventMulticaster.add(hierarchyBoundsListener, listener);
newEventsOnly = true;
// Need to lock the tree, otherwise we might end up inconsistent.
synchronized (getTreeLock())
{
numHierarchyBoundsListeners++;
if (parent != null)
parent.updateHierarchyListenerCount
(AWTEvent.HIERARCHY_BOUNDS_EVENT_MASK, 1);
}
}
}
示例2: removeHierarchyBoundsListener
import java.awt.event.HierarchyBoundsListener; //导入依赖的package包/类
/**
* Removes the specified listener from the component. This is harmless if
* the listener was not previously registered.
*
* @param listener the listener to remove
* @see HierarchyEvent
* @see #addHierarchyBoundsListener(HierarchyBoundsListener)
* @see #getHierarchyBoundsListeners()
* @since 1.3
*/
public synchronized void
removeHierarchyBoundsListener(HierarchyBoundsListener listener)
{
hierarchyBoundsListener =
AWTEventMulticaster.remove(hierarchyBoundsListener, listener);
// Need to lock the tree, otherwise we might end up inconsistent.
synchronized (getTreeLock())
{
numHierarchyBoundsListeners--;
if (parent != null)
parent.updateHierarchyListenerCount
(AWTEvent.HIERARCHY_BOUNDS_EVENT_MASK,
-1);
}
}
示例3: getListeners
import java.awt.event.HierarchyBoundsListener; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public <T extends EventListener> T[] getListeners(Class<T> listenerType) {
if (ComponentListener.class.isAssignableFrom(listenerType)) {
return (T[]) getComponentListeners();
} else if (FocusListener.class.isAssignableFrom(listenerType)) {
return (T[]) getFocusListeners();
} else if (HierarchyBoundsListener.class.isAssignableFrom(listenerType)) {
return (T[]) getHierarchyBoundsListeners();
} else if (HierarchyListener.class.isAssignableFrom(listenerType)) {
return (T[]) getHierarchyListeners();
} else if (InputMethodListener.class.isAssignableFrom(listenerType)) {
return (T[]) getInputMethodListeners();
} else if (KeyListener.class.isAssignableFrom(listenerType)) {
return (T[]) getKeyListeners();
} else if (MouseWheelListener.class.isAssignableFrom(listenerType)) {
return (T[]) getMouseWheelListeners();
} else if (MouseMotionListener.class.isAssignableFrom(listenerType)) {
return (T[]) getMouseMotionListeners();
} else if (MouseListener.class.isAssignableFrom(listenerType)) {
return (T[]) getMouseListeners();
} else if (PropertyChangeListener.class.isAssignableFrom(listenerType)) {
return (T[]) getPropertyChangeListeners();
}
return (T[]) Array.newInstance(listenerType, 0);
}
示例4: readObject
import java.awt.event.HierarchyBoundsListener; //导入依赖的package包/类
/**
* Deserializes this component. This regenerates all serializable listeners
* which were registered originally.
*
* @param s the stream to read from
* @throws ClassNotFoundException if deserialization fails
* @throws IOException if the stream fails
*/
private void readObject(ObjectInputStream s)
throws ClassNotFoundException, IOException
{
s.defaultReadObject();
String key = (String) s.readObject();
while (key != null)
{
Object listener = s.readObject();
if ("componentL".equals(key))
addComponentListener((ComponentListener) listener);
else if ("focusL".equals(key))
addFocusListener((FocusListener) listener);
else if ("keyL".equals(key))
addKeyListener((KeyListener) listener);
else if ("mouseL".equals(key))
addMouseListener((MouseListener) listener);
else if ("mouseMotionL".equals(key))
addMouseMotionListener((MouseMotionListener) listener);
else if ("inputMethodL".equals(key))
addInputMethodListener((InputMethodListener) listener);
else if ("hierarchyL".equals(key))
addHierarchyListener((HierarchyListener) listener);
else if ("hierarchyBoundsL".equals(key))
addHierarchyBoundsListener((HierarchyBoundsListener) listener);
else if ("mouseWheelL".equals(key))
addMouseWheelListener((MouseWheelListener) listener);
key = (String) s.readObject();
}
}
示例5: ancestorMoved
import java.awt.event.HierarchyBoundsListener; //导入依赖的package包/类
/**
* Called when an ancestor component of the source is moved.
*
* @param e the event describing the ancestor's motion
*/
public void ancestorMoved(HierarchyEvent e)
{
if (applet != null)
{
HierarchyBoundsListener[] l = applet.getHierarchyBoundsListeners();
for (int i = 0; i < l.length; i++)
l[i].ancestorMoved(e);
}
}
示例6: ancestorResized
import java.awt.event.HierarchyBoundsListener; //导入依赖的package包/类
/**
* Called when an ancestor component is resized.
*
* @param e the event describing the ancestor's resizing
*/
public void ancestorResized(HierarchyEvent e)
{
if (applet != null)
{
HierarchyBoundsListener[] l = applet.getHierarchyBoundsListeners();
for (int i = 0; i < l.length; i++)
l[i].ancestorResized(e);
}
}
示例7: ancestorMoved
import java.awt.event.HierarchyBoundsListener; //导入依赖的package包/类
public void ancestorMoved(HierarchyEvent e) {
if ((a != null) && (a instanceof HierarchyBoundsListener)) {
((HierarchyBoundsListener) a).ancestorMoved(e);
}
if ((b != null) && (b instanceof HierarchyBoundsListener)) {
((HierarchyBoundsListener) b).ancestorMoved(e);
}
}
示例8: ancestorResized
import java.awt.event.HierarchyBoundsListener; //导入依赖的package包/类
public void ancestorResized(HierarchyEvent e) {
if ((a != null) && (a instanceof HierarchyBoundsListener)) {
((HierarchyBoundsListener) a).ancestorResized(e);
}
if ((b != null) && (b instanceof HierarchyBoundsListener)) {
((HierarchyBoundsListener) b).ancestorResized(e);
}
}
示例9: processHierarchyBoundsEvent
import java.awt.event.HierarchyBoundsListener; //导入依赖的package包/类
protected void processHierarchyBoundsEvent(HierarchyEvent e) {
for (HierarchyBoundsListener listener : hierarchyBoundsListeners.getUserListeners()) {
switch (e.getID()) {
case HierarchyEvent.ANCESTOR_MOVED:
listener.ancestorMoved(e);
break;
case HierarchyEvent.ANCESTOR_RESIZED:
listener.ancestorResized(e);
break;
}
}
}