Package com.tonic.vellum.widget
Class Button
- java.lang.Object
-
- com.tonic.vellum.Section
-
- com.tonic.vellum.widget.SingleRowSection
-
- com.tonic.vellum.widget.Button
-
public final class Button extends SingleRowSection
A focusable button that runs its action on ENTER or SPACE and is drawn reversed while focused.
-
-
Constructor Summary
Constructors Constructor Description Button(java.lang.String label)Creates a button with the given label.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ButtonfocusedStyle(Style style)Sets the style used when the button is focused.ButtononActivate(java.lang.Runnable handler)Sets the action run when the button is activated.ButtonsetLabel(java.lang.String label)Sets the button's label.Buttonstyle(Style style)Sets the style used when the button is not focused.
-
-
-
Method Detail
-
setLabel
public Button setLabel(java.lang.String label)
Sets the button's label.- Parameters:
label- the label text; treated as empty ifnull- Returns:
- this Button for chaining
-
onActivate
public Button onActivate(java.lang.Runnable handler)
Sets the action run when the button is activated.- Parameters:
handler- the activation handler- Returns:
- this Button for chaining
-
style
public Button style(Style style)
Sets the style used when the button is not focused.- Parameters:
style- the unfocused style- Returns:
- this Button for chaining
-
-