Skip to main content

How to modify the color of a SUICheckBox by script using Java

When the SUICheckBox is unchecked

In your Java class, do the following:

public class YourClass extends Component {

// create a new color
public Color color = new Color(255, 255, 0, 0);

// creates a new SUICheckBox, @AutoWired selects the component from this object
@AutoWired
private SUICheckBox checkBox;

@Override
public void start() {

}

@Override
public void repeat() {

// change the color of the SUICheckBox
checkBox.setUncheckedColor(color);
}
}

When SUICheckBox is checked

In your Java class, do the following:

public class YourClass extends Component {

// create a new color
public Color color = new Color(255, 255, 0, 0);

// creates a new SUICheckBox, @AutoWired selects the component from this object
@AutoWired
private SUICheckBox checkBox;

public void start() {

}

public void repeat() {

// change the color of the SUICheckBox
checkBox.setCheckedColor(color);
}
}