radiobutton

RadioButton Class

  • RadioButton’s extend the CheckBox class

  • They provide a default label (which is only added if the label text is set).

  • They provide the abstract method onChange for executing code when the RadioButton is altered by the user.

Again, the same three options for constructor are available as show in the Quick Start Guide.

Constructor 1:

/** Parameters:
  * Screen screen,
  * String UID,
  * Vector2f position
  */

RadioButton rb = new RadioButton(screen, "rb", new Vector2f(15, 15));

Constructor 2:

/** Additional Parameter:
  * Vector2f dimensions  */

RadioButton rb = new RadioButton(screen, "rb", new Vector2f(15, 15),
    new Vector2f(25, 25)
);

Constructor 3:

/** Additional Parameters:
  * Vector4f resizeBorders,
  * String defaultImg
  */

RadioButton rb = new RadioButton(screen, "rb", new Vector2f(15, 15), new Vector2f(25, 25),
    new Vector4f(3,3,3,3),
    "tonegod/gui/style/def/Button/radiobutton_u_x.png"
);

Hover State

You can override the default hover state using the following method:

// Override the information used by the hover effect
cb.setButtonHoverInfo(String imagePath, ColorRGBA textHoverColor);

Pressed State

You can override the default pressed state using the following method:

// Override the information used by the pressed effect
cb.setButtonPressedInfo(String imagePath, ColorRGBA textPressedColor);

Abstract Event Methods:

public void onChange(boolean isChecked);