= radiobutton
:revnumber: 2.0
:revdate: 2020/07/25



== 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 xref:gui/tonegodgui/quickstart.adoc[Quick Start Guide].

*Constructor 1:*

[source,java]
----

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

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

----

*Constructor 2:*

[source,java]
----

/** Additional Parameter:
  * Vector2f dimensions  */

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

----

*Constructor 3:*

[source,java]
----

/** 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:

[source,java]
----

// 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:

[source,java]
----

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

----


=== Abstract Event Methods:

[source,java]
----

public void onChange(boolean isChecked);

----
