Java Code Examples for java.awt.event.HierarchyEvent#DISPLAYABILITY_CHANGED

The following examples show how to use java.awt.event.HierarchyEvent#DISPLAYABILITY_CHANGED . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WindowsMenuBarUI.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void installListeners() {
    if (WindowsLookAndFeel.isOnVista()) {
        installWindowListener();
        hierarchyListener =
            new HierarchyListener() {
                public void hierarchyChanged(HierarchyEvent e) {
                    if ((e.getChangeFlags()
                            & HierarchyEvent.DISPLAYABILITY_CHANGED) != 0) {
                        if (menuBar.isDisplayable()) {
                            installWindowListener();
                        } else {
                            uninstallWindowListener();
                        }
                    }
                }
        };
        menuBar.addHierarchyListener(hierarchyListener);
    }
    super.installListeners();
}
 
Example 2
Source File: WindowsMenuBarUI.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
@Override
protected void installListeners() {
    if (WindowsLookAndFeel.isOnVista()) {
        installWindowListener();
        hierarchyListener =
            new HierarchyListener() {
                public void hierarchyChanged(HierarchyEvent e) {
                    if ((e.getChangeFlags()
                            & HierarchyEvent.DISPLAYABILITY_CHANGED) != 0) {
                        if (menuBar.isDisplayable()) {
                            installWindowListener();
                        } else {
                            uninstallWindowListener();
                        }
                    }
                }
        };
        menuBar.addHierarchyListener(hierarchyListener);
    }
    super.installListeners();
}
 
Example 3
Source File: WindowsMenuBarUI.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void installListeners() {
    if (WindowsLookAndFeel.isOnVista()) {
        installWindowListener();
        hierarchyListener =
            new HierarchyListener() {
                public void hierarchyChanged(HierarchyEvent e) {
                    if ((e.getChangeFlags()
                            & HierarchyEvent.DISPLAYABILITY_CHANGED) != 0) {
                        if (menuBar.isDisplayable()) {
                            installWindowListener();
                        } else {
                            uninstallWindowListener();
                        }
                    }
                }
        };
        menuBar.addHierarchyListener(hierarchyListener);
    }
    super.installListeners();
}
 
Example 4
Source File: WindowsMenuBarUI.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
@Override
protected void installListeners() {
    if (WindowsLookAndFeel.isOnVista()) {
        installWindowListener();
        hierarchyListener =
            new HierarchyListener() {
                public void hierarchyChanged(HierarchyEvent e) {
                    if ((e.getChangeFlags()
                            & HierarchyEvent.DISPLAYABILITY_CHANGED) != 0) {
                        if (menuBar.isDisplayable()) {
                            installWindowListener();
                        } else {
                            uninstallWindowListener();
                        }
                    }
                }
        };
        menuBar.addHierarchyListener(hierarchyListener);
    }
    super.installListeners();
}
 
Example 5
Source File: WindowsMenuBarUI.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void installListeners() {
    if (WindowsLookAndFeel.isOnVista()) {
        installWindowListener();
        hierarchyListener =
            new HierarchyListener() {
                public void hierarchyChanged(HierarchyEvent e) {
                    if ((e.getChangeFlags()
                            & HierarchyEvent.DISPLAYABILITY_CHANGED) != 0) {
                        if (menuBar.isDisplayable()) {
                            installWindowListener();
                        } else {
                            uninstallWindowListener();
                        }
                    }
                }
        };
        menuBar.addHierarchyListener(hierarchyListener);
    }
    super.installListeners();
}
 
Example 6
Source File: WindowsMenuBarUI.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void installListeners() {
    if (WindowsLookAndFeel.isOnVista()) {
        installWindowListener();
        hierarchyListener =
            new HierarchyListener() {
                public void hierarchyChanged(HierarchyEvent e) {
                    if ((e.getChangeFlags()
                            & HierarchyEvent.DISPLAYABILITY_CHANGED) != 0) {
                        if (menuBar.isDisplayable()) {
                            installWindowListener();
                        } else {
                            uninstallWindowListener();
                        }
                    }
                }
        };
        menuBar.addHierarchyListener(hierarchyListener);
    }
    super.installListeners();
}
 
Example 7
Source File: WindowsMenuBarUI.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void installListeners() {
    if (WindowsLookAndFeel.isOnVista()) {
        installWindowListener();
        hierarchyListener =
            new HierarchyListener() {
                public void hierarchyChanged(HierarchyEvent e) {
                    if ((e.getChangeFlags()
                            & HierarchyEvent.DISPLAYABILITY_CHANGED) != 0) {
                        if (menuBar.isDisplayable()) {
                            installWindowListener();
                        } else {
                            uninstallWindowListener();
                        }
                    }
                }
        };
        menuBar.addHierarchyListener(hierarchyListener);
    }
    super.installListeners();
}
 
Example 8
Source File: WindowsMenuBarUI.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void installListeners() {
    if (WindowsLookAndFeel.isOnVista()) {
        installWindowListener();
        hierarchyListener =
            new HierarchyListener() {
                public void hierarchyChanged(HierarchyEvent e) {
                    if ((e.getChangeFlags()
                            & HierarchyEvent.DISPLAYABILITY_CHANGED) != 0) {
                        if (menuBar.isDisplayable()) {
                            installWindowListener();
                        } else {
                            uninstallWindowListener();
                        }
                    }
                }
        };
        menuBar.addHierarchyListener(hierarchyListener);
    }
    super.installListeners();
}
 
Example 9
Source File: WindowsMenuBarUI.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void installListeners() {
    if (WindowsLookAndFeel.isOnVista()) {
        installWindowListener();
        hierarchyListener =
            new HierarchyListener() {
                public void hierarchyChanged(HierarchyEvent e) {
                    if ((e.getChangeFlags()
                            & HierarchyEvent.DISPLAYABILITY_CHANGED) != 0) {
                        if (menuBar.isDisplayable()) {
                            installWindowListener();
                        } else {
                            uninstallWindowListener();
                        }
                    }
                }
        };
        menuBar.addHierarchyListener(hierarchyListener);
    }
    super.installListeners();
}
 
Example 10
Source File: ThreeDeeView.java    From WorldPainter with GNU General Public License v3.0 6 votes vote down vote up
@Override
    public void hierarchyChanged(HierarchyEvent event) {
        if ((event.getChangeFlags() & HierarchyEvent.DISPLAYABILITY_CHANGED) != 0) {
            if (isDisplayable()) {
//                for (Tile tile: dimension.getTiles()) {
//                    threeDeeRenderManager.renderTile(tile);
//                }
                timer = new Timer(250, this);
                timer.start();
            } else {
                timer.stop();
                timer = null;
                threeDeeRenderManager.stop();
                for (Tile tile : dimension.getTiles()) {
                    tile.removeListener(this);
                }
                dimension.removeDimensionListener(this);
            }
        }
    }
 
Example 11
Source File: MainPanel.java    From java-swing-tips with MIT License 5 votes vote down vote up
@Override public void hierarchyChanged(HierarchyEvent e) {
  boolean isDisplayableChanged = (e.getChangeFlags() & HierarchyEvent.DISPLAYABILITY_CHANGED) != 0;
  if (isDisplayableChanged && !e.getComponent().isDisplayable() && Objects.nonNull(worker)) {
    System.out.println("DISPOSE_ON_CLOSE");
    worker.cancel(true);
    worker = null;
  }
}
 
Example 12
Source File: MainPanel.java    From java-swing-tips with MIT License 5 votes vote down vote up
@Override public void hierarchyChanged(HierarchyEvent e) {
  boolean isDisplayableChanged = (e.getChangeFlags() & HierarchyEvent.DISPLAYABILITY_CHANGED) != 0;
  if (isDisplayableChanged && !e.getComponent().isDisplayable() && Objects.nonNull(worker)) {
    System.out.println("DISPOSE_ON_CLOSE");
    worker.cancel(true);
    worker = null;
  }
}
 
Example 13
Source File: JExtendedSplitPane.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
public void hierarchyChanged(HierarchyEvent e) {
    if ((e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) != 0 ||
        (e.getChangeFlags() & HierarchyEvent.DISPLAYABILITY_CHANGED) != 0) {
        
        boolean visible = c.isVisible();
        if (wasVisible == visible) return;

        wasVisible = visible;

        if (visible) componentShown();
        else componentHidden(c);
    }
}
 
Example 14
Source File: MainPanel.java    From java-swing-tips with MIT License 5 votes vote down vote up
@Override public void updateUI() {
  removeHierarchyListener(handler);
  super.updateUI();
  handler = e -> {
    boolean isDisplayableChanged = (e.getChangeFlags() & HierarchyEvent.DISPLAYABILITY_CHANGED) != 0;
    if (isDisplayableChanged && Objects.nonNull(timer) && !e.getComponent().isDisplayable()) {
      System.out.println("case DISPOSE_ON_CLOSE: hierarchyChanged");
      timer.stop();
    }
  };
  addHierarchyListener(handler);
}
 
Example 15
Source File: MainPanel.java    From java-swing-tips with MIT License 5 votes vote down vote up
@Override public void hierarchyChanged(HierarchyEvent e) {
  if ((e.getChangeFlags() & HierarchyEvent.DISPLAYABILITY_CHANGED) != 0) {
    if (e.getComponent().isDisplayable()) {
      animator.start();
    } else {
      animator.stop();
    }
  }
}
 
Example 16
Source File: MainPanel.java    From java-swing-tips with MIT License 5 votes vote down vote up
@Override public void hierarchyChanged(HierarchyEvent e) {
  boolean isDisplayableChanged = (e.getChangeFlags() & HierarchyEvent.DISPLAYABILITY_CHANGED) != 0;
  if (isDisplayableChanged && !e.getComponent().isDisplayable() && Objects.nonNull(worker)) {
    System.out.println("DISPOSE_ON_CLOSE");
    worker.cancel(true);
    worker = null;
  }
}
 
Example 17
Source File: MainPanel.java    From java-swing-tips with MIT License 4 votes vote down vote up
@Override public void hierarchyChanged(HierarchyEvent e) {
  if ((e.getChangeFlags() & HierarchyEvent.DISPLAYABILITY_CHANGED) != 0 && !e.getComponent().isDisplayable()) {
    animator.stop();
  }
}
 
Example 18
Source File: MainPanel.java    From java-swing-tips with MIT License 4 votes vote down vote up
@Override public void hierarchyChanged(HierarchyEvent e) {
  if ((e.getChangeFlags() & HierarchyEvent.DISPLAYABILITY_CHANGED) != 0 && !e.getComponent().isDisplayable()) {
    scroller.stop();
    scroller.removeActionListener(listener);
  }
}
 
Example 19
Source File: MainPanel.java    From java-swing-tips with MIT License 4 votes vote down vote up
@Override public void hierarchyChanged(HierarchyEvent e) {
  boolean isDisplayableChanged = (e.getChangeFlags() & HierarchyEvent.DISPLAYABILITY_CHANGED) != 0;
  if (isDisplayableChanged && !e.getComponent().isDisplayable()) {
    animator.stop();
  }
}
 
Example 20
Source File: MainPanel.java    From java-swing-tips with MIT License 4 votes vote down vote up
@Override public void hierarchyChanged(HierarchyEvent e) {
  if ((e.getChangeFlags() & HierarchyEvent.DISPLAYABILITY_CHANGED) != 0 && !e.getComponent().isDisplayable()) {
    inside.stop();
    outside.stop();
  }
}