Package snap.view

Class ButtonBase

All Implemented Interfaces:
PropChange.DoChange, XMLArchiver.Archivable
Direct Known Subclasses:
Button, MenuButton, MenuItem, ToggleButton

public class ButtonBase extends ParentView
A View for Buttons.
  • Field Details

  • Constructor Details

    • ButtonBase

      public ButtonBase()
      Creates a new ButtonBaseNode.
  • Method Details

    • getLabel

      public Label getLabel()
      Returns the label.
    • getText

      public String getText()
      Returns the text.
      Overrides:
      getText in class View
    • setText

      public void setText(String aStr)
      Sets the text.
      Overrides:
      setText in class View
    • getImage

      public Image getImage()
      Returns the image.
    • setImage

      public void setImage(Image anImage)
      Sets the image.
    • getImageAfter

      public Image getImageAfter()
      Returns the image after text.
    • setImageAfter

      public void setImageAfter(Image anImage)
      Sets the image after text.
    • getGraphic

      public View getGraphic()
      Returns the graphic node.
    • setGraphic

      public void setGraphic(View aGraphic)
      Sets the graphic node.
    • getGraphicAfter

      public View getGraphicAfter()
      Returns the graphic node after text.
    • setGraphicAfter

      public void setGraphicAfter(View aGraphic)
      Sets the graphic node after text.
    • getTextFill

      public Paint getTextFill()
      Returns the text fill.
    • setTextFill

      public void setTextFill(Paint aFill)
      Sets the text fill.
    • getImageName

      public String getImageName()
      Returns the image name, if loaded from local resource.
    • setImageName

      public void setImageName(String aName)
      Sets the image name, if loaded from local resource.
    • isShowArea

      public boolean isShowArea()
      Returns whether button displays the standard background area.
    • setShowArea

      public void setShowArea(boolean aValue)
      Sets whether button displays the standard background area.
    • getPosition

      public Pos getPosition()
      Returns the position of the button when in a group (determines corner rendering).
    • setPosition

      public void setPosition(Pos aPos)
      Sets the position of the button when in a group (determines corner rendering).
    • isPressed

      public boolean isPressed()
      Returns whether button is pressed (visibly).
    • setPressed

      protected void setPressed(boolean aValue)
      Sets whether button is pressed (visibly).
    • isTargeted

      public boolean isTargeted()
      Returns whether button is under mouse.
    • setTargeted

      protected void setTargeted(boolean aValue)
      Sets whether button is under mouse.
    • isSelected

      public boolean isSelected()
      Returns whether button is selected (really for ToggleButton subclasses).
    • processEvent

      protected void processEvent(ViewEvent anEvent)
      Handle events.
      Overrides:
      processEvent in class View
    • fire

      public void fire()
      Perform button click.
    • fireActionEvent

      protected void fireActionEvent(ViewEvent anEvent)
      Override to consume event.
      Overrides:
      fireActionEvent in class View
    • paintFront

      protected final void paintFront(Painter aPntr)
      Paint Button.
      Overrides:
      paintFront in class View
    • paintButton

      protected void paintButton(Painter aPntr)
      Paint Button.
    • paintAll

      public void paintAll(Painter aPntr)
      Override to do bogus disabled painting.
      Overrides:
      paintAll in class ParentView
    • getPrefWidthImpl

      protected double getPrefWidthImpl(double aH)
      Returns the preferred width.
      Overrides:
      getPrefWidthImpl in class View
    • getPrefHeightImpl

      protected double getPrefHeightImpl(double aW)
      Returns the preferred height.
      Overrides:
      getPrefHeightImpl in class View
    • layoutImpl

      protected void layoutImpl()
      Override to layout children.
      Overrides:
      layoutImpl in class ParentView
    • getViewProxy

      protected BoxViewProxy<?> getViewProxy()
      Returns the ViewProxy to layout button.
      Overrides:
      getViewProxy in class ParentView
    • initProps

      protected void initProps(PropSet aPropSet)
      Override to add properties for this class.
      Overrides:
      initProps in class ParentView
    • getPropValue

      public Object getPropValue(String aPropName)
      Override for ButtonBase properties.
      Overrides:
      getPropValue in class ParentView
    • setPropValue

      public void setPropValue(String aPropName, Object aValue)
      Override for ButtonBase properties.
      Overrides:
      setPropValue in class ParentView
    • toXMLView

      protected XMLElement toXMLView(XMLArchiver anArchiver)
      XML archival.
      Overrides:
      toXMLView in class ParentView
    • fromXMLView

      protected void fromXMLView(XMLArchiver anArchiver, XMLElement anElement)
      XML unarchival.
      Overrides:
      fromXMLView in class ParentView