Class RadioButton

  • All Implemented Interfaces:
    kotlin.Cloneable

    
    public final class RadioButton<T extends Object>
    extends ContainingComponent
                        

    A radiobutton component in PolyUI. Supports an array of generic values as options.

    • Method Detail

      • onInitComplete

         Unit onInitComplete()

        This function is called when initialization of a drawable is complete, so it has been fully calculated.

        This function is called once, and only once.

      • calculateBounds

         Unit calculateBounds()

        Calculate the position and size of this drawable. Make sure to call doDynamicSize in this method to avoid issues with sizing.

        This method is called once the layout is populated for children and component, and when a recalculation is requested.

        The value of layout's bounds will be updated after this method is called, so do not use layout's bounds as an updated value in this method.

      • accept

         Boolean accept(Event event)

        called when this drawable receives an event.

        make sure to call Drawable.accept!

      • calculateSize

         Vec2<Unit> calculateSize()

        Implement this function to return the size of this drawable, if no size is specified during construction.

        This should be so that if the drawable can determine its own size (for example, it is an image), then the size parameter in the constructor can be omitted using:

        size: Vec2<org.polyfrost.polyui.unit.Unit>? = null; and this method needs to be implemented!

        Otherwise, the size parameter in the constructor must be specified.

      • setup

         Unit setup(Renderer renderer, PolyUI polyUI)

        give this a renderer reference and a PolyUI reference.

        You can also use this method to do some calculations (such as text widths) that are not dependent on other sizes.

        If you need a method that has access to component's sizes, see here or here (if you are operating on yourself only).

        this method is called once, and only once.