|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.FocusTraversalPolicy uic.widgets.UICFocusTraversalPolicy
public class UICFocusTraversalPolicy
A focus traversalPolicy for predefined traversal. The concept of focustraversal means that changing the focus (which widget receives keyboard input) using the TAB key follows a defined order of widgets. This class allows you to set the order to a list where each member is added using the addComponent(Component c) method.
Notice that this class uses a Swing concept introduced in Java version 1.4 which means this class will not compile with older versions of Java.
Common usage:
myJPanel.setFocusCycleRoot(true); // if the component is not a normal root // then we need to do this in order to make sure // our policy is queried in the first place. UICFocusTraversalPolicy policy = new UICFocusTraversalPolicy(); policy.addComponent(childWidget1); // first widget to get focus policy.addComponent(childWidget2); // the order in adding equals the order in tabbing. // all the other widgets that need to be used in traversal myJPanel.setFocusTraversalPolicy(policy);
Constructor Summary | |
---|---|
UICFocusTraversalPolicy()
|
Method Summary | |
---|---|
void |
addComponent(Component c)
|
Component |
getComponentAfter(Container focusCycleRoot,
Component aComponent)
Returns the Component that should receive the focus after aComponent. |
Component |
getComponentBefore(Container focusCycleRoot,
Component aComponent)
Returns the Component that should receive the focus before aComponent. |
Component |
getDefaultComponent(Container focusCycleRoot)
Returns the default Component to focus. |
Component |
getFirstComponent(Container focusCycleRoot)
Returns the first Component in the traversal cycle. |
Component |
getInitialComponent(Window window)
|
Component |
getLastComponent(Container focusCycleRoot)
Returns the last Component in the traversal cycle. |
void |
setInitialComponent(Component c)
Set the component that will gain focus when a dialog is first shown Only need to set if this component is different from the first component (getFirstComponent) |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public UICFocusTraversalPolicy()
Method Detail |
---|
public void addComponent(Component c)
public Component getComponentAfter(Container focusCycleRoot, Component aComponent)
getComponentAfter
in class FocusTraversalPolicy
public Component getComponentBefore(Container focusCycleRoot, Component aComponent)
getComponentBefore
in class FocusTraversalPolicy
public Component getDefaultComponent(Container focusCycleRoot)
getDefaultComponent
in class FocusTraversalPolicy
public Component getFirstComponent(Container focusCycleRoot)
getFirstComponent
in class FocusTraversalPolicy
public void setInitialComponent(Component c)
c
- the component that will gain focus when its parent window is showngetInitialComponent(java.awt.Window)
public Component getInitialComponent(Window window)
getInitialComponent
in class FocusTraversalPolicy
public Component getLastComponent(Container focusCycleRoot)
getLastComponent
in class FocusTraversalPolicy
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |