Would you like to tell us how we are doing?

You bet No thanks

Sorry about the red box, but we really need you to update your browser. Read this excellent article if you're wondering why we are no longer supporting this browser version. Go to Browse Happy for browser suggestions and how to update.

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

More information

For more information about buttons, see the UI Guidelines.

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

Example

This screen shows button fields.

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);
     }
}