Button

Use a button to allow BlackBerry® device users to perform an action when they click the button.

Class ButtonField
Supported since BlackBerry® Java® SDK 4.0
Example This screen shows button fields.

For more information about buttons, see the UI Guidelines.

For information about advanced buttons , read the knowledge base article at about how to implement advanced buttons, fields and managers .

Code sample: Creating a button

import net.rim.device.api.ui.*;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.ui.container.*;

public class ButtonFieldDemo extends UiApplication
{
     public static void main(String[] args)
     {
          ButtonFieldDemo theApp = new ButtonFieldDemo();
          theApp.enterEventDispatcher();
     }
    
     public ButtonFieldDemo()
     {
          pushScreen(new ButtonFieldDemoScreen());
     }
}

class ButtonFieldDemoScreen extends MainScreen 
{ 
     public ButtonFieldDemoScreen()
     {
          setTitle("Button Field Demo");
          
          ButtonField addButton = new ButtonField("Add");
          ButtonField delButton = new ButtonField("Delete");
          
          add(addButton);
          add(delButton);
     }
}
Next topic: Activity fields
Previous topic: Toolbar

Was this information helpful? Send us your comments.