.. default-domain:: java .. highlight:: java .. package:: krpc.client.services.UI Toggle ====== .. type:: public class Toggle A control that is either checked or not. Added to a :type:`Canvas` or a :type:`Panel`. .. note:: On its own a toggle is a check box. Put several of them in the same :type:`ToggleGroup` and they become radio buttons, as only one toggle in a group can be checked at a time. | Base class: :type:`InputControl` .. container:: inherited-members .. rubric:: Inherited Members * From :type:`InputControl`: :meth:`getChanged `, :meth:`setChanged ` * From :type:`Control`: :meth:`getInteractable `, :meth:`setInteractable `, :meth:`getColor `, :meth:`setColor `, :meth:`getTooltip `, :meth:`setTooltip ` * From :type:`Object`: :meth:`getRectTransform `, :meth:`getLayoutElement `, :meth:`getVisible `, :meth:`setVisible `, :meth:`remove ` .. method:: Text getText() The text for the toggle. .. method:: boolean getChecked() .. method:: void setChecked(boolean value) Whether the toggle is checked. .. note:: Checking a toggle that belongs to a :type:`ToggleGroup` unchecks the rest of that group, whether or not it is on the screen. .. method:: ToggleGroup getGroup() .. method:: void setGroup(ToggleGroup value) The group that the toggle belongs to, or ``null`` if it does not belong to one. .. note:: Only one toggle in a group can be checked at a time, so a group turns a set of toggles into radio buttons. A group does not have to contain the toggles, so they can be grouped independently of how they are laid out.