本文整理汇总了Java中java.awt.Container.isFocusCycleRoot方法的典型用法代码示例。如果您正苦于以下问题:Java Container.isFocusCycleRoot方法的具体用法?Java Container.isFocusCycleRoot怎么用?Java Container.isFocusCycleRoot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.Container
的用法示例。
在下文中一共展示了Container.isFocusCycleRoot方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: focusSpinnerIfNecessary
import java.awt.Container; //导入方法依赖的package包/类
/**
* Requests focus on a child of the spinner if the spinner doesn't have
* focus.
*/
private void focusSpinnerIfNecessary()
{
Component fo = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
if( spinner.isRequestFocusEnabled() && (fo == null || !SwingUtilities.isDescendingFrom(fo, spinner)) )
{
Container root = spinner;
if( !root.isFocusCycleRoot() )
{
root = root.getFocusCycleRootAncestor();
}
if( root != null )
{
FocusTraversalPolicy ftp = root.getFocusTraversalPolicy();
Component child = ftp.getComponentAfter(root, spinner);
if( child != null && SwingUtilities.isDescendingFrom(child, spinner) )
{
child.requestFocus();
}
}
}
}
示例2: getComponentAfter
import java.awt.Container; //导入方法依赖的package包/类
public Component getComponentAfter(Container aContainer,
Component aComponent)
{
Container root = (aContainer.isFocusCycleRoot())
? aContainer
: aContainer.getFocusCycleRootAncestor();
// Support for mixed 1.4/pre-1.4 focus APIs. If a particular root's
// traversal policy is non-legacy, then honor it.
if (root != null) {
FocusTraversalPolicy policy = root.getFocusTraversalPolicy();
if (policy != gluePolicy) {
return policy.getComponentAfter(root, aComponent);
}
comparator.setComponentOrientation(root.getComponentOrientation());
return layoutPolicy.getComponentAfter(root, aComponent);
}
return null;
}
示例3: getComponentBefore
import java.awt.Container; //导入方法依赖的package包/类
public Component getComponentBefore(Container aContainer,
Component aComponent)
{
Container root = (aContainer.isFocusCycleRoot())
? aContainer
: aContainer.getFocusCycleRootAncestor();
// Support for mixed 1.4/pre-1.4 focus APIs. If a particular root's
// traversal policy is non-legacy, then honor it.
if (root != null) {
FocusTraversalPolicy policy = root.getFocusTraversalPolicy();
if (policy != gluePolicy) {
return policy.getComponentBefore(root, aComponent);
}
comparator.setComponentOrientation(root.getComponentOrientation());
return layoutPolicy.getComponentBefore(root, aComponent);
}
return null;
}
示例4: getFirstComponent
import java.awt.Container; //导入方法依赖的package包/类
public Component getFirstComponent(Container aContainer) {
Container root = (aContainer.isFocusCycleRoot())
? aContainer
: aContainer.getFocusCycleRootAncestor();
// Support for mixed 1.4/pre-1.4 focus APIs. If a particular root's
// traversal policy is non-legacy, then honor it.
if (root != null) {
FocusTraversalPolicy policy = root.getFocusTraversalPolicy();
if (policy != gluePolicy) {
return policy.getFirstComponent(root);
}
comparator.setComponentOrientation(root.getComponentOrientation());
return layoutPolicy.getFirstComponent(root);
}
return null;
}
示例5: getLastComponent
import java.awt.Container; //导入方法依赖的package包/类
public Component getLastComponent(Container aContainer) {
Container root = (aContainer.isFocusCycleRoot())
? aContainer
: aContainer.getFocusCycleRootAncestor();
// Support for mixed 1.4/pre-1.4 focus APIs. If a particular root's
// traversal policy is non-legacy, then honor it.
if (root != null) {
FocusTraversalPolicy policy = root.getFocusTraversalPolicy();
if (policy != gluePolicy) {
return policy.getLastComponent(root);
}
comparator.setComponentOrientation(root.getComponentOrientation());
return layoutPolicy.getLastComponent(root);
}
return null;
}
示例6: enumerateCycle
import java.awt.Container; //导入方法依赖的package包/类
private void enumerateCycle(Container container, List<Component> cycle) {
if (!(container.isVisible() && container.isDisplayable())) {
return;
}
cycle.add(container);
Component[] components = container.getComponents();
for (Component comp : components) {
if (comp instanceof Container) {
Container cont = (Container)comp;
if (!cont.isFocusCycleRoot() &&
!cont.isFocusTraversalPolicyProvider() &&
!((cont instanceof JComponent) && ((JComponent)cont).isManagingFocus()))
{
enumerateCycle(cont, cycle);
continue;
}
}
cycle.add(comp);
}
}
示例7: getComponentAfter
import java.awt.Container; //导入方法依赖的package包/类
/**
* Returns the component after.
* @return the component after
* @param aContainer a container
* @param aComponent a component
*/
public Component getComponentAfter(Container aContainer,
Component aComponent)
{
Container root = (aContainer.isFocusCycleRoot())
? aContainer
: aContainer.getFocusCycleRootAncestor();
// Support for mixed 1.4/pre-1.4 focus APIs. If a particular root's
// traversal policy is non-legacy, then honor it.
if (root != null) {
FocusTraversalPolicy policy = root.getFocusTraversalPolicy();
if (policy != gluePolicy) {
return policy.getComponentAfter(root, aComponent);
}
comparator.setComponentOrientation(root.getComponentOrientation());
return layoutPolicy.getComponentAfter(root, aComponent);
}
return null;
}
示例8: getComponentBefore
import java.awt.Container; //导入方法依赖的package包/类
/**
* Returns the component before.
* @return the component before
* @param aContainer a container
* @param aComponent a component
*/
public Component getComponentBefore(Container aContainer,
Component aComponent)
{
Container root = (aContainer.isFocusCycleRoot())
? aContainer
: aContainer.getFocusCycleRootAncestor();
// Support for mixed 1.4/pre-1.4 focus APIs. If a particular root's
// traversal policy is non-legacy, then honor it.
if (root != null) {
FocusTraversalPolicy policy = root.getFocusTraversalPolicy();
if (policy != gluePolicy) {
return policy.getComponentBefore(root, aComponent);
}
comparator.setComponentOrientation(root.getComponentOrientation());
return layoutPolicy.getComponentBefore(root, aComponent);
}
return null;
}
示例9: getFirstComponent
import java.awt.Container; //导入方法依赖的package包/类
/**
* Returns the first component.
* @return the first component
* @param aContainer a container
*/
public Component getFirstComponent(Container aContainer) {
Container root = (aContainer.isFocusCycleRoot())
? aContainer
: aContainer.getFocusCycleRootAncestor();
// Support for mixed 1.4/pre-1.4 focus APIs. If a particular root's
// traversal policy is non-legacy, then honor it.
if (root != null) {
FocusTraversalPolicy policy = root.getFocusTraversalPolicy();
if (policy != gluePolicy) {
return policy.getFirstComponent(root);
}
comparator.setComponentOrientation(root.getComponentOrientation());
return layoutPolicy.getFirstComponent(root);
}
return null;
}
示例10: getLastComponent
import java.awt.Container; //导入方法依赖的package包/类
/**
* Returns the last component.
* @return the last component
* @param aContainer a container
*/
public Component getLastComponent(Container aContainer) {
Container root = (aContainer.isFocusCycleRoot())
? aContainer
: aContainer.getFocusCycleRootAncestor();
// Support for mixed 1.4/pre-1.4 focus APIs. If a particular root's
// traversal policy is non-legacy, then honor it.
if (root != null) {
FocusTraversalPolicy policy = root.getFocusTraversalPolicy();
if (policy != gluePolicy) {
return policy.getLastComponent(root);
}
comparator.setComponentOrientation(root.getComponentOrientation());
return layoutPolicy.getLastComponent(root);
}
return null;
}
示例11: enumerateCycle
import java.awt.Container; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
private void enumerateCycle(Container container, List<Component> cycle) {
if (!(container.isVisible() && container.isDisplayable())) {
return;
}
cycle.add(container);
Component[] components = container.getComponents();
for (Component comp : components) {
if (comp instanceof Container) {
Container cont = (Container)comp;
if (!cont.isFocusCycleRoot() &&
!cont.isFocusTraversalPolicyProvider() &&
!((cont instanceof JComponent) && ((JComponent)cont).isManagingFocus()))
{
enumerateCycle(cont, cycle);
continue;
}
}
cycle.add(comp);
}
}
示例12: getComponentDownCycle
import java.awt.Container; //导入方法依赖的package包/类
private Component getComponentDownCycle(Component comp, int traversalDirection) {
Component retComp = null;
if (comp instanceof Container) {
Container cont = (Container)comp;
if (cont.isFocusCycleRoot()) {
if (getImplicitDownCycleTraversal()) {
retComp = cont.getFocusTraversalPolicy().getDefaultComponent(cont);
if (retComp != null && log.isLoggable(PlatformLogger.Level.FINE)) {
log.fine("### Transfered focus down-cycle to " + retComp +
" in the focus cycle root " + cont);
}
} else {
return null;
}
} else if (cont.isFocusTraversalPolicyProvider()) {
retComp = (traversalDirection == FORWARD_TRAVERSAL ?
cont.getFocusTraversalPolicy().getDefaultComponent(cont) :
cont.getFocusTraversalPolicy().getLastComponent(cont));
if (retComp != null && log.isLoggable(PlatformLogger.Level.FINE)) {
log.fine("### Transfered focus to " + retComp + " in the FTP provider " + cont);
}
}
}
return retComp;
}