A widget that creates a signal when clicked on. This is generally used to
attach a function to that is called when the button is pressed.
The gtk.Button widget can hold any valid child widget. That is it can hold
most any other standard gtk.Widget. The most commonly used child is the
gtk.Label.
addListener
public void addListener(ButtonListener listener)
Register an object to handle button events.
click
public void click()
Sends a clicked signal to the button. If handlers have been set
up for this event, they will be called
enter
public void enter()
Sends an enter signal to the button. If handlers have been set up
for this event, they will be called.
getButton
public static Button getButton(Handle handle)
Construct a button using a handle to a native resource.
getFocusOnClick
public boolean getFocusOnClick()
getImage
public Widget getImage()
getLabel
public String getLabel()
Returns the label which is being used on the button.
getRelief
public ReliefStyle getRelief()
Returns the current relief style of the button
getType
public static Type getType()
Retrieve the runtime type used by the GLib library.
- getType in interface Bin
getUseStock
public boolean getUseStock()
Returns true if this button is using stock items
getUseUnderline
public boolean getUseUnderline()
Returns whether an embedded underline in the button label indicates a
mnemonic.
getXAlignment
public double getXAlignment()
getYAlignment
public double getYAlignment()
leave
public void leave()
Sends a leave signal to the button. If handlers have been set up
for this event, they will be called.
press
public void press()
Sends a pressed signal to the button. If handlers have been set
up for this event then they will be called
release
public void release()
Sends a released signal to the button. If handlers have been set
up for this event, they will be called.
removeListener
public void removeListener(ButtonListener listener)
Removes a listener
setAlignment
public void setAlignment(double xalign,
double yalign)
setFocusOnClick
public void setFocusOnClick(boolean focusOnClick)
setImage
public void setImage(Widget image)
setLabel
public void setLabel(String newLabel)
Sets the text of the label of the button to newLabel. If setUseStock has
been called or this object was created using stock buttons, then newLabel
should be the name of the stock item to be used.
setRelief
public void setRelief(ReliefStyle newRelief)
Sets the relief style of the edges of the Button widget.
setUseStock
public void setUseStock(boolean useStock)
Setting this will true will make the widget try to interpret the label as
a stock item. If the stock id is unknown, it will be treated as a normal
label.
Stock items are standard icons and strings. These are included in Gtk
themes, so that the appearance of all applications follows their theme.
The use of stock items is highly recommended.
useStock
- true if this button should use stock items
setUseUnderline
public void setUseUnderline(boolean useUnderLine)
If true, an underline in the text of the button label indicates the next
character should be used for the mnemonic accelerator key.