com.google.gwt.user.client.ui
Class Button

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.google.gwt.user.client.ui.FocusWidget
              extended by com.google.gwt.user.client.ui.ButtonBase
                  extended by com.google.gwt.user.client.ui.Button
All Implemented Interfaces:
EventListener, HasFocus, HasHTML, HasText, SourcesClickEvents, SourcesFocusEvents, SourcesKeyboardEvents

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 ClickListener() {
      public void onClick(Widget sender) {
        Window.alert("How high?");
      }
    });

    // Add it to the root panel.
    RootPanel.get().add(b);
  }
}


Constructor Summary
Button()
          Creates a button with no caption.
Button(java.lang.String html)
          Creates a button with the given HTML caption.
Button(java.lang.String html, ClickListener listener)
          Creates a button with the given HTML caption and click listener.
 
Method Summary
 void click()
          Programmatic equivalent of the user clicking the button.
 
Methods inherited from class com.google.gwt.user.client.ui.ButtonBase
getHTML, getText, setHTML, setText
 
Methods inherited from class com.google.gwt.user.client.ui.FocusWidget
addClickListener, addFocusListener, addKeyboardListener, getFocusImpl, getTabIndex, isEnabled, onBrowserEvent, removeClickListener, removeFocusListener, removeKeyboardListener, setAccessKey, setElement, setEnabled, setFocus, setTabIndex
 
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, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, removeStyleDependentName, removeStyleName, 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

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

public Button(java.lang.String html,
              ClickListener listener)
Creates a button with the given HTML caption and click listener.

Parameters:
html - the HTML caption
listener - the click listener
Method Detail

click

public void click()
Programmatic equivalent of the user clicking the button.