8.7.7.2.4 Digital Display

 

Do you want to display the numeric value in a digital format? Look no further! Here is a bean that does just that.

 

Set the number of digits the display can hold according to your preference. The foreground color of the bean and the color of the segments that are not currently in the display can be set. These are useful if you want to write event Listeners or use the Interaction Wizard to get another bean to behave in a particular way once a certain event occurs.

 

Following are some of the main properties associated with the DigDisp bean.

 

Property

 

Description

 

numericValue

The numerical value displayed in the DigDisp component

numDigits

The number of digits in the DigDisp component.

offColor

The color of the segments that are not involved in the display

 

The bean that is related to the DigDisp bean is the Digit bean in the AdventNet UI beans jar. The difference is that the Digit bean cannot display more than one digit.

 

The main method that is used in the DigDisp bean is the setNumericValue method which can be used to display a polled value.

 

How to use the Digital Display bean

 

The Digital Display bean can be used along with other beans like the JTextField(to display the value that is given in the text-field). The functionality provided by beans can be extended.It can be extended to display the value in binary or to any other base (less than or equal to 9).

 

The following code snippets explain how to use the methods of the Digital Display. In the custom code portion of the Digital Display digdisp1, enter the following

 

digdisp1.setNumDigits(4);

digdisp1.setForeground(Color.blue);

digdisp1.setOffColor(Color.black);

digdisp1.setNumericValue(1550);

 

The first line sets the number of digits to be 4. The second line sets the foreground color to be blue. The third line sets the color of the segments not involved in the display to be black. The fourth line sets the numeric value to be 1550.



Copyright © 2011 ZOHO Corp. All Rights Reserved.