Java Toggle Control APIs

The following APIs are used to identify and automate toggle controls:

JavaToggleButton

JavaCheckBox

JavaRadioButton

tog_minusJavaToggleButton

The JavaToggleButton object is used to identify or automate a javax.swing.JToggleButton component or its subclasses.

Property

Description

bool Checked {get, set;}

Gets/Sets the state of the toggle button.

tog_minusJavaCheckBox

The JavaCheckBox object is used to identify or automate a javax.swing.JCheckBox component or its subclasses.

Property

Description

bool Checked {get, set;}

Gets/Sets the state of the checkbox.

public string Text {get;}

Gets the caption of the checkbox.

Changed Event

When the state of the control changes, the following event can be fired:

void MyCheckBox_Changed(object sender, EventArgs e)

Parameter

Description

sender

The element that triggered the event (i.e., the specific checkbox that was involved).

e

Requirements for the event.

The value of the new state is extracted from the EventArgs. For example:

{

  var checkBoxArgs = e as BoolEventArgs;

  bool value = checkBoxArgs.Value;

}

tog_minusJavaRadioButton

The JavaRadioButton object is used to identify or automate a javax.swing.JRadioButton component or its subclasses.

Property

Description

bool Checked {get, set;}

Gets/Sets the state of the radio button.

public string Text {get;}

Gets the caption of the radio button.

Changed Event

When the state of the control changes, the following event can be fired:

void MyRadioButton_Changed(object sender, EventArgs e)

Parameter

Description

sender

The element that triggered the event (i.e., the specific radio button that was involved).

e

Requirements for the event.

The value of the new state is extracted from the EventArgs. For example:

{

  var radioArgs = e as BoolEventArgs;

  bool value = radioArgs.Value;

}