Changing Foreground and Background Colors
You can change the foreground (font) and background colors of the
windows and the palette components directly through the attribute
editor or with the Foreground and Background dialog boxes.
To change colors through the attribute editor:
- Select the component or container.
- Open the attribute editor by clicking on its button in the main
toolbar.
- Type the name of a color (or its hexadecimal value) in the
foreground or background box.
- Click OK in the attribute editor to set the color.
To try out various colors, click Apply instead of OK to keep the
attribute editor open.
To change colors through
either the Foreground or Background dialog box:
- Click on the button to the right of either the foreground or
background boxes in the attribute editor. Use one of the following
methods to change colors:
- Use the Red, Green, and Blue (RGB) scrollbars.
You can use the scrollbars to adjust the RGB values to create custom
colors for your backgrounds and foregrounds. The values corresponding
to the scrollbar positions are displayed in the box to the right
of the scrollbar.
You can also directly enter a value from 0 to 255 in the box for each
color.
- Select a specific color from the Color Chooser.
Scroll down the color list in the closest color box and
click on the name of a color.
When you select a color value using one of these methods, the
Foreground or Background dialog box provides you with the following
feedback:
- Scroll boxes move to reflect the RGB values.
- The numbers to the right of the scrollbars change to
indicate their numeric values.
- The real color box displays the hexadecimal RGB
value for the color unless it is an exact match for one of
the predefined, named colors in the closest color list, in
which case the color's name is displayed.
- The color as it will appear in the application is displayed
in the Preview pane.
Click the Reset button to return the value to the
default color (gray for background; black for foreground).
If you decide to change colors for a container, apply the color
changes to the container before changing any component colors. Color
changes to a container override any color settings applied previously
to the components within the container.
See also:
- Laying Out the Interface
- Generating Java Source Code
- Visual Java GUI Builder API Documentation
- Visual Java GUI
Builder Runtime Packages
- Class Hierarchy
- Index of
All Fields and Methods