Class FButtonPGO

All Implemented Interfaces:
MouseListener, ImageObserver, ItemSelectable, MenuContainer, Serializable, EventListener, Accessible, SwingConstants

public class FButtonPGO extends FButton
Extends of FButton with some added functions to defined color & draw a circle button.
Author:
Hydrolien
See Also:
  • Field Details

    • supplier

      private Supplier supplier
    • colId

      private byte colId
  • Constructor Details

    • FButtonPGO

      public FButtonPGO(int action, BufferedImage icon, Supplier supplier)
      Main constructor.
      It remove rectangle background to draw a circle one.
      Parameters:
      action - the action of the button (between 350 & 399)
      icon - the image of the button
      supplier - a function that return a boolean (is enable), or a int/byte corresponding to a color id
  • Method Details

    • paintComponent

      public void paintComponent(Graphics g)
      Paint function.
      It draw a colored circle background & the image if not null.
      Overrides:
      paintComponent in class FButton
    • mouseReleased

      public void mouseReleased(MouseEvent event)
      Update color at every clics.
      Specified by:
      mouseReleased in interface MouseListener
      Overrides:
      mouseReleased in class FButton
    • updateColor

      public void updateColor()
      Update color depending of supplier return value. Supplier can return a boolean (is enable), or a int/byte corresponding to a color id.
    • setDefaultColor

      public void setDefaultColor()
      Swap color between green & yellow or other one if colorId have been set.
      Overrides:
      setDefaultColor in class FButton
    • setSelected

      public void setSelected(boolean selected)
      set the button selected or not.
      Desc are print on the button (mouse located).
      Overrides:
      setSelected in class FButton
      Parameters:
      selected - true if button is selected.
    • getDescEnabled

      public String getDescEnabled()
      Return a string representing the enabled or not state of the button.
    • getDesc

      protected String getDesc()
      Return the description of the button.
      Overrides:
      getDesc in class FButton