Package totalcross.ui

Class ArrowButton

  • All Implemented Interfaces:
    TextControl

    public class ArrowButton
    extends Button
    A class used to display a Button with an arrow inside.
    • Field Detail

      • direction

        protected byte direction
        Graphics.ARROW_UP, Graphics.ARROW_DOWN, Graphics.ARROW_LEFT, or Graphics.ARROW_RIGHT.
      • prefWH

        protected int prefWH
        prefWH the desired arrow width/height. The effective arrow's size will be computed based in the current width/height.
      • xx

        protected int xx
        The x position.
      • yy

        protected int yy
        The y position.
      • kk

        protected int kk
        The current arrow size.
      • dkk

        protected int dkk
        The newly assigned arrow size.
      • arrowColor

        public int arrowColor
        The arrow's color.
    • Constructor Detail

      • ArrowButton

        public ArrowButton​(byte direction,
                           int prefWH,
                           int arrowColor)
        Constructs an ArrowButton.
        Parameters:
        direction - Graphics.ARROW_UP, Graphics.ARROW_DOWN, Graphics.ARROW_LEFT, or Graphics.ARROW_RIGHT.
        prefWH - The desired arrow width/height. The effective arrow's size will be computed based in the current width/height.
        arrowColor - The arrow color. Can be changed by setting the arrowColor field.
    • Method Detail

      • getPreferredWidth

        public int getPreferredWidth()
        Returns the preferred width of this control.
        Overrides:
        getPreferredWidth in class Button
        Returns:
        The preferred width of this control.
      • getPreferredHeight

        public int getPreferredHeight()
        Returns the preferred height of this control.
        Overrides:
        getPreferredHeight in class Button
        Returns:
        The preferred height of this control.
      • setArrowSize

        public void setArrowSize​(int kk)
        Sets the arrow size.
        Parameters:
        kk - The new size.
      • onBoundsChanged

        protected void onBoundsChanged​(boolean screenChanged)
        Called after a setRect().
        Overrides:
        onBoundsChanged in class Button
        Parameters:
        screenChanged - If the bounds was changed due to a screen change (rotation, collapse).
      • onPaint

        public void onPaint​(Graphics g)
        Called by the system to draw the ArrowButton.
        Overrides:
        onPaint in class Button
        Parameters:
        g - The graphics object for drawing.
        See Also:
        Graphics
      • toString

        public java.lang.String toString()
        Returns a string representation of the object.
        Overrides:
        toString in class java.lang.Object
        Returns:
        The string representation of the haired button plus its direction.