com.google.gwt.user.client.ui
Class Button
java.lang.Object
com.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.Widget
com.google.gwt.user.client.ui.FocusWidget
com.google.gwt.user.client.ui.ButtonBase
com.google.gwt.user.client.ui.Button
- All Implemented Interfaces:
- HasAllFocusHandlers, HasAllKeyHandlers, HasAllMouseHandlers, HasBlurHandlers, HasClickHandlers, HasFocusHandlers, HasKeyDownHandlers, HasKeyPressHandlers, HasKeyUpHandlers, HasMouseDownHandlers, HasMouseMoveHandlers, HasMouseOutHandlers, HasMouseOverHandlers, HasMouseUpHandlers, HasMouseWheelHandlers, HasHandlers, EventListener, Focusable, HasFocus, HasHTML, HasText, SourcesClickEvents, SourcesFocusEvents, SourcesKeyboardEvents, SourcesMouseEvents
public class Button
- extends ButtonBase
A standard push-button widget.
CSS Style Rules
Example
public class ButtonExample implements EntryPoint {
public void onModuleLoad() {
// Make a new button that does something when you click it.
Button b = new Button("Jump!", new ClickHandler() {
public void onClick(ClickEvent event) {
Window.alert("How high?");
}
});
// Add it to the root panel.
RootPanel.get().add(b);
}
}
Constructor Summary |
|
Button()
Creates a button with no caption. |
protected |
Button(Element element)
This constructor may be used by subclasses to explicitly use an existing
element. |
|
Button(java.lang.String html)
Creates a button with the given HTML caption. |
|
Button(java.lang.String html,
ClickHandler handler)
Creates a button with the given HTML caption and click listener. |
|
Button(java.lang.String html,
ClickListener listener)
Deprecated. Use Button(String, ClickHandler) instead |
Method Summary |
void |
click()
Programmatic equivalent of the user clicking the button. |
static Button |
wrap(Element element)
Creates a Button widget that wraps an existing <button> element. |
Methods inherited from class com.google.gwt.user.client.ui.FocusWidget |
addBlurHandler, addClickHandler, addClickListener, addFocusHandler, addFocusListener, addKeyboardListener, addKeyDownHandler, addKeyPressHandler, addKeyUpHandler, addMouseDownHandler, addMouseListener, addMouseMoveHandler, addMouseOutHandler, addMouseOverHandler, addMouseUpHandler, addMouseWheelHandler, addMouseWheelListener, getFocusImpl, getTabIndex, isEnabled, removeClickListener, removeFocusListener, removeKeyboardListener, removeMouseListener, removeMouseWheelListener, setAccessKey, setElement, setEnabled, setFocus, setTabIndex |
Methods inherited from class com.google.gwt.user.client.ui.Widget |
addDomHandler, addHandler, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, onLoad, onUnload, removeFromParent, sinkEvents |
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, toString, unsinkEvents |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Button
public Button()
- Creates a button with no caption.
Button
public Button(java.lang.String html)
- Creates a button with the given HTML caption.
- Parameters:
html
- the HTML caption
Button
@Deprecated
public Button(java.lang.String html,
ClickListener listener)
- Deprecated. Use
Button(String, ClickHandler)
instead
- Creates a button with the given HTML caption and click listener.
- Parameters:
html
- the HTML captionlistener
- the click listener
Button
public Button(java.lang.String html,
ClickHandler handler)
- Creates a button with the given HTML caption and click listener.
- Parameters:
html
- the HTML captionhandler
- the click handler
Button
protected Button(Element element)
- This constructor may be used by subclasses to explicitly use an existing
element. This element must be a <button> element.
- Parameters:
element
- the element to be used
wrap
public static Button wrap(Element element)
- Creates a Button widget that wraps an existing <button> element.
This element must already be attached to the document. If the element is
removed from the document, you must call
RootPanel.detachNow(Widget)
.
- Parameters:
element
- the element to be wrapped
click
public void click()
- Programmatic equivalent of the user clicking the button.