Skip to main content

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

When the SUIButton is not pressed

In your Java class, do the following:

public class YourClass extends Component {

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

// creates a new SUIButton, @AutoWired selects the component from this object
@AutoWired
private SUIButton button;

@Override
public void start() {

}

@Override
public void repeat() {

// changes the color of SUIButton
button.setNormalColor(color);
}
}

When the SUIButton is pressed

In your Java class, do the following:

public class YourClass extends Component {

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

// creates a new SUIButton, @AutoWired selects the component from this object
@AutoWired
private SUIButton button;

public void start() {

}

public void repeat() {

// changes the color of SUIButton
button.setNormalColor(color);
}
}