Skip to main content

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

When the SUIButton is unchecked

In your Java class, do the following:

public class YourClass extends Component {

// creates a new texture
public Texture texture; // select in properties

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

@Override
public void start() {

}

@Override
public void repeat() {

// changes the texture of the SUICheckBox
checkBox.setUncheckedImage(texture);
}
}

When SUIButton is checked

In your Java class, do the following:

public class YourClass extends Component {

// creates a new texture
public Texture texture; // select in properties

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

public void start() {

}

public void repeat() {

// changes the texture of the SUICheckBox
checkBox.setCheckedImage(texture);
}
}