## com.google.gwt.user.client.ui
Class FocusWidget

    java.lang.Object
      com.google.gwt.user.client.ui.UIObject
          com.google.gwt.user.client.ui.Widget
              com.google.gwt.user.client.ui.FocusWidget

All Implemented Interfaces:
  EventListener, HasFocus, SourcesClickEvents, SourcesFocusEvents, SourcesKeyboardEvents

Direct Known Subclasses:
  ButtonBase, ListBox, RichTextArea, TextBoxBase

    public abstract class FocusWidget

extends Widget
implements SourcesClickEvents, SourcesFocusEvents, HasFocus, SourcesKeyboardEvents

Abstract base class for most widgets that can receive keyboard focus.

Nested Class Summary

Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
`UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled`

Field Summary

Fields inherited from class com.google.gwt.user.client.ui.UIObject
`DEBUG_ID_PREFIX`

Constructor Summary
`protected` `FocusWidget()` Creates a new focus widget with no element.
`protected` `FocusWidget(Element elem)` Creates a new focus widget that wraps the specified browser element.

Method Summary
`void` `addClickListener(ClickListener listener)` Adds a listener interface to receive click events.
`void` `addFocusListener(FocusListener listener)` Adds a listener interface to receive mouse events.
`void` `addKeyboardListener(KeyboardListener listener)` Adds a listener interface to receive keyboard events.
`protected static com.google.gwt.user.client.ui.impl.FocusImpl` `getFocusImpl()` Gets the FocusImpl instance.
`int` `getTabIndex()` Gets the widget's position in the tab index.
`boolean` `isEnabled()` Gets whether this widget is enabled.
`void` `onBrowserEvent(Event event)` Fired whenever a browser event is received.
`void` `removeClickListener(ClickListener listener)` Removes a previously added listener interface.
`void` `removeFocusListener(FocusListener listener)` Removes a previously added listener interface.
`void` `removeKeyboardListener(KeyboardListener listener)` Removes a previously added listener interface.
`void` `setAccessKey(char key)` Sets the widget's 'access key'.
`protected void` `setElement(Element elem)` Sets this object's browser element.
`void` `setEnabled(boolean enabled)` Sets whether this widget is enabled.
`void` `setFocus(boolean focused)` Explicitly focus/unfocus this widget.
`void` `setTabIndex(int index)` Sets the widget's position in the tab index.

Methods inherited from class com.google.gwt.user.client.ui.Widget
`doAttachChildren, doDetachChildren, getParent, isAttached, onAttach, onDetach, onLoad, onUnload, removeFromParent`

Methods inherited from class com.google.gwt.user.client.ui.UIObject

`addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, setElement, setHeight, setPixelSize, setSize, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkEvents, toString, unsinkEvents`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### FocusWidget

    protected FocusWidget()

  Creates a new focus widget with no element. `setElement(Element)` must be called before any other methods.

### FocusWidget

    protected FocusWidget(Element elem)

  Creates a new focus widget that wraps the specified browser element.

  Parameters:
    `elem` - the element to be wrapped

Method Detail

### getFocusImpl

    protected static com.google.gwt.user.client.ui.impl.FocusImpl getFocusImpl()

  Gets the FocusImpl instance.

  Returns:
    impl

### addClickListener

    public void addClickListener(ClickListener listener)

  Description copied from interface: `SourcesClickEvents`
  Adds a listener interface to receive click events.

  Specified by:
    `addClickListener` in interface `SourcesClickEvents`
  Parameters:
    `listener` - the listener interface to add

### addFocusListener

    public void addFocusListener(FocusListener listener)

  Description copied from interface: `SourcesFocusEvents`
  Adds a listener interface to receive mouse events.

  Specified by:
    `addFocusListener` in interface `SourcesFocusEvents`
  Parameters:
    `listener` - the listener interface to add

### addKeyboardListener

    public void addKeyboardListener(KeyboardListener listener)

  Description copied from interface: `SourcesKeyboardEvents`
  Adds a listener interface to receive keyboard events.

  Specified by:
    `addKeyboardListener` in interface `SourcesKeyboardEvents`
  Parameters:
    `listener` - the listener interface to add

### getTabIndex

    public int getTabIndex()

  Description copied from interface: `HasFocus`
  Gets the widget's position in the tab index.

  Specified by:
    `getTabIndex` in interface `HasFocus`
  Returns:
    the widget's tab index

### isEnabled

    public boolean isEnabled()

  Gets whether this widget is enabled.

  Returns:
    `true` if the widget is enabled

### onBrowserEvent

    public void onBrowserEvent(Event event)

  Description copied from interface: `EventListener`
  Fired whenever a browser event is received.

  Specified by:
    `onBrowserEvent` in interface `EventListener`
  Overrides:
    `onBrowserEvent` in class `Widget`
  Parameters:
    `event` - the event received

### removeClickListener

    public void removeClickListener(ClickListener listener)

  Description copied from interface: `SourcesClickEvents`
  Removes a previously added listener interface.

  Specified by:
    `removeClickListener` in interface `SourcesClickEvents`
  Parameters:
    `listener` - the listener interface to remove

### removeFocusListener

    public void removeFocusListener(FocusListener listener)

  Description copied from interface: `SourcesFocusEvents`
  Removes a previously added listener interface.

  Specified by:
    `removeFocusListener` in interface `SourcesFocusEvents`
  Parameters:
    `listener` - the listener interface to remove

### removeKeyboardListener

    public void removeKeyboardListener(KeyboardListener listener)

  Description copied from interface: `SourcesKeyboardEvents`
  Removes a previously added listener interface.

  Specified by:
    `removeKeyboardListener` in interface `SourcesKeyboardEvents`
  Parameters:
    `listener` - the listener interface to remove

### setAccessKey

    public void setAccessKey(char key)

  Description copied from interface: `HasFocus`
  Sets the widget's 'access key'. This key is used (in conjunction with a browser-specific modifier key) to automatically focus the widget.

  Specified by:
    `setAccessKey` in interface `HasFocus`
  Parameters:
    `key` - the widget's access key

### setEnabled

    public void setEnabled(boolean enabled)

  Sets whether this widget is enabled.

  Parameters:
    `enabled` - `true` to enable the widget, `false` to disable it

### setFocus

    public void setFocus(boolean focused)

  Description copied from interface: `HasFocus`
  Explicitly focus/unfocus this widget. Only one widget can have focus at a time, and the widget that does will receive all keyboard events.

  Specified by:
    `setFocus` in interface `HasFocus`
  Parameters:
    `focused` - whether this widget should take focus or release it

### setTabIndex

    public void setTabIndex(int index)

  Description copied from interface: `HasFocus`
  Sets the widget's position in the tab index. If more than one widget has the same tab index, each such widget will receive focus in an arbitrary order. Setting the tab index to `-1` will cause this widget to be removed from the tab order.

  Specified by:
    `setTabIndex` in interface `HasFocus`
  Parameters:
    `index` - the widget's tab index

### setElement

    protected void setElement(Element elem)

  Description copied from class: `UIObject`
  Sets this object's browser element. UIObject subclasses must call this method before attempting to call any other methods, and it may only be called once. This method exists for backwards compatibility with pre-1.5 code. As of GWT 1.5, `UIObject.setElement(Element)` is the preferred method.

  Overrides:
    `setElement` in class `UIObject`
  Parameters:
    `elem` - the object's element