class org.aswing.FocusManager

FocusManager manages all the when a component should receive focus, i.e if it can.

@author paling

Class Fields

static function getManager(theStage:Stage): FocusManager

Returns the current FocusManager instance

@see #setCurrentManager

returns

this the current FocusManager instance

static function isDefaultTraversalEnabled(): Bool

Returns the default value for defaultTraversalEnabled. @see #setTraversalEnabled() @see #setTraversalAsDefault()

static function setDefaultTraversalEnabled(b:Bool): Void

The default to disables or enables the traversal by keys pressing. @see #setTraversalEnabled() @see #setTraversalAsDefault()

static function setManager(theStage:Stage, newManager:FocusManager): Void

Sets the current FocusManager instance. If null is specified, then the current FocusManager is replaced with a new instance of FocusManager.

@see #getCurrentManager @see org.aswing.FocusManager

newManager

the new FocusManager

Instance Fields

function new(theStage:Stage): Void

function focusNext(): Void

Focuses the Component after the current focus owner. @see #focusNextOfComponent()

function focusNextOfComponent(aComponent:Component): Void

Focuses the Component after aComponent, typically based on a FocusTraversalPolicy.

@see FocusTraversalPolicy

aComponent

the Component that is the basis for the focus traversal operation

function focusPrevious(): Void

Focuses the Component before the current focus owner. @see #focusPreviousOfComponent()

function focusPreviousOfComponent(aComponent:Component): Void

Focuses the Component before aComponent, typically based on a FocusTraversalPolicy.

@see FocusTraversalPolicy

aComponent

the Component that is the basis for the focus traversal operation

function getActiveWindow(): JWindow

Returns the active Window. The active Window is always either the focused Window, or the first Window that is an owner of the focused Window.

@see #setActiveWindow()

returns

the active Window

function getDefaultFocusTraversalPolicy(): FocusTraversalPolicy

Returns the default FocusTraversalPolicy. Top-level components use this value on their creation to initialize their own focus traversal policy by explicit call to Container.setFocusTraversalPolicy.

@see #setDefaultFocusTraversalPolicy() @see Container#setFocusTraversalPolicy() @see Container#getFocusTraversalPolicy()

returns

the default FocusTraversalPolicy. null will never be returned.

function getFocusOwner(): Component

Returns the focus owner.

@see #setFocusOwner()

returns

the focus owner.

function getPreviousFocusedComponent(): Component

Returns the previous focused component.

returns

the previous focused component.

function init(theStage:Stage): Void

Init the focus manager, it will only start works when it is inited. By default, it will be inited when a component is added to stage automatically.

function isTraversalAsDefault(): Bool

Returns whether or not to use default value for traversal enabled. @see #isTraversalEnabled() @see #setDefaultTraversalEnabled()

function isTraversalEnabled(): Bool

Returns traversal by keys pressing is enabled or not. If isTraversalAsDefault() returns true, this will returns isDefaultTraversalEnabled

If this method called, TAB... keys will or not effect the focus traverse with this focus system.

And component will or not fire any Key events when there are focused and key pressed.

@see #isTraversalAsDefault() @see #setDefaultTraversalEnabled()

function isTraversing(): Bool

Returns if the focus is traversing by keys.

Once when focus traversed by FocusTraversalKeys this is turned on, true will be returned. Once when Mouse is down, this will be turned off, false will be returned. @see #getDefaultFocusTraversalKeys() @see Component#getFocusTraversalKeys()

returns

true if the focus is traversing by FocusTraversalKeys, otherwise returns false.

function setActiveWindow(newActiveWindow:JWindow): Void

Sets the active Window. The active Window is always either the focused Window, or the first Window that is an owner of the focused Window.

This method does not actually change the active Window . It merely stores the value to be subsequently returned by getActiveWindow(). Use Component.requestFocus() or Component.requestFocusInWindow() or JWindow.setActive()to change the active Window.

@see #getActiveWindow() @see Component#requestFocus() @see Component#requestFocusInWindow() @see JWindow#setActive()

activeWindow

the active Window

function setDefaultFocusTraversalPolicy(newDefaultPolicy:FocusTraversalPolicy): Void

Sets the default FocusTraversalPolicy. Top-level components use this value on their creation to initialize their own focus traversal policy by explicit call to Container.setFocusTraversalPolicy. Note: this call doesn't affect already created components as they have their policy initialized. Only new components will use this policy as their default policy.

@see #getDefaultFocusTraversalPolicy() @see Container#setFocusTraversalPolicy() @see Container#getFocusTraversalPolicy()

defaultPolicy

the new, default FocusTraversalPolicy, if it is null, nothing will be done

function setFocusOwner(newFocusOwner:Component): Void

Sets the focus owner. The operation will be cancelled if the Component is not focusable.

This method does not actually set the focus to the specified Component. It merely stores the value to be subsequently returned by getFocusOwner(). Use Component.requestFocus() or Component.requestFocusInWindow() to change the focus owner.

@see #getFocusOwner() @see Component#requestFocus() @see Component#isFocusable()

focusOwner

the focus owner

function setTraversalAsDefault(b:Bool): Void

Sets whether or not to use default value for traversal enabled. @see #isTraversalEnabled() @see #setDefaultTraversalEnabled()

function setTraversalEnabled(b:Bool): Void

Disables or enables the traversal by keys pressing. This will call setTraversalAsDefault(false)

If this method called, TAB... keys will or not effect the focus traverse with this focus system.

And component will or not fire any Key events when there are focused and key pressed.

@see #setTraversalAsDefault() @see #setDefaultTraversalEnabled()

function setTraversing(b:Bool): Void

Sets if the focus is traversing by keys.

By default, the traversing property will only be set true when TRAVERSAL_KEYS down. If your component need view focus rect, you should set it to true when your component's managed key down. @see #isTraversing()

b

true tag traversing to be true, false tag traversing to be false

function uninit(): Void

Un-init this focus manager.