本文整理匯總了Java中java.awt.event.HierarchyEvent.SHOWING_CHANGED屬性的典型用法代碼示例。如果您正苦於以下問題:Java HierarchyEvent.SHOWING_CHANGED屬性的具體用法?Java HierarchyEvent.SHOWING_CHANGED怎麽用?Java HierarchyEvent.SHOWING_CHANGED使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類java.awt.event.HierarchyEvent
的用法示例。
在下文中一共展示了HierarchyEvent.SHOWING_CHANGED屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: hierarchyChanged
public void hierarchyChanged(HierarchyEvent e) {
if ((e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) != 0) {
boolean showing = container.isShowing();
if (showing != bug4924561knownShowing) {
if (container.isShowing()) {
initDisplayer();
attachModelAndSelectionListeners();
ensureSelectedComponentIsShowing();
if (container.getType() == TabbedContainer.TYPE_SLIDING) {
updateOrientation();
}
} else {
detachModelAndSelectionListeners();
if (container.getType() == TabbedContainer.TYPE_SLIDING) {
updateOrientation();
}
}
}
bug4924561knownShowing = showing;
}
}
示例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: hierarchyChanged
public void hierarchyChanged(HierarchyEvent event) {
if ((event.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) > 0) {
JComponent component = (JComponent)event.getComponent();
final Demo demo = (Demo)component.getClientProperty("swingset3.demo");
if (!component.isShowing()) {
demo.stop();
} else {
demoContainer.revalidate();
EventQueue.invokeLater(new Runnable() {
public void run() {
demo.start();
}
});
}
}
}
示例4: hierarchyChanged
public void hierarchyChanged(@NotNull HierarchyEvent e) {
if (isDisposed()) return;
if ((e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) > 0) {
final Runnable runnable = new DumbAwareRunnable() {
public void run() {
final Component c = myComponent.get();
if (isDisposed() || c == null) return;
if (c.isShowing()) {
showNotify();
}
else {
hideNotify();
}
}
};
final Application app = ApplicationManager.getApplication();
if (app != null && app.isDispatchThread()) {
app.invokeLater(runnable, ModalityState.current());
} else {
//noinspection SSBasedInspection
SwingUtilities.invokeLater(runnable);
}
}
}
示例5: hierarchyChanged
@Override
public void hierarchyChanged(HierarchyEvent hierarchyEvent) {
if ((hierarchyEvent.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) != 0) {
// We only want to listen to VFS_CHANGES events when the tool window is opened.
if (myTree.isShowing()) {
if (myConnection == null) {
myConnection = myProject.getMessageBus().connect(myProject);
myConnection.subscribe(VirtualFileManager.VFS_CHANGES, this);
}
}
else {
if (myConnection != null) {
myConnection.disconnect();
myConnection = null;
}
}
}
}
示例6: hierarchyChanged
public void hierarchyChanged(HierarchyEvent event) {
if ((event.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) > 0) {
JComponent component = (JComponent)event.getComponent();
final Demo demo = (Demo)component.getClientProperty("swingset3.demo");
if (!component.isShowing()) {
demo.stop();
} else {
getComponentByConstraint("demo").revalidate();
EventQueue.invokeLater(new Runnable() {
public void run() {
demo.start();
}
});
}
}
}
示例7: finishHierarchyChange
void finishHierarchyChange(Component changed, Container changedParent, int ancestorFlags) {
if (--hierarchyChangingCounter == 0) {
int changeFlags = ancestorFlags;
if (wasShowing != isShowing()) {
changeFlags |= HierarchyEvent.SHOWING_CHANGED;
}
if (wasDisplayable != isDisplayable()) {
changeFlags |= HierarchyEvent.DISPLAYABILITY_CHANGED;
}
if (changeFlags > 0) {
postEvent(new HierarchyEvent(this, HierarchyEvent.HIERARCHY_CHANGED, changed,
changedParent, changeFlags));
}
finishChildrenHierarchyChange(changed, changedParent, ancestorFlags);
}
}
示例8: hierarchyChanged
public void hierarchyChanged(HierarchyEvent e) {
if (isDisposed()) return;
if ((e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) > 0) {
final Runnable runnable = new DumbAwareRunnable() {
public void run() {
final Component c = myComponent.get();
if (isDisposed() || c == null) return;
if (c.isShowing()) {
showNotify();
}
else {
hideNotify();
}
}
};
final Application app = ApplicationManager.getApplication();
if (app != null && app.isDispatchThread()) {
app.invokeLater(runnable, ModalityState.current());
} else {
//noinspection SSBasedInspection
SwingUtilities.invokeLater(runnable);
}
}
}
示例9: hierarchyChanged
public void hierarchyChanged(HierarchyEvent e) {
if ((e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) != 0) {
Window window = SwingUtilities.getWindowAncestor(this);
if (window instanceof Dialog && !((Dialog) window).isModal()) {
showFromEditor();
} else {
hideFromEditor();
}
}
}
示例10: createListener
private HierarchyListener createListener() {
return new HierarchyListener() {
public void hierarchyChanged(HierarchyEvent e) {
if ((e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) != 0) {
boolean visible = component.isShowing();
if (wasVisible == visible) return;
wasVisible = visible;
if (visible) shown();
else hidden();
}
}
};
}
示例11: hierarchyChanged
public void hierarchyChanged(HierarchyEvent e) {
JPanel fieldsBrowserPanel = instancesController.getFieldsBrowserController().getPanel();
JPanel referencesBrowserPanel = instancesController.getReferencesBrowserController().getPanel();
if ((e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) != 0) {
legendPanel.setGCRootVisible(referencesBrowserPanel.isShowing());
legendPanel.setVisible(fieldsBrowserPanel.isShowing() || referencesBrowserPanel.isShowing());
}
}
示例12: hierarchyChanged
@Override
public void hierarchyChanged(HierarchyEvent e) {
// update whenever the component visibility changes, the view is dirty (prior updates
// have been ignored), and not more than one update is scheduled
synchronized (updateLock) {
if ((HierarchyEvent.SHOWING_CHANGED & e.getChangeFlags()) != 0 && isDirty && scheduledUpdates <= 1) {
scheduledUpdates++;
SwingUtilities.invokeLater(updateEntries);
}
}
}
示例13: hierarchyChanged
@Override
public void hierarchyChanged(HierarchyEvent e) {
if ((e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) != 0) {
if (!list.isShowing()) {
lastLocation = null;
setHoverIndex(-1);
}
// else: nothing to be done as mouse location is not known (only 1.5)
}
}
示例14: addNotify
/**
* Called when the parent of this Component is made visible or when
* the Component is added to an already visible Container and needs
* to be shown. A native peer - if any - is created at this
* time. This method is called automatically by the AWT system and
* should not be called by user level code.
*
* @see #isDisplayable()
* @see #removeNotify()
*/
public void addNotify()
{
// We need to lock the tree here to avoid races and inconsistencies.
synchronized (getTreeLock())
{
if (peer == null)
peer = getToolkit().createComponent(this);
else if (parent != null && parent.isLightweight())
new HeavyweightInLightweightListener(parent);
// Now that all the children has gotten their peers, we should
// have the event mask needed for this component and its
//lightweight subcomponents.
peer.setEventMask(eventMask);
// We used to leave the invalidate() to the peer. However, I put it
// back here for 2 reasons: 1) The RI does call invalidate() from
// addNotify(); 2) The peer shouldn't be bother with validation too
// much.
invalidate();
if (dropTarget != null)
dropTarget.addNotify(peer);
// Fetch the peerFont for later installation in validate().
peerFont = getFont();
// Notify hierarchy listeners.
long flags = HierarchyEvent.DISPLAYABILITY_CHANGED;
if (isHierarchyVisible())
flags |= HierarchyEvent.SHOWING_CHANGED;
fireHierarchyEvent(HierarchyEvent.HIERARCHY_CHANGED, this, parent,
flags);
}
}
示例15: removeNotify
/**
* Called to inform this component is has been removed from its
* container. Its native peer - if any - is destroyed at this time.
* This method is called automatically by the AWT system and should
* not be called by user level code.
*
* @see #isDisplayable()
* @see #addNotify()
*/
public void removeNotify()
{
// We need to lock the tree here to avoid races and inconsistencies.
synchronized (getTreeLock())
{
// We null our peer field before disposing of it, such that if we're
// not the event dispatch thread and the dispatch thread is awoken by
// the dispose call, there will be no race checking the peer's null
// status.
ComponentPeer tmp = peer;
peer = null;
peerFont = null;
if (tmp != null)
{
tmp.hide();
tmp.dispose();
}
// Notify hierarchy listeners.
long flags = HierarchyEvent.DISPLAYABILITY_CHANGED;
if (isHierarchyVisible())
flags |= HierarchyEvent.SHOWING_CHANGED;
fireHierarchyEvent(HierarchyEvent.HIERARCHY_CHANGED, this, parent,
flags);
}
}