|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.gnu.glib.GObject
org.gnu.gtk.GtkObject
org.gnu.gtk.Widget
org.gnu.gtk.Container
org.gnu.gtk.Bin
org.gnu.gtk.Button
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.
Field Summary |
Fields inherited from class org.gnu.glib.GObject |
eventsInitialized |
Constructor Summary | |
Button()
Creates a new Button widget |
|
Button(GtkStockItem stockItem)
Constructs a button using a stock item. |
|
Button(Handle handle)
Construct a button using a handle to a native resource. |
|
Button(java.lang.String stockItem)
Constructs a button using a String that represents a stock item. |
|
Button(java.lang.String label,
boolean hasMnemonic)
Creates a button widget with a gtk.Label child containing the given text. |
Method Summary | |
void |
addListener(ButtonListener listener)
Register an object to handle button events. |
void |
click()
Sends a clicked signal to the button. |
void |
enter()
Sends an enter signal to the button. |
protected void |
fireButtonEvent(ButtonEvent event)
|
java.lang.Class |
getEventListenerClass(java.lang.String signal)
|
EventType |
getEventType(java.lang.String signal)
|
boolean |
getFocusOnClick()
|
Widget |
getImage()
|
java.lang.String |
getLabel()
Returns the label which is being used on the button. |
ReliefStyle |
getRelief()
Returns the current relief style of the button |
static Type |
getType()
Retrieve the runtime type used by the GLib library. |
boolean |
getUseStock()
Returns true if this button is using stock items |
boolean |
getUseUnderline()
Returns whether an embedded underline in the button label indicates a mnemonic. |
double |
getXAlignment()
|
double |
getYAlignment()
|
protected static void |
gtk_button_clicked(Handle button)
|
protected static void |
gtk_button_enter(Handle button)
|
protected static void |
gtk_button_get_alignment(Handle button,
double[] xalign,
double[] yalign)
|
protected static boolean |
gtk_button_get_focus_on_click(Handle button)
|
protected static Handle |
gtk_button_get_image(Handle button)
|
protected static java.lang.String |
gtk_button_get_label(Handle button)
|
protected static int |
gtk_button_get_relief(Handle button)
|
protected static int |
gtk_button_get_type()
|
protected static boolean |
gtk_button_get_use_stock(Handle button)
|
protected static boolean |
gtk_button_get_use_underline(Handle button)
|
protected static void |
gtk_button_leave(Handle button)
|
protected static Handle |
gtk_button_new_from_stock(java.lang.String stock_id)
|
protected static Handle |
gtk_button_new_with_label(java.lang.String label)
|
protected static Handle |
gtk_button_new_with_mnemonic(java.lang.String label)
|
protected static Handle |
gtk_button_new()
|
protected static void |
gtk_button_pressed(Handle button)
|
protected static void |
gtk_button_released(Handle button)
|
protected static void |
gtk_button_set_alignment(Handle button,
double xalign,
double yalign)
|
protected static void |
gtk_button_set_focus_on_click(Handle button,
boolean focus)
|
protected static void |
gtk_button_set_image(Handle button,
Handle image)
|
protected static void |
gtk_button_set_label(Handle button,
java.lang.String label)
|
protected static void |
gtk_button_set_relief(Handle button,
int relief)
|
protected static void |
gtk_button_set_use_stock(Handle button,
boolean useStock)
|
protected static void |
gtk_button_set_use_underline(Handle button,
boolean useUnderline)
|
void |
leave()
Sends a leave signal to the button. |
void |
press()
Sends a pressed signal to the button. |
void |
release()
Sends a released signal to the button. |
void |
removeListener(ButtonListener listener)
Removes a listener |
void |
setAlignment(double xalign,
double yalign)
|
void |
setFocusOnClick(boolean focusOnClick)
|
void |
setImage(Widget image)
|
void |
setLabel(java.lang.String newLabel)
Sets the text of the label of the button to newLabel. |
void |
setRelief(ReliefStyle newRelief)
Sets the relief style of the edges of the Button widget. |
void |
setUseStock(boolean useStock)
Setting this will true will make the widget try to interpret the label as a stock item. |
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. |
Methods inherited from class org.gnu.gtk.Bin |
getChild, gtk_bin_get_child, gtk_bin_get_type |
Methods inherited from class org.gnu.gtk.GtkObject |
getFlags, gtk_object_destroy, gtk_object_get_type, gtk_object_sink, setFlags, sink |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Button()
public Button(java.lang.String label, boolean hasMnemonic)
If hasMnemonic
is true, the label will be interpreted as
containing Mnemonic characters (keyboard accelerators). If
characters in label are proceeded by an underscore character, they will
be underlined. The first underlined character will be taken as the
mnemonic - pressing Alt
and that character will activate
the button.
label
- Text to appear on the buttonhasMnemonic
- See above descriptionpublic Button(GtkStockItem stockItem)
Button myButton = new Button( new StockItem( StockItem.NO );
)
stockItem
- A gtk stock itemGtkStockItem
public Button(java.lang.String stockItem)
Button myButton = new Button( StockItem.NO;
)
stockItem
- A String representing a stock itemGtkStockItem
public Button(Handle handle)
Method Detail |
public void press()
public void release()
public void click()
public void enter()
public void leave()
public void setRelief(ReliefStyle newRelief)
public ReliefStyle getRelief()
public void setLabel(java.lang.String newLabel)
public java.lang.String getLabel()
public void setUseUnderline(boolean useUnderLine)
public boolean getUseUnderline()
public void setUseStock(boolean useStock)
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 itemspublic boolean getUseStock()
public void setFocusOnClick(boolean focusOnClick)
public boolean getFocusOnClick()
public void setAlignment(double xalign, double yalign)
public double getXAlignment()
public double getYAlignment()
public void setImage(Widget image)
public Widget getImage()
public void addListener(ButtonListener listener)
ButtonListener
public void removeListener(ButtonListener listener)
addListener(ButtonListener)
protected void fireButtonEvent(ButtonEvent event)
public java.lang.Class getEventListenerClass(java.lang.String signal)
getEventListenerClass
in class Container
public EventType getEventType(java.lang.String signal)
getEventType
in class Container
public static Type getType()
protected static final int gtk_button_get_type()
protected static final Handle gtk_button_new()
protected static final Handle gtk_button_new_with_label(java.lang.String label)
protected static final Handle gtk_button_new_from_stock(java.lang.String stock_id)
protected static final Handle gtk_button_new_with_mnemonic(java.lang.String label)
protected static final void gtk_button_pressed(Handle button)
protected static final void gtk_button_released(Handle button)
protected static final void gtk_button_clicked(Handle button)
protected static final void gtk_button_enter(Handle button)
protected static final void gtk_button_leave(Handle button)
protected static final void gtk_button_set_relief(Handle button, int relief)
protected static final int gtk_button_get_relief(Handle button)
protected static final void gtk_button_set_label(Handle button, java.lang.String label)
protected static final java.lang.String gtk_button_get_label(Handle button)
protected static final void gtk_button_set_use_underline(Handle button, boolean useUnderline)
protected static final boolean gtk_button_get_use_underline(Handle button)
protected static final void gtk_button_set_use_stock(Handle button, boolean useStock)
protected static final boolean gtk_button_get_use_stock(Handle button)
protected static final void gtk_button_set_focus_on_click(Handle button, boolean focus)
protected static final boolean gtk_button_get_focus_on_click(Handle button)
protected static final void gtk_button_set_alignment(Handle button, double xalign, double yalign)
protected static final void gtk_button_get_alignment(Handle button, double[] xalign, double[] yalign)
protected static final void gtk_button_set_image(Handle button, Handle image)
protected static final Handle gtk_button_get_image(Handle button)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |