Class WIconPair


public class WIconPair extends WCompositeWidget
A widget that shows one of two icons depending on its state.

This is a utility class that simply manages two images, only one of which is shown at a single time, which reflects the current 'state'.

The widget may react to click events, by changing state.

CSS

This widget does not provide styling, and can be styled using inline or external CSS as appropriate. The image may be styled via the <img> elements.

  • Constructor Details

  • Method Details

    • setState

      public void setState(int num)
      Sets the state, which determines the visible icon.

      The first icon has number 0, and the second icon has number 1.

      The default state is 0.

      See Also:
    • getState

      public int getState()
      Returns the current state.

      See Also:
    • getIcon1

      public WImage getIcon1()
      Returns the first icon image.
    • getIcon2

      public WImage getIcon2()
      Returns the second icon image.
    • showIcon1

      public void showIcon1()
      Sets the state to 0 (show icon 1).

      See Also:
    • showIcon2

      public void showIcon2()
      Sets the state to 1 (show icon 2).

      See Also:
    • icon1Clicked

      public EventSignal1<WMouseEvent> icon1Clicked()
      Signal emitted when clicked while in state 0 (icon 1 is shown).

      Equivalent to:

      
       icon1().clicked()
      
       
    • icon2Clicked

      public EventSignal1<WMouseEvent> icon2Clicked()
      Signal emitted when clicked while in state 1 (icon 2 is shown).

      Equivalent to:

      
       icon2().clicked()