Java Reference
In-Depth Information
Tutorial: Modifying Properties
Let's look at modifying properties:
1.
In the Design pane, click and drag on the lower-right-hand corner of the frame.
Notice that the value for the size property is no longer 132, 38.
2.
In the size property value, enter 400, 450 and press Enter.
Look what shows up: the Exit button. VE does realize that EmployeeFrame will inherit the Exit button from
UsefulFrame; however, the button isn't in the correct location. We will have to add the setExitButtonLocation
statement.
Also, notice the greater than sign (>) is placed before the size property name. This indicates that the property
has been modified.
3.
At the top of the Properties view, click on the background property.
A button with three periods (the value button) will be displayed in the value area.
4.
Click the background property's value button.
The Java Property Editor is displayed for the background property. There are several ways to specify a color.
Java actually recognizes some colors by name and the operating system (in this case Windows) also recognizes some
colors by name. The two panes list these color names and display a small color sample of each. Clicking on a color
will select it and a more detailed sample will be displayed in the Preview area at the bottom of the window.
5.
Scroll up in Basic Colors and click on Cyan.
Notice the more detailed sample in the Preview area.
Colors can also be defined as some combination of Red, Green, and Blue. The amount of each of these primary
colors is represented by a number from 0 to 255. (0 represents none of the color and 255 is the most that can be
specified for a color.)
6.
Click on the RGB tab.
The RGB pane shows the RGB definition of the color Cyan. You can specify new numbers by either typing in
values or using the slide bars. Either way, the sample will change based on your specifications.
7.
Enter 211 for Red, 204 for Green, and 92 for Blue.
8.
Click the OK button.
Notice that the background property value has been changed to 211, 204, 92. That is not a very attractive color, is it?
The other color tabs on the Java Property Editor window allow you to pick from a larger set of samples (Swatches)
or specify the color by clicking on an “infinite” color palette (HSB).
9.
Change the background property to lightGray, the title property to Employee Information
and save the code.
The frame should look like Figure 4-8 .
 
Search WWH ::




Custom Search