本文整理匯總了Java中java.awt.event.HierarchyEvent.PARENT_CHANGED屬性的典型用法代碼示例。如果您正苦於以下問題:Java HierarchyEvent.PARENT_CHANGED屬性的具體用法?Java HierarchyEvent.PARENT_CHANGED怎麽用?Java HierarchyEvent.PARENT_CHANGED使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類java.awt.event.HierarchyEvent
的用法示例。
在下文中一共展示了HierarchyEvent.PARENT_CHANGED屬性的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: eventDispatched
public void eventDispatched(AWTEvent event) {
HierarchyEvent e = (HierarchyEvent) event;
if ((e.getChangeFlags() & HierarchyEvent.PARENT_CHANGED) != 0) {
Component c = e.getChanged();
Container p = c.getParent();
if (p == null) {
// Component was removed from the hierarchy
components.remove(c);
} else {
Throwable t = new RuntimeException();
StringWriter sw = new StringWriter();
t.printStackTrace(new PrintWriter(sw));
String stackTrace = sw.toString();
String stackLine = getComponentAddStackLine(stackTrace);
components.put(c, stackLine);
}
}
}
示例2: hierarchyChanged
public void hierarchyChanged(HierarchyEvent e) {
if ((e.getChangeFlags() & HierarchyEvent.PARENT_CHANGED) != 0) {
Window parentWindow = SwingUtilities.getWindowAncestor(BufferedCanvasComponent.this);
if (lastParentWindow != parentWindow) {
if (lastParentWindow != null) lastParentWindow.removeWindowListener(VisibilityHandler.this);
if (parentWindow != null) parentWindow.addWindowListener(VisibilityHandler.this);
lastParentWindow = parentWindow;
}
}
if ((e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) != 0) {
if (isShowing()) BufferedCanvasComponent.this.shown();
else BufferedCanvasComponent.this.hidden();
}
}
示例3: createHierarchyListener
private final HierarchyListener createHierarchyListener()
{
return new HierarchyListener()
{
@Override
public void hierarchyChanged(HierarchyEvent e)
{
if (e.getChangeFlags() == HierarchyEvent.PARENT_CHANGED)
{
configureColumnControl();
}
}
};
}
示例4: hierarchyChanged
@Override
public void hierarchyChanged(HierarchyEvent e) {
if ((e.getChangeFlags() & HierarchyEvent.PARENT_CHANGED) == 0) {
return;
}
// the component may be reparented, usually in the same execution sequence
// within an event. Let's update (suspend or resume) the changes depending on
// the stabilized state in a next AWT event:
if (updating) {
return;
}
updating = true;
SwingUtilities.invokeLater(this);
}
示例5: hierarchyChanged
@Override
public void hierarchyChanged(final HierarchyEvent event) {
if ((event.getChangeFlags() & HierarchyEvent.PARENT_CHANGED) != 0 && event.getChangedParent() == null) {
this.splitPane.removeHierarchyListener(this);
this.splitPane.removePropertyChangeListener(this);
}
}
示例6: hierarchyChanged
@Override
public void hierarchyChanged(final HierarchyEvent e) {
if ((e.getChangeFlags() & HierarchyEvent.PARENT_CHANGED) == HierarchyEvent.PARENT_CHANGED) {
if (jViewport != null) {
jViewport.removeComponentListener(this);
}
jViewport = getParentViewport();
if (jViewport != null) {
jViewport.addComponentListener(this);
}
}
}
示例7: hierarchyChanged
/**
* Called when the hierarchy has been changed. To discern the actual
* type of change, call <code>HierarchyEvent.getChangeFlags()</code>.
* @see java.awt.event.HierarchyEvent#getChangeFlags()
*/
public void hierarchyChanged(HierarchyEvent e) {
if ((e.getChangeFlags() & HierarchyEvent.PARENT_CHANGED) != 0) {
createPopupWindow();
Container frame = textComponent.getTopLevelAncestor();
if (frame != null){
frame.addComponentListener(componentListener);
}
}
}
示例8: hierarchyChanged
/**
*
* @param e
*/
public void hierarchyChanged(HierarchyEvent e) {
if ((e.getChangeFlags() & HierarchyEvent.PARENT_CHANGED) != 0) {
attach();
}
}
示例9: isParentChange
private boolean isParentChange(HierarchyEvent evt) {
if(evt.getID()!=HierarchyEvent.HIERARCHY_CHANGED || evt.getChangeFlags()!=HierarchyEvent.PARENT_CHANGED)
return false;
return true;
}