java.lang.Object
   ↳ com.google.gwt.user.client.ui.UIObject
     ↳ com.google.gwt.user.client.ui.Widget
       ↳ com.google.gwt.user.client.ui.Panel
         ↳ com.google.gwt.user.client.ui.SimplePanel
           ↳ com.google.gwt.user.client.ui.FocusPanel

Class Overview

A simple panel that makes its contents focusable, and adds the ability to catch mouse and keyboard events.

Summary

[Expand]
Inherited Constants
From class com.google.gwt.user.client.ui.UIObject
Public Constructors
FocusPanel()
FocusPanel(Widget child)
Public Methods
HandlerRegistration addBlurHandler(BlurHandler handler)
Adds a BlurEvent handler.
HandlerRegistration addClickHandler(ClickHandler handler)
Adds a ClickEvent handler.
void addClickListener(ClickListener listener)
This method is deprecated. Use addClickHandler(ClickHandler) instead
HandlerRegistration addDoubleClickHandler(DoubleClickHandler handler)
Adds a DoubleClickEvent handler.
HandlerRegistration addFocusHandler(FocusHandler handler)
Adds a FocusEvent handler.
void addFocusListener(FocusListener listener)
This method is deprecated. Use addFocusHandler(FocusHandler) instead
HandlerRegistration addGestureChangeHandler(GestureChangeHandler handler)
Adds a GestureChangeEvent handler.
HandlerRegistration addGestureEndHandler(GestureEndHandler handler)
Adds a GestureEndEvent handler.
HandlerRegistration addGestureStartHandler(GestureStartHandler handler)
Adds a GestureStartEvent handler.
HandlerRegistration addKeyDownHandler(KeyDownHandler handler)
Adds a KeyDownEvent handler.
HandlerRegistration addKeyPressHandler(KeyPressHandler handler)
Adds a KeyPressEvent handler.
HandlerRegistration addKeyUpHandler(KeyUpHandler handler)
Adds a KeyUpEvent handler.
void addKeyboardListener(KeyboardListener listener)
HandlerRegistration addMouseDownHandler(MouseDownHandler handler)
Adds a MouseDownEvent handler.
void addMouseListener(MouseListener listener)
HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler)
Adds a MouseMoveEvent handler.
HandlerRegistration addMouseOutHandler(MouseOutHandler handler)
Adds a MouseOutEvent handler.
HandlerRegistration addMouseOverHandler(MouseOverHandler handler)
Adds a MouseOverEvent handler.
HandlerRegistration addMouseUpHandler(MouseUpHandler handler)
Adds a MouseUpEvent handler.
HandlerRegistration addMouseWheelHandler(MouseWheelHandler handler)
Adds a MouseWheelEvent handler.
void addMouseWheelListener(MouseWheelListener listener)
This method is deprecated. Use addMouseWheelHandler(MouseWheelHandler) instead
HandlerRegistration addTouchCancelHandler(TouchCancelHandler handler)
Adds a TouchCancelEvent handler.
HandlerRegistration addTouchEndHandler(TouchEndHandler handler)
Adds a TouchEndEvent handler.
HandlerRegistration addTouchMoveHandler(TouchMoveHandler handler)
Adds a TouchMoveEvent handler.
HandlerRegistration addTouchStartHandler(TouchStartHandler handler)
Adds a TouchStartEvent handler.
int getTabIndex()
Gets the widget's position in the tab index.
void removeClickListener(ClickListener listener)
This method is deprecated. Use the removeHandler() method on the object returned by addClickHandler(ClickHandler) instead
void removeFocusListener(FocusListener listener)
This method is deprecated. Use the removeHandler() method on the object returned by addFocusHandler(FocusHandler) instead
void removeKeyboardListener(KeyboardListener listener)
This method is deprecated. Use the removeHandler() method on the object returned by an add*Handler method instead
void removeMouseListener(MouseListener listener)
This method is deprecated. Use the removeHandler() method on the object returned by an add*Handler method instead
void removeMouseWheelListener(MouseWheelListener listener)
This method is deprecated. Use the removeHandler() method on the object returned by addMouseWheelHandler(MouseWheelHandler) instead
void setAccessKey(char key)
Sets the widget's 'access key'.
void setFocus(boolean focused)
Explicitly focus/unfocus this widget.
void setTabIndex(int index)
Sets the widget's position in the tab index.
[Expand]
Inherited Methods
From class com.google.gwt.user.client.ui.SimplePanel
From class com.google.gwt.user.client.ui.Panel
From class com.google.gwt.user.client.ui.Widget
From class com.google.gwt.user.client.ui.UIObject
From class java.lang.Object
From interface com.google.gwt.event.dom.client.HasBlurHandlers
From interface com.google.gwt.event.dom.client.HasClickHandlers
From interface com.google.gwt.event.dom.client.HasDoubleClickHandlers
From interface com.google.gwt.event.dom.client.HasFocusHandlers
From interface com.google.gwt.event.dom.client.HasGestureChangeHandlers
From interface com.google.gwt.event.dom.client.HasGestureEndHandlers
From interface com.google.gwt.event.dom.client.HasGestureStartHandlers
From interface com.google.gwt.event.dom.client.HasKeyDownHandlers
From interface com.google.gwt.event.dom.client.HasKeyPressHandlers
From interface com.google.gwt.event.dom.client.HasKeyUpHandlers
From interface com.google.gwt.event.dom.client.HasMouseDownHandlers
From interface com.google.gwt.event.dom.client.HasMouseMoveHandlers
From interface com.google.gwt.event.dom.client.HasMouseOutHandlers
From interface com.google.gwt.event.dom.client.HasMouseOverHandlers
From interface com.google.gwt.event.dom.client.HasMouseUpHandlers
From interface com.google.gwt.event.dom.client.HasMouseWheelHandlers
From interface com.google.gwt.event.dom.client.HasTouchCancelHandlers
From interface com.google.gwt.event.dom.client.HasTouchEndHandlers
From interface com.google.gwt.event.dom.client.HasTouchMoveHandlers
From interface com.google.gwt.event.dom.client.HasTouchStartHandlers
From interface com.google.gwt.event.logical.shared.HasAttachHandlers
From interface com.google.gwt.event.shared.HasHandlers
From interface com.google.gwt.user.client.EventListener
From interface com.google.gwt.user.client.ui.AcceptsOneWidget
From interface com.google.gwt.user.client.ui.Focusable
From interface com.google.gwt.user.client.ui.HasOneWidget
From interface com.google.gwt.user.client.ui.HasWidgets
From interface com.google.gwt.user.client.ui.HasWidgets.ForIsWidget
From interface com.google.gwt.user.client.ui.IsWidget
From interface com.google.gwt.user.client.ui.SourcesClickEvents
From interface com.google.gwt.user.client.ui.SourcesFocusEvents
From interface com.google.gwt.user.client.ui.SourcesKeyboardEvents
From interface com.google.gwt.user.client.ui.SourcesMouseEvents
From interface com.google.gwt.user.client.ui.SourcesMouseWheelEvents
From interface java.lang.Iterable

Public Constructors

public FocusPanel ()

public FocusPanel (Widget child)

Public Methods

public HandlerRegistration addBlurHandler (BlurHandler handler)

Adds a BlurEvent handler.

Parameters
handler the blur handler
Returns

public HandlerRegistration addClickHandler (ClickHandler handler)

Adds a ClickEvent handler.

Parameters
handler the click handler
Returns

public void addClickListener (ClickListener listener)

This method is deprecated.
Use addClickHandler(ClickHandler) instead

Adds a listener interface to receive click events.

Parameters
listener the listener interface to add

public HandlerRegistration addDoubleClickHandler (DoubleClickHandler handler)

Adds a DoubleClickEvent handler.

Parameters
handler the double click handler
Returns

public HandlerRegistration addFocusHandler (FocusHandler handler)

Adds a FocusEvent handler.

Parameters
handler the focus handler
Returns

public void addFocusListener (FocusListener listener)

This method is deprecated.
Use addFocusHandler(FocusHandler) instead

Adds a listener interface to receive focus events.

Parameters
listener the listener interface to add

public HandlerRegistration addGestureChangeHandler (GestureChangeHandler handler)

Adds a GestureChangeEvent handler.

Parameters
handler the mouse down handler
Returns

public HandlerRegistration addGestureEndHandler (GestureEndHandler handler)

Adds a GestureEndEvent handler.

Parameters
handler the mouse down handler
Returns

public HandlerRegistration addGestureStartHandler (GestureStartHandler handler)

Adds a GestureStartEvent handler.

Parameters
handler the mouse down handler
Returns

public HandlerRegistration addKeyDownHandler (KeyDownHandler handler)

Adds a KeyDownEvent handler.

Parameters
handler the key down handler
Returns

public HandlerRegistration addKeyPressHandler (KeyPressHandler handler)

Adds a KeyPressEvent handler.

Parameters
handler the key press handler
Returns

public HandlerRegistration addKeyUpHandler (KeyUpHandler handler)

Adds a KeyUpEvent handler.

Parameters
handler the key up handler
Returns

public void addKeyboardListener (KeyboardListener listener)

This method is deprecated.
Use addKeyDownHandler(KeyDownHandler), addKeyUpHandler(KeyUpHandler) and addKeyPressHandler(KeyPressHandler) instead

Adds a listener interface to receive keyboard events.

Parameters
listener the listener interface to add

public HandlerRegistration addMouseDownHandler (MouseDownHandler handler)

Adds a MouseDownEvent handler.

Parameters
handler the mouse down handler
Returns

public void addMouseListener (MouseListener listener)

This method is deprecated.
Use addMouseOverHandler(MouseOverHandler), addMouseMoveHandler(MouseMoveHandler), addMouseDownHandler(MouseDownHandler), addMouseUpHandler(MouseUpHandler) and addMouseOutHandler(MouseOutHandler) instead

Adds a listener interface to receive mouse events.

Parameters
listener the listener interface to add

public HandlerRegistration addMouseMoveHandler (MouseMoveHandler handler)

Adds a MouseMoveEvent handler.

Parameters
handler the mouse move handler
Returns

public HandlerRegistration addMouseOutHandler (MouseOutHandler handler)

Adds a MouseOutEvent handler.

Parameters
handler the mouse out handler
Returns

public HandlerRegistration addMouseOverHandler (MouseOverHandler handler)

Adds a MouseOverEvent handler.

Parameters
handler the mouse over handler
Returns

public HandlerRegistration addMouseUpHandler (MouseUpHandler handler)

Adds a MouseUpEvent handler.

Parameters
handler the mouse up handler
Returns

public HandlerRegistration addMouseWheelHandler (MouseWheelHandler handler)

Adds a MouseWheelEvent handler.

Parameters
handler the mouse wheel handler
Returns

public void addMouseWheelListener (MouseWheelListener listener)

This method is deprecated.
Use addMouseWheelHandler(MouseWheelHandler) instead

Adds a listener interface to receive mouse events.

Parameters
listener the listener interface to add

public HandlerRegistration addTouchCancelHandler (TouchCancelHandler handler)

Adds a TouchCancelEvent handler.

Parameters
handler the mouse down handler
Returns

public HandlerRegistration addTouchEndHandler (TouchEndHandler handler)

Adds a TouchEndEvent handler.

Parameters
handler the mouse down handler
Returns

public HandlerRegistration addTouchMoveHandler (TouchMoveHandler handler)

Adds a TouchMoveEvent handler.

Parameters
handler the mouse down handler
Returns

public HandlerRegistration addTouchStartHandler (TouchStartHandler handler)

Adds a TouchStartEvent handler.

Parameters
handler the mouse down handler
Returns

public int getTabIndex ()

Gets the widget's position in the tab index.

Returns
  • the widget's tab index

public void removeClickListener (ClickListener listener)

This method is deprecated.
Use the removeHandler() method on the object returned by addClickHandler(ClickHandler) instead

Removes a previously added listener interface.

Parameters
listener the listener interface to remove

public void removeFocusListener (FocusListener listener)

This method is deprecated.
Use the removeHandler() method on the object returned by addFocusHandler(FocusHandler) instead

Removes a previously added listener interface.

Parameters
listener the listener interface to remove

public void removeKeyboardListener (KeyboardListener listener)

This method is deprecated.
Use the removeHandler() method on the object returned by an add*Handler method instead

Removes a previously added listener interface.

Parameters
listener the listener interface to remove

public void removeMouseListener (MouseListener listener)

This method is deprecated.
Use the removeHandler() method on the object returned by an add*Handler method instead

Removes a previously added listener interface.

Parameters
listener the listener interface to remove

public void removeMouseWheelListener (MouseWheelListener listener)

This method is deprecated.
Use the removeHandler() method on the object returned by addMouseWheelHandler(MouseWheelHandler) instead

Removes a previously added listener interface.

Parameters
listener the listener interface to remove

public void setAccessKey (char key)

Sets the widget's 'access key'. This key is used (in conjunction with a browser-specific modifier key) to automatically focus the widget.

Parameters
key the widget's access key

public void setFocus (boolean focused)

Explicitly focus/unfocus this widget. Only one widget can have focus at a time, and the widget that does will receive all keyboard events.

Parameters
focused whether this widget should take focus or release it

public void setTabIndex (int index)

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.

Parameters
index the widget's tab index