8.7.7.2.11 VCellular Gauge

Need to see a numeric value displayed in gauge format? This bean solves your problem. You can set the maximum value, the minimum value, the number of cells to be of your own choice. You can also choose the foreground color, the background color, the cell color according to your preference.

 

Following are some of the main events invoked by the VCellularGauge component - the usual mouse events, mouse motion events, component events, key events, focus events, propertyChange and vetoableChange.

 

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 VCellularGauge component.

 

Property

 

Description

 

Scale Points

Sets the number of points on the scale of the VCellularGauge

ThresholdValue1

Sets the threshold value beyond which the color changes to the Threshold Color1

ThresholdValue2

Sets the threshold value beyond which the color changes to the Threshold Color2

NoOfCells

Sets the number of cells in the VCellularGauge

 

The VCellularGauge is related to the HCellular Gauge. While one offers a display in the form of a vertical positioning, the other offers a display in the form of a horizontal positioning.

 

The main method is the setResult method that displays the polled value on the VCellular Gauge.

 

How to use the VCellular Gauge bean

 

The VCellularGauge bean can be used alongwith other beans like the JTextField(to display the value that is given in the text-field).

 

The following code snippet explains how to instantiate and use the methods of the VCellularGauge.

 

com.adventnet.beans.gauges.HCellularGauge gauge1 = new com.adventnet.beans.gauges.HCellularGauge();

gauge1.setMinValue(0);

gauge1.setMaxValue(200);

gauge1.setScalePoints(3);

gauge1.setBgColor(Color.blue);

gauge1.setFgColor(Color.green);

gauge1.setThresholdValue1(100);

gauge1.setThresholdColor1(Color.red);

gauge1.setResult(75); 

 

The first line does the instantiation. The second and third lines set the maximum and minimum values. The fourth line sets the number of scale points to be 3. The fifth and sixth lines set the background and foreground colors. The seventh line sets the threshold value to be 100. The eighth value sets the threshold color to be red. The last line sets the value displayed to be 75.

 

Now, using the Interaction Wizard, these can be connected to the JTextField bean or beans from the AdventNetSnmp beans jar or to other beans.



Copyright © 2011 ZOHO Corp. All Rights Reserved.