本文整理汇总了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;
}