Picture: scrolling
Use a picture scroll field to display a row of images that a BlackBerry device user can scroll through horizontally.
Class
Supported since
BlackBerry Java SDK 5.0
More information
For more information about picture scroll fields, see the UI Guidelines.
Example
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);
}
}