Package snap.viewx

Class ColorWell

All Implemented Interfaces:
PropChange.DoChange, XMLArchiver.Archivable

public class ColorWell extends View
This control view displays a color value and interacts with ColorPanel when selected.
  • Field Details

  • Constructor Details

    • ColorWell

      public ColorWell()
      Creates a new ColorWell.
  • Method Details

    • getColor

      public Color getColor()
      Returns the color represented by this color well.
    • setColor

      public void setColor(Color aColor)
      Sets the color represented by this color well.
    • isSelected

      public boolean isSelected()
      Returns whether color well is selected.
    • setSelected

      public void setSelected(boolean aValue)
      Sets whether color well is selected.
    • isSelectable

      public boolean isSelectable()
      Returns whether or not the well can be selected.
    • setSelectable

      public void setSelectable(boolean aValue)
      Sets whether or not the well can be selected.
    • setDisabled

      public void setDisabled(boolean aValue)
      Override to make sure any colorwell that is disabled is also deselected
      Overrides:
      setDisabled in class View
    • paintFront

      protected void paintFront(Painter aPntr)
      Paints the color well.
      Overrides:
      paintFront in class View
    • paintSwatch

      public static void paintSwatch(Painter aPntr, Color c, double x, double y, double w, double h)
      Paints a color swatch in a standard way. Used to paint color wells, drag images, and color docks.
    • processEvent

      protected void processEvent(ViewEvent anEvent)
      Calls mouse methods.
      Overrides:
      processEvent in class View
    • showColorPanel

      public void showColorPanel()
      Shows the color panel.
    • setShowing

      protected void setShowing(boolean aValue)
      Override to set Selected to false when hidden.
      Overrides:
      setShowing in class View
    • getValuePropName

      public String getValuePropName()
      Returns a mapped property name.
      Overrides:
      getValuePropName in class View
    • getPropValue

      public Object getPropValue(String aPropName)
      Override because TeaVM hates reflection.
      Overrides:
      getPropValue in class View
    • setPropValue

      public void setPropValue(String aPropName, Object aValue)
      Override because TeaVM hates reflection.
      Overrides:
      setPropValue in class View
    • colorPanelChangedColor

      protected void colorPanelChangedColor(ColorPanel aCP, ViewEvent anEvent)
      Called by ColorPanel when user selects color in color panel.
    • toXML

      public XMLElement toXML(XMLArchiver anArchiver)
      XML archival.
      Specified by:
      toXML in interface XMLArchiver.Archivable
      Overrides:
      toXML in class View
    • fromXML

      public Object fromXML(XMLArchiver anArchiver, XMLElement anElement)
      XML unarchival.
      Specified by:
      fromXML in interface XMLArchiver.Archivable
      Overrides:
      fromXML in class View