Open main menu

CDOT Wiki β

Changes

Lab BlackBerry Example

418 bytes added, 12:21, 27 February 2011
no edit summary
a. The class of that object must implement the ''FieldChangeListener'' interface.
b. The source of the event, namely the button object must add this particular listener to the collection of listeners.
------------------
Here is a generic code sample:
Here is a generic code sample:
1. Build the source object, the button:
ButtonField buttonField = new ButtonField("Test Button");
3. Add the listener object to the list of source listeners:
buttonField.setChangeListener(listener);
 
Important note: For expressiveness the steps 2 and 3 are combined to produce code like this:
 
buttonField.setChangeListener(new FieldChangeListener() {
public void fieldChanged(Field field, int context) {
ButtonField buttonField = (ButtonField) field;
System.out.println("Button pressed: " + buttonField.getLabel());
}
});
 
 
 
-----------------
Here is the code you must write to add the button ''_buttonGoBack'' to the second screen