Java Code Examples for java.awt.event.HierarchyEvent#getComponent()
The following examples show how to use
java.awt.event.HierarchyEvent#getComponent() .
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: FileNameController.java From netbeans with Apache License 2.0 | 6 votes |
@Override public void hierarchyChanged(HierarchyEvent e) { if ((e.getComponent() != txtComp) || ((e.getChangeFlags() & DISPLAYABILITY_CHANGED) == 0) || !txtComp.isDisplayable()) { return; } watcherLogger.finer("componentShown()"); //NOI18N if (foregroundColor == null) { foregroundColor = txtComp.getForeground(); } if ((doc.getLength() == 0) && !txtComp.isFocusOwner()) { displayInfo(); } }
Example 2
Source File: SwingSet3.java From littleluck with Apache License 2.0 | 6 votes |
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(); } }); } } }
Example 3
Source File: SwingSet3.java From beautyeye with Apache License 2.0 | 6 votes |
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(); } }); } } }
Example 4
Source File: SwingSet3.java From Darcula with Apache License 2.0 | 6 votes |
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(); } }); } } }
Example 5
Source File: BasicAudioPlayerUI.java From pumpernickel with MIT License | 5 votes |
@Override public void hierarchyChanged(HierarchyEvent e) { Component c = e.getComponent(); if (c instanceof AudioPlayerComponent) { AudioPlayerComponent jc = (AudioPlayerComponent) c; if (jc.getUI() instanceof BasicAudioPlayerUI) { ((BasicAudioPlayerUI) jc.getUI()) .updateComponents((AudioPlayerComponent) jc); } } }
Example 6
Source File: MainPanel.java From java-swing-tips with MIT License | 5 votes |
@Override public void hierarchyChanged(HierarchyEvent e) { if ((e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) != 0) { JLabel l = (JLabel) e.getComponent(); if (l.isShowing()) { // LOGGER.info(() -> "isShowing=true"); atomicDown.set(SECONDS); l.setText(String.format("Closing in %d seconds", SECONDS)); timer.removeActionListener(listener); listener = event -> { int i = atomicDown.decrementAndGet(); l.setText(String.format("Closing in %d seconds", i)); if (i <= 0 && timer.isRunning()) { // LOGGER.info(() -> "Timer: timer.stop()"); timer.stop(); Optional.ofNullable(l.getTopLevelAncestor()) .filter(Window.class::isInstance).map(Window.class::cast) .ifPresent(Window::dispose); // Container c = l.getTopLevelAncestor(); // if (c instanceof Window) { // // LOGGER.info(() -> "window.dispose()"); // ((Window) c).dispose(); // } } }; timer.addActionListener(listener); timer.start(); } else { // LOGGER.info(() -> "isShowing=false"); if (timer.isRunning()) { // LOGGER.info(() -> "timer.stop()"); timer.stop(); } } } }
Example 7
Source File: MainPanel.java From java-swing-tips with MIT License | 4 votes |
@Override public void hierarchyChanged(HierarchyEvent e) { Component c = e.getComponent(); if ((e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) != 0 && c.isShowing()) { EventQueue.invokeLater(c::requestFocusInWindow); } }
Example 8
Source File: GOSwingEventConverter.java From settlers-remake with MIT License | 4 votes |
@Override public void hierarchyChanged(HierarchyEvent hierarchyEvent) { Component component = hierarchyEvent.getComponent(); privateRegisterComponentListenerToParentWindowOf(component, component); }