new XYEdges(Color.OLIVE, Color.OLIVE, Color.OLIVE, Color.OLIVE);
// Set the title of the application
setTitle("D�cor Demo");
add(new RichTextField(Field.NON_FOCUSABLE));
// Sample text field with a thick and solid rounded border
// and single solid color background.
final RichTextField simpleField =
new RichTextField("Solid rounded border, solid background");
// Create border and background objects
final Border roundedBorder =
BorderFactory.createRoundedBorder(thickPadding,
Border.STYLE_SOLID);
final Background solidBackground =
BackgroundFactory.createSolidBackground(Color.LIGHTSTEELBLUE);
// Set the objects for use
simpleField.setBorder(roundedBorder);
simpleField.setBackground(solidBackground);
// Add the field to the screen
add(simpleField);
add(new RichTextField(Field.NON_FOCUSABLE));
// Sample text field with a thick and dotted rounded border
// and single color transparent background.
final RichTextField transparentField =
new RichTextField(
"Dotted rounded border, transparent background");
final Border dottedBorder =
BorderFactory.createRoundedBorder(thickPadding,
Border.STYLE_DOTTED);
final Background transparentBackground =
BackgroundFactory.createSolidTransparentBackground(
Color.LIGHTSTEELBLUE, 50);
transparentField.setBorder(dottedBorder);
transparentField.setBackground(transparentBackground);
add(transparentField);
add(new RichTextField(Field.NON_FOCUSABLE));
// Sample text field with a thick and dashed border
// and gradient background.
final RichTextField gradientField =
new RichTextField("Dashed simple border, gradient background");
final Border dashedBorder =
BorderFactory.createSimpleBorder(thickPadding, blueColors,
Border.STYLE_DASHED);
final Background gradientBackground =
BackgroundFactory.createLinearGradientBackground(Color.RED,
Color.GREEN, Color.BLUE, Color.WHITE);
gradientField.setBorder(dashedBorder);
gradientField.setBackground(gradientBackground);
add(gradientField);
add(new RichTextField(Field.NON_FOCUSABLE));
// Sample text field with a no padding dotted border and no background.
final RichTextField noPaddingField =
new RichTextField("Dotted simple border, no padding");
final Border noPaddingBorder =
BorderFactory.createSimpleBorder(noPadding, oliveColors,
Border.STYLE_DOTTED);
noPaddingField.setBorder(noPaddingBorder);
add(noPaddingField);
add(new RichTextField(Field.NON_FOCUSABLE));
// Sample text field with a thick bevel border and bitmap background.
final RichTextField bevelAndBitmapField =
new RichTextField("Bevel border, bitmap background");
final Border bevelBorder =
BorderFactory.createBevelBorder(thickPadding, multiColors,
pinkColors);
// Attempt to load a bitmap background
try {
final Background bitmapBackground =
BackgroundFactory.createBitmapBackground(Bitmap
.getBitmapResource("smiley.bmp"),
Background.POSITION_X_CENTER,
Background.POSITION_Y_CENTER,
Background.REPEAT_BOTH);
bevelAndBitmapField.setBackground(bitmapBackground);
} catch (final IllegalArgumentException e) {
UiApplication.getUiApplication().invokeLater(new Runnable() {
public void run() {
Dialog.alert(e.toString());
}
});
}
bevelAndBitmapField.setBorder(bevelBorder);
add(bevelAndBitmapField);
}