Java Code Examples for java.awt.Container#isShowing()
The following examples show how to use
java.awt.Container#isShowing() .
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: AnimatedLayout.java From pumpernickel with MIT License | 6 votes |
@Override public void layoutContainer(Container parent) { JComponent jc = (JComponent) parent; install(jc); Timer timer = (Timer) jc.getClientProperty(PROPERTY_TIMER); Boolean layoutImmediately = (Boolean) jc .getClientProperty(PROPERTY_LAYOUT_IMMEDIATELY); if (layoutImmediately == null) layoutImmediately = false; if (layoutImmediately) { layoutContainerImmediately(jc); if (parent.isShowing()) jc.putClientProperty(PROPERTY_LAYOUT_IMMEDIATELY, false); } else { if (!timer.isRunning()) timer.start(); } }
Example 2
Source File: SortingFocusTraversalPolicy.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private void enumerateAndSortCycle(Container focusCycleRoot, List<Component> cycle) { if (focusCycleRoot.isShowing()) { enumerateCycle(focusCycleRoot, cycle); if (!legacySortingFTPEnabled || !legacySort(cycle, comparator)) { Collections.sort(cycle, comparator); } } }
Example 3
Source File: SortingFocusTraversalPolicy.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
private void enumerateAndSortCycle(Container focusCycleRoot, List<Component> cycle) { if (focusCycleRoot.isShowing()) { enumerateCycle(focusCycleRoot, cycle); if (!legacySortingFTPEnabled || !legacySort(cycle, comparator)) { Collections.sort(cycle, comparator); } } }
Example 4
Source File: SortingFocusTraversalPolicy.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private void enumerateAndSortCycle(Container focusCycleRoot, List<Component> cycle) { if (focusCycleRoot.isShowing()) { enumerateCycle(focusCycleRoot, cycle); if (!legacySortingFTPEnabled || !legacySort(cycle, comparator)) { Collections.sort(cycle, comparator); } } }
Example 5
Source File: FocusArrowListener.java From PyramidShader with GNU General Public License v3.0 | 5 votes |
/** Returns a set of all the components that * can have the keyboard focus. * <P>My first implementation involved of this concept * simply involved asking JCompnonents if they were * focusable, but in the <code>FilledButtonTest</code> this * resulted in shifting focus to the ContentPane. Although * it is technically focusable: if I used the tab key * I did <i>not</i> get this result. So I studied * the inner workings for Component.transferFocus() * and ended up with a method that involved * calls to <code>getFocusCycleRootAncestor()</code>, * and <code>getFocusTraversalPolicy()</code>. * <P>(Also credit goes to Werner for originally tipping me off * towards looking at FocusTraversalPolicies.) * @param currentFocusOwner the current focus owner. * @return all the JComponents that can receive the focus. */ public static Set<Component> getFocusableComponents(Component currentFocusOwner) { HashSet<Component> set = new HashSet<Component>(); set.add(currentFocusOwner); Container rootAncestor = currentFocusOwner.getFocusCycleRootAncestor(); Component comp = currentFocusOwner; while (rootAncestor != null && !(rootAncestor.isShowing() && rootAncestor.isFocusable() && rootAncestor.isEnabled())) { comp = rootAncestor; rootAncestor = comp.getFocusCycleRootAncestor(); } if (rootAncestor != null) { FocusTraversalPolicy policy = rootAncestor.getFocusTraversalPolicy(); Component toFocus = policy.getComponentAfter(rootAncestor, comp); while(toFocus!=null && set.contains(toFocus)==false) { set.add(toFocus); toFocus = policy.getComponentAfter(rootAncestor, toFocus); } toFocus = policy.getComponentBefore(rootAncestor, comp); while(toFocus!=null && set.contains(toFocus)==false) { set.add(toFocus); toFocus = policy.getComponentBefore(rootAncestor, toFocus); } } return set; }
Example 6
Source File: FocusArrowListener.java From pumpernickel with MIT License | 5 votes |
/** * Returns a set of all the components that can have the keyboard focus. * <P> * My first implementation involved of this concept simply involved asking * JCompnonents if they were focusable, but in the * <code>FilledButtonTest</code> this resulted in shifting focus to the * ContentPane. Although it is technically focusable: if I used the tab key * I did <i>not</i> get this result. So I studied the inner workings for * Component.transferFocus() and ended up with a method that involved calls * to <code>getFocusCycleRootAncestor()</code>, and * <code>getFocusTraversalPolicy()</code>. * <P> * (Also credit goes to Werner for originally tipping me off towards looking * at FocusTraversalPolicies.) * * @param currentFocusOwner * the current focus owner. * @return all the JComponents that can receive the focus. */ public static Set<Component> getFocusableComponents( Component currentFocusOwner) { HashSet<Component> set = new HashSet<Component>(); set.add(currentFocusOwner); Container rootAncestor = currentFocusOwner.getFocusCycleRootAncestor(); Component comp = currentFocusOwner; while (rootAncestor != null && !(rootAncestor.isShowing() && rootAncestor.isFocusable() && rootAncestor .isEnabled())) { comp = rootAncestor; rootAncestor = comp.getFocusCycleRootAncestor(); } if (rootAncestor != null) { FocusTraversalPolicy policy = rootAncestor .getFocusTraversalPolicy(); Component toFocus = policy.getComponentAfter(rootAncestor, comp); while (toFocus != null && set.contains(toFocus) == false) { set.add(toFocus); toFocus = policy.getComponentAfter(rootAncestor, toFocus); } toFocus = policy.getComponentBefore(rootAncestor, comp); while (toFocus != null && set.contains(toFocus) == false) { set.add(toFocus); toFocus = policy.getComponentBefore(rootAncestor, toFocus); } } return set; }
Example 7
Source File: SortingFocusTraversalPolicy.java From hottub with GNU General Public License v2.0 | 5 votes |
private void enumerateAndSortCycle(Container focusCycleRoot, List<Component> cycle) { if (focusCycleRoot.isShowing()) { enumerateCycle(focusCycleRoot, cycle); if (!legacySortingFTPEnabled || !legacySort(cycle, comparator)) { Collections.sort(cycle, comparator); } } }
Example 8
Source File: SortingFocusTraversalPolicy.java From Java8CN with Apache License 2.0 | 5 votes |
private void enumerateAndSortCycle(Container focusCycleRoot, List<Component> cycle) { if (focusCycleRoot.isShowing()) { enumerateCycle(focusCycleRoot, cycle); if (!legacySortingFTPEnabled || !legacySort(cycle, comparator)) { Collections.sort(cycle, comparator); } } }
Example 9
Source File: FocusArrowListener.java From Pixelitor with GNU General Public License v3.0 | 5 votes |
/** * Returns a set of all the components that * can have the keyboard focus. * <P>My first implementation involved of this concept * simply involved asking JCompnonents if they were * focusable, but in the <code>FilledButtonTest</code> this * resulted in shifting focus to the ContentPane. Although * it is technically focusable: if I used the tab key * I did <i>not</i> get this result. So I studied * the inner workings for Component.transferFocus() * and ended up with a method that involved * calls to <code>getFocusCycleRootAncestor()</code>, * and <code>getFocusTraversalPolicy()</code>. * <P>(Also credit goes to Werner for originally tipping me off * towards looking at FocusTraversalPolicies.) * * @param currentFocusOwner the current focus owner. * @return all the JComponents that can receive the focus. */ public static Set<Component> getFocusableComponents(Component currentFocusOwner) { Set<Component> set = new HashSet<>(); set.add(currentFocusOwner); Container rootAncestor = currentFocusOwner.getFocusCycleRootAncestor(); Component comp = currentFocusOwner; while (rootAncestor != null && !(rootAncestor.isShowing() && rootAncestor.isFocusable() && rootAncestor.isEnabled())) { comp = rootAncestor; rootAncestor = comp.getFocusCycleRootAncestor(); } if (rootAncestor != null) { FocusTraversalPolicy policy = rootAncestor.getFocusTraversalPolicy(); Component toFocus = policy.getComponentAfter(rootAncestor, comp); while (toFocus != null && !set.contains(toFocus)) { set.add(toFocus); toFocus = policy.getComponentAfter(rootAncestor, toFocus); } toFocus = policy.getComponentBefore(rootAncestor, comp); while (toFocus != null && !set.contains(toFocus)) { set.add(toFocus); toFocus = policy.getComponentBefore(rootAncestor, toFocus); } } return set; }
Example 10
Source File: SortingFocusTraversalPolicy.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private void enumerateAndSortCycle(Container focusCycleRoot, List<Component> cycle) { if (focusCycleRoot.isShowing()) { enumerateCycle(focusCycleRoot, cycle); if (legacySortingFTPEnabled) { legacySort(cycle, comparator); } else { cycle.sort(comparator); } } }
Example 11
Source File: SortingFocusTraversalPolicy.java From Bytecoder with Apache License 2.0 | 5 votes |
private void enumerateAndSortCycle(Container focusCycleRoot, List<Component> cycle) { if (focusCycleRoot.isShowing()) { enumerateCycle(focusCycleRoot, cycle); if (legacySortingFTPEnabled) { legacySort(cycle, comparator); } else { cycle.sort(comparator); } } }
Example 12
Source File: SortingFocusTraversalPolicy.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private void enumerateAndSortCycle(Container focusCycleRoot, List<Component> cycle) { if (focusCycleRoot.isShowing()) { enumerateCycle(focusCycleRoot, cycle); if (!legacySortingFTPEnabled || !legacySort(cycle, comparator)) { Collections.sort(cycle, comparator); } } }
Example 13
Source File: PrintAction.java From netbeans with Apache License 2.0 | 5 votes |
private void findPrintable(Container container, List<JComponent> printable) { if (container.isShowing() && isPrintable(container)) { printable.add((JComponent) container); } Component[] children = container.getComponents(); for (Component child : children) { if (child instanceof Container) { findPrintable((Container) child, printable); } } }
Example 14
Source File: SortingFocusTraversalPolicy.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private void enumerateAndSortCycle(Container focusCycleRoot, List<Component> cycle) { if (focusCycleRoot.isShowing()) { enumerateCycle(focusCycleRoot, cycle); if (!legacySortingFTPEnabled || !legacySort(cycle, comparator)) { Collections.sort(cycle, comparator); } } }
Example 15
Source File: SortingFocusTraversalPolicy.java From JDKSourceCode1.8 with MIT License | 5 votes |
private void enumerateAndSortCycle(Container focusCycleRoot, List<Component> cycle) { if (focusCycleRoot.isShowing()) { enumerateCycle(focusCycleRoot, cycle); if (!legacySortingFTPEnabled || !legacySort(cycle, comparator)) { Collections.sort(cycle, comparator); } } }
Example 16
Source File: SortingFocusTraversalPolicy.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
private void enumerateAndSortCycle(Container focusCycleRoot, List<Component> cycle) { if (focusCycleRoot.isShowing()) { enumerateCycle(focusCycleRoot, cycle); if (!legacySortingFTPEnabled || !legacySort(cycle, comparator)) { Collections.sort(cycle, comparator); } } }
Example 17
Source File: SortingFocusTraversalPolicy.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private void enumerateAndSortCycle(Container focusCycleRoot, List<Component> cycle) { if (focusCycleRoot.isShowing()) { enumerateCycle(focusCycleRoot, cycle); if (!legacySortingFTPEnabled || !legacySort(cycle, comparator)) { Collections.sort(cycle, comparator); } } }
Example 18
Source File: SortingFocusTraversalPolicy.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
private void enumerateAndSortCycle(Container focusCycleRoot, List<Component> cycle) { if (focusCycleRoot.isShowing()) { enumerateCycle(focusCycleRoot, cycle); if (!legacySortingFTPEnabled || !legacySort(cycle, comparator)) { Collections.sort(cycle, comparator); } } }
Example 19
Source File: SortingFocusTraversalPolicy.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
private void enumerateAndSortCycle(Container focusCycleRoot, List<Component> cycle) { if (focusCycleRoot.isShowing()) { enumerateCycle(focusCycleRoot, cycle); Collections.sort(cycle, comparator); } }
Example 20
Source File: SortingFocusTraversalPolicy.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
private void enumerateAndSortCycle(Container focusCycleRoot, List<Component> cycle) { if (focusCycleRoot.isShowing()) { enumerateCycle(focusCycleRoot, cycle); Collections.sort(cycle, comparator); } }