Decor sample app
The decor sample application demonstrates how to create custom fields by specifying their border, padding, color, and background attributes.
You can use the sample application to create fields that have the following attributes:
- solid rounded border with a solid background
- dotted rounded border with a transparent background
- dashed simple border with a gradient background
- dotted simple border with no padding
- beveled border with an image as a background
This file contains the DecorDemo class (a UiApplication subclass) and the DecorDemoScreen class (a Mainscreen subclass), which contains the logic for creating and displaying text fields with customized borders and backgrounds.
This file is the .bmp file that the Background object displays in one of the examples of a text field.
This sample features the following classes:
This class represents a rectangular region that is not focusable and that is contained within a screen or a field. You can create Background objects by calling one of the BackgroundFactory methods. You can also define and create custom Background objects by extending the Background class.
The sample application provides an example of a different background for each RichTextField object that the screen displays. The sample application demonstrates how to create Background objects by using different BackgroundFactory methods and the fields from the Background class.
This class represents a border with four edges around a rectangular region that is not focusable and that is contained within a screen or a field. You can create Border objects by calling one of the BorderFactory methods. You can also define and create custom Border objects by extending the Border class.
The sample application provides an example of a different border for each RichTextField object that the screen displays. The sample application demonstrates how to create Border objects by using different BorderFactory methods, fields from the Border class, and custom XYEdges objects.
This class represents a read-only field that displays text in a variety of fonts and formatting.
The sample application uses RichTextField objects to display different configurations of Background, Border, and XYEdges objects. In the sample application, each RichTextField object displays a text description of its appearance. In the sample application, the RichTextField constructor uses the Field.NON_FOCUSABLE field to make the RichTextField objects not focusable.
This class specifies the padding, border, and margins of an object.
The sample application uses XYEdges objects to define different configurations of colors and padding for a Border object.
Install the sample app
Visit www.blackberry.com/go/decorsample to download the sample application.
Extract the decordemo.zip file.
On the taskbar, click Start > Programs > Research In Motion > BlackBerry JDE 4.7.0 > JDE.
Open the workspace that you want to add the sample application to.
In the workspace tree, right-click the project that you want to add the sample application to.
Click Add project to <workspace directory>.
In the Add project to <workspace> dialog box, browse to the folder where you extracted the sample application.
Click the DecorDemo.jdp file.
The sample app is also available in github.
Run the sample app
In the workspace where you added the decordemo project, right-click decordemo.
Click Build project.
On the taskbar, click Start > Applications > Research in Motion > BlackBerry JDE 4.7.0 > Device Simulator.
On the Home screen of the BlackBerry Smartphone Simulator, click the Downloads folder.
Click the Decor Demo icon.