Picture scroll field

Use a picture scroll field to display a row of images that BlackBerry® device the user can scroll through horizontally.

Class PictureScrollField
Supported since BlackBerry® Java® SDK 5.0
Example This screen shows a picture scroll field.

For more information about picture scroll fields, see the UI Guidelines.

Code sample: Creating a picture scroll field

import net.rim.device.api.system.*;
import net.rim.device.api.ui.*;
import net.rim.device.api.ui.container.*;
import net.rim.device.api.ui.decor.*;    
import net.rim.device.api.ui.extension.component.*;
import net.rim.device.api.ui.extension.component.PictureScrollField.*;

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

class PictureScrollFieldDemoScreen extends MainScreen
{
    public PictureScrollFieldDemoScreen()
    {             
        setTitle("Picture Scroll Field Demo");
        
        Bitmap[] images = new Bitmap[3];
        String[] labels = new String[3];
        String[] tooltips = new String[3];

        images[0] = Bitmap.getBitmapResource("image1.jpg");
        labels[0] = "Label for image 1";
        tooltips[0] = "Tooltip for image 1";

        images[1] = Bitmap.getBitmapResource("image2.jpg");
        labels[1] = "Label for image 2";
        tooltips[1] = "Tooltip for image 2";

        images[2] = Bitmap.getBitmapResource("image3.jpg");
        labels[2] = "Label for image 2";
        tooltips[2] = "Tooltip for image 2";

        ScrollEntry[] entries = new ScrollEntry[3];

        for (int i = 0; i < entries.length; i++) 
        { 
             entries[i] = new ScrollEntry(images[i], labels[i],tooltips[i]);
        }

        PictureScrollField pictureScrollField = new PictureScrollField(150, 100);
        pictureScrollField.setData(entries, 0);
        pictureScrollField.setHighlightStyle(HighlightStyle.ILLUMINATE_WITH_SHRINK_LENS);
        pictureScrollField.setHighlightBorderColor(Color.BLUE);
		
        pictureScrollField.setBackground(BackgroundFactory.createSolidTransparentBackground(Color.BLACK, 150));

        pictureScrollField.setLabelsVisible(true); 

        add(pictureScrollField);
    }
}
Next topic: Lists and tables
Previous topic: Bitmap field

Was this information helpful? Send us your comments.