Element: ComboBox.
Icon:
Text: A drop-down list to display and select a string.
Description: A ComboBox is a basic element that displays a drop-down list of text options from which the user can choose one. The element invokes an action when the option selected changes.
A combo box can be made editable (setting the "Editable" property to true), in which case, the option can be chosen by typing it in the visualization field. In this case, the option is only accepted when the 'Enter' key is hit. To make this evident, the background of the field will change color while you type, displaying the original background color when the new value is accepted.
Table of properties |
||
Name | Description | Values accepted |
Main | ||
Variable | The variable modified when an option is selected. | A variable of type String. |
Options | The options displayed in the drop-down list. | Any constant or variable of type String. The string must contain a list of the desired options separated by semicolons ';'. White spaces are significant. For instance, the image above was created with the value of this property set to "Option 1;Option 2;Option 3". |
Value | An initial value for the option. | Any constant or variable of type String. |
Editable | Whether it is possible to select an option by typing in the visualization field. | A boolean variable or one of the constants true or false. |
Action | The action to invoke when an option is selected. | The Java code to invoke for the action. |
Graphical Aspect | ||
Size | The size of the element. | An Object variable of the class java.awt.Dimension or the integer values for the width and the height, respectively, separated by a comma. |
Color Ed. | The background color for the visualization field when it is editable. | See the values for the Background property. |
Background | The color used for the background of the element. | An Object variable of the class java.awt.Color
or one of the predefined colors: black,
blue, cyan, darkGray, gray, green, lightGray, magenta, orange, pink,
red, white, yellow.
A color can also be specified providing its integer RGB coordinates (between 0 and 255), plus an optional transparency coordinate. The default value is decided by the system. |
Foreground | The color used for the text displayed by the element. | See the values for the Background property. |
Font | The font used for the text displayed by the element. | An Object variable of the class java.awt.Font
or a set of family, style and size, separated by commas. The style
must be one of plain,
bold, italic, bold | italic. Example: Monospaced,italic,18.
The default value is decided by the system. |
Tooltip | The text displayed when the cursor lingers on top of the element. | Any constant or variable of type String. |