Configuring the beans

In the next step you configure the beans by providing values for all properties that differ from their default values. Start with selecting the first (top) NumericTextLine by clicking on it either in the forms window or in the navigator. In the Properties window you now see a list of all its properties, sorted into different categories. Use the scrollbar or enlarge the window to see them all. Every entry contains the name of the property on the left hand side, to the right its current value is displayed and can be changed.

Spot the title property, click onto its current value ("Title") and change it to "Real part". You have to confirm the new value with <Enter>. The forms window immediately reacts to the change. In the same way enter the following properties:

name old value new value
description Description x =
unit Unit "" (empty string)
offset 0 30
precision 3 6

offset is used to align the number fields of several NumericTextLines, precision denotes the number of decimals shown.

Likewise change the properties of the other NumericTextLines:

2. input line    
name old value new value
title Title Imaginary part
description Description y =
unit Unit ""
offset 0 30
precision 3 6
1. output line    
name old value new value
title Title Absolute value
description Description r =
unit Unit ""
offset 0 30
precision 3 6
2. output line    
name old value new value
title Title Phase angle
description Description phi =
unit Unit rad
offset 0 30
precision 3 6

The lower two lines are only used for output, therefore remove the mark at the property editable. During typing some of the texts in the applet window may overlap, but at the end they should adjust automatically. If not, you must enlarge the applet window accordingly.

The applet looks much prettier, if you replace the text "phi" by the corresponding greek letter $ \varphi$. If you don't find it on your keyboard - which will probably be the case if you are outside of Greece -, you can input it by giving its number in the universal Unicode encoding in the form "\u03c6". For Java, which internally uses Unicode anyway, this is no problem, but NetBeans is »too clever« for that: It replaces the backslash \ during typing of the description field by \\. 1

Fortunately there is a simple solution: Instead of typing the text directly, click onto the icon 7465 to the right. This opens the window of the Custom Editor, which provides additional means to input property values. Change the value in the drop-down box from Plain text to Custom code and enter the text "\u03c6 =". Confirm with Ok.

The applet in the forms window now shows the standard text, but a glance at the source code proves that our trick has worked: Though the forms editor can't cope with unicode characters, the source code is correct. Check it by changing to the Source view, click onto the plus sign next to Generated Code and look for the corresponding line. It now reads:

  numericTextLine4.setDescription("\u03c6 =");

For the final proof compile and start the applet. Even though it doesn't compute anything, it already looks correctly.

Remarks:

1 Try it and look at the source code to confirm this statement!

ZurückWeiter