本文整理汇总了Java中java.awt.Container.isFocusTraversalPolicyProvider方法的典型用法代码示例。如果您正苦于以下问题:Java Container.isFocusTraversalPolicyProvider方法的具体用法?Java Container.isFocusTraversalPolicyProvider怎么用?Java Container.isFocusTraversalPolicyProvider使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.Container
的用法示例。
在下文中一共展示了Container.isFocusTraversalPolicyProvider方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
}
示例2: 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);
}
}
示例3: getTopmostProvider
import java.awt.Container; //导入方法依赖的package包/类
Container getTopmostProvider(Container focusCycleRoot, Component aComponent) {
Container aCont = aComponent.getParent();
Container ftp = null;
while (aCont != focusCycleRoot && aCont != null) {
if (aCont.isFocusTraversalPolicyProvider()) {
ftp = aCont;
}
aCont = aCont.getParent();
}
if (aCont == null) {
return null;
}
return ftp;
}
示例4: 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;
}
示例5: getLastComponent
import java.awt.Container; //导入方法依赖的package包/类
/**
* Returns the last Component in the traversal cycle. This method is used
* to determine the next Component to focus when traversal wraps in the
* reverse direction.
*
* @param aContainer a focus cycle root of aComponent or a focus traversal policy provider whose
* last Component is to be returned
* @return the last Component in the traversal cycle of aContainer,
* or null if no suitable Component can be found
* @throws IllegalArgumentException if aContainer is null
*/
public Component getLastComponent(Container aContainer) {
List<Component> cycle;
if (log.isLoggable(PlatformLogger.Level.FINE)) {
log.fine("### Getting last component in " + aContainer);
}
if (aContainer == null) {
throw new IllegalArgumentException("aContainer cannot be null");
}
if (this.cachedRoot == aContainer) {
cycle = this.cachedCycle;
} else {
cycle = getFocusTraversalCycle(aContainer);
}
if (cycle.size() == 0) {
if (log.isLoggable(PlatformLogger.Level.FINE)) {
log.fine("### Cycle is empty");
}
return null;
}
if (log.isLoggable(PlatformLogger.Level.FINE)) {
log.fine("### Cycle is " + cycle);
}
for (int i= cycle.size() - 1; i >= 0; i--) {
Component comp = cycle.get(i);
if (accept(comp)) {
return comp;
} else if (comp instanceof Container && comp != aContainer) {
Container cont = (Container)comp;
if (cont.isFocusTraversalPolicyProvider()) {
return cont.getFocusTraversalPolicy().getLastComponent(cont);
}
}
}
return null;
}
示例6: getLastComponent
import java.awt.Container; //导入方法依赖的package包/类
/**
* Returns the last Component in the traversal cycle. This method is used
* to determine the next Component to focus when traversal wraps in the
* reverse direction.
*
* @param aContainer a focus cycle root of aComponent or a focus traversal policy provider whose
* last Component is to be returned
* @return the last Component in the traversal cycle of aContainer,
* or null if no suitable Component can be found
* @throws IllegalArgumentException if aContainer is null
*/
public Component getLastComponent(Container aContainer) {
List<Component> cycle;
if (log.isLoggable(PlatformLogger.Level.FINE)) {
log.fine("### Getting last component in " + aContainer);
}
if (aContainer == null) {
throw new IllegalArgumentException("aContainer cannot be null");
}
if (this.cachedRoot == aContainer) {
cycle = this.cachedCycle;
} else {
cycle = getFocusTraversalCycle(aContainer);
}
if (cycle.size() == 0) {
if (log.isLoggable(PlatformLogger.Level.FINE)) {
log.fine("### Cycle is empty");
}
return null;
}
if (log.isLoggable(PlatformLogger.Level.FINE)) {
log.fine("### Cycle is " + cycle);
}
for (int i= cycle.size() - 1; i >= 0; i--) {
Component comp = cycle.get(i);
if (accept(comp)) {
return comp;
} else if (comp instanceof Container && comp != aContainer) {
Container cont = (Container)comp;
if (cont.isFocusTraversalPolicyProvider()) {
Component retComp = cont.getFocusTraversalPolicy().getLastComponent(cont);
if (retComp != null) {
return retComp;
}
}
}
}
return null;
}