MButton

Description

A MButton represents a button widget. It's a sub-class of MonoiDataComponent. Button's action can be implemented very simply.

A simple example

1st example

1    //declare a MButton    
2    MButton button = new MButton(container, "Button", this, "action1");
3
4    //define an action for MButton    
5    public void action1() throws Exception {
6        System.out.println("An action has been triggered");
7    }

Other example

 1    //declare a MButton    
 2    MButton button = new MButton(container, "with dynamic label");
 3
 4    //set the data's path for getting a value and showing it    
 5    button.setValueDataPath("person.surname");
 6    button.getActions().onClick(this, "action1");
 7
 8    //define an action of MButton    
 9    public void action1() throws Exception {
10        System.out.println("Another action has been triggered");
11    }

API

  • Constructors
MButton(MonoiContainer container, String label) Constructs a new instance of this class given its parent, container and button's text.
MButton(MonoiContainer container, String label, Object actionObject, String actionMethodName) Constructs a new instance of this class given its parent button's text and action which has been defined
MButton(MonoiContainer container, String label, Image image, Object actionObject,String actionMethodName) Constructs a new instance of this class given its parent button's text ,image and action
  • Methods
MButtonActionSet getActions() Gets the action's set
Object getValue() Gets the value which is the button's text
void setValue(Object value) Sets the button's text
String toString() Gets the Component's value of String
  • See also superclasses
    • MonoiComponent and MonoiDataComponent

MButton.jpg (28.8 kB) Frédéric ESNAULT, 02/27/2012 11:45 am