java.awt.Container#isShowing ( )源码实例Demo

下面列出了java.awt.Container#isShowing ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: pumpernickel   文件: AnimatedLayout.java
@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();
	}
}
 
源代码2 项目: Pixelitor   文件: FocusArrowListener.java
/**
 * 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;
}
 
private void enumerateAndSortCycle(Container focusCycleRoot, List<Component> cycle) {
    if (focusCycleRoot.isShowing()) {
        enumerateCycle(focusCycleRoot, cycle);
        if (!legacySortingFTPEnabled ||
            !legacySort(cycle, comparator))
        {
            Collections.sort(cycle, comparator);
        }
    }
}
 
private void enumerateAndSortCycle(Container focusCycleRoot, List<Component> cycle) {
    if (focusCycleRoot.isShowing()) {
        enumerateCycle(focusCycleRoot, cycle);
        if (!legacySortingFTPEnabled ||
            !legacySort(cycle, comparator))
        {
            Collections.sort(cycle, comparator);
        }
    }
}
 
源代码5 项目: jdk8u60   文件: SortingFocusTraversalPolicy.java
private void enumerateAndSortCycle(Container focusCycleRoot, List<Component> cycle) {
    if (focusCycleRoot.isShowing()) {
        enumerateCycle(focusCycleRoot, cycle);
        if (!legacySortingFTPEnabled ||
            !legacySort(cycle, comparator))
        {
            Collections.sort(cycle, comparator);
        }
    }
}
 
private void enumerateAndSortCycle(Container focusCycleRoot, List<Component> cycle) {
    if (focusCycleRoot.isShowing()) {
        enumerateCycle(focusCycleRoot, cycle);
        if (!legacySortingFTPEnabled ||
            !legacySort(cycle, comparator))
        {
            Collections.sort(cycle, comparator);
        }
    }
}
 
private void enumerateAndSortCycle(Container focusCycleRoot, List<Component> cycle) {
    if (focusCycleRoot.isShowing()) {
        enumerateCycle(focusCycleRoot, cycle);
        if (!legacySortingFTPEnabled ||
            !legacySort(cycle, comparator))
        {
            Collections.sort(cycle, comparator);
        }
    }
}
 
源代码8 项目: netbeans   文件: PrintAction.java
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);
        }
    }
}
 
private void enumerateAndSortCycle(Container focusCycleRoot, List<Component> cycle) {
    if (focusCycleRoot.isShowing()) {
        enumerateCycle(focusCycleRoot, cycle);
        if (!legacySortingFTPEnabled ||
            !legacySort(cycle, comparator))
        {
            Collections.sort(cycle, comparator);
        }
    }
}
 
源代码10 项目: Bytecoder   文件: SortingFocusTraversalPolicy.java
private void enumerateAndSortCycle(Container focusCycleRoot, List<Component> cycle) {
    if (focusCycleRoot.isShowing()) {
        enumerateCycle(focusCycleRoot, cycle);
        if (legacySortingFTPEnabled) {
            legacySort(cycle, comparator);
        } else {
            cycle.sort(comparator);
        }
    }
}
 
源代码11 项目: openjdk-jdk9   文件: SortingFocusTraversalPolicy.java
private void enumerateAndSortCycle(Container focusCycleRoot, List<Component> cycle) {
    if (focusCycleRoot.isShowing()) {
        enumerateCycle(focusCycleRoot, cycle);
        if (legacySortingFTPEnabled) {
            legacySort(cycle, comparator);
        } else {
            cycle.sort(comparator);
        }
    }
}
 
源代码12 项目: jdk8u-jdk   文件: SortingFocusTraversalPolicy.java
private void enumerateAndSortCycle(Container focusCycleRoot, List<Component> cycle) {
    if (focusCycleRoot.isShowing()) {
        enumerateCycle(focusCycleRoot, cycle);
        if (!legacySortingFTPEnabled ||
            !legacySort(cycle, comparator))
        {
            Collections.sort(cycle, comparator);
        }
    }
}
 
源代码13 项目: Java8CN   文件: SortingFocusTraversalPolicy.java
private void enumerateAndSortCycle(Container focusCycleRoot, List<Component> cycle) {
    if (focusCycleRoot.isShowing()) {
        enumerateCycle(focusCycleRoot, cycle);
        if (!legacySortingFTPEnabled ||
            !legacySort(cycle, comparator))
        {
            Collections.sort(cycle, comparator);
        }
    }
}
 
源代码14 项目: hottub   文件: SortingFocusTraversalPolicy.java
private void enumerateAndSortCycle(Container focusCycleRoot, List<Component> cycle) {
    if (focusCycleRoot.isShowing()) {
        enumerateCycle(focusCycleRoot, cycle);
        if (!legacySortingFTPEnabled ||
            !legacySort(cycle, comparator))
        {
            Collections.sort(cycle, comparator);
        }
    }
}
 
源代码15 项目: pumpernickel   文件: FocusArrowListener.java
/**
 * 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;
}
 
源代码16 项目: PyramidShader   文件: FocusArrowListener.java
/** 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;
}
 
源代码17 项目: jdk8u-jdk   文件: SortingFocusTraversalPolicy.java
private void enumerateAndSortCycle(Container focusCycleRoot, List<Component> cycle) {
    if (focusCycleRoot.isShowing()) {
        enumerateCycle(focusCycleRoot, cycle);
        if (!legacySortingFTPEnabled ||
            !legacySort(cycle, comparator))
        {
            Collections.sort(cycle, comparator);
        }
    }
}
 
private void enumerateAndSortCycle(Container focusCycleRoot, List<Component> cycle) {
    if (focusCycleRoot.isShowing()) {
        enumerateCycle(focusCycleRoot, cycle);
        if (!legacySortingFTPEnabled ||
            !legacySort(cycle, comparator))
        {
            Collections.sort(cycle, comparator);
        }
    }
}
 
private void enumerateAndSortCycle(Container focusCycleRoot, List<Component> cycle) {
    if (focusCycleRoot.isShowing()) {
        enumerateCycle(focusCycleRoot, cycle);
        Collections.sort(cycle, comparator);
    }
}
 
源代码20 项目: openjdk-8   文件: SortingFocusTraversalPolicy.java
private void enumerateAndSortCycle(Container focusCycleRoot, List<Component> cycle) {
    if (focusCycleRoot.isShowing()) {
        enumerateCycle(focusCycleRoot, cycle);
        Collections.sort(cycle, comparator);
    }
}