Recipe 9.1.
Creating an Outline Around a Text Field
Problem
You
want to place a border around
a text field.
Solution
Set the text field's border property to
true. Additionally, you can change the color of the border
by setting the object's borderColor property.
Discussion
By default, a text field does not have a visible
border, which is assumed to be the most common preferred behavior.
For example, you may not want a border around an item label.
However, there are many cases in which you will want to apply a
border to a text field, such as a field that requires some user
input. The border shows the user where to click to input a value.
Simply setting a text field's border property to true
turns on the border around the object:
field.border = true;
To turn off the border, simply set the
border property to false.
The default border color is black, but that can
be changed with the borderColor property, which accepts a
hex RGB value corresponding to the desired color:
field.borderColor = 0xFF00FF; // Make the border violet.
|