Package weka.gui

Class ColorEditor

  • All Implemented Interfaces:
    java.beans.PropertyEditor

    public class ColorEditor
    extends java.lang.Object
    implements java.beans.PropertyEditor
    A property editor for colors that uses JColorChooser as the underlying editor.
    Version:
    $Revision: $
    Author:
    Mark Hall (mhall{[at]}pentaho{[dot]}com)
    • Constructor Summary

      Constructors 
      Constructor Description
      ColorEditor()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addPropertyChangeListener​(java.beans.PropertyChangeListener listener)  
      java.lang.String getAsText()
      Not representable as a string
      java.awt.Component getCustomEditor()
      Returns our JColorChooser object
      java.lang.String getJavaInitializationString()
      Don't really need this
      java.lang.String[] getTags()
      Not applicable - returns null
      java.lang.Object getValue()
      Get the current color
      boolean isPaintable()
      We paint our current color into the supplied bounding box
      void paintValue​(java.awt.Graphics gfx, java.awt.Rectangle box)
      Paint our current color into the supplied bounding box
      void removePropertyChangeListener​(java.beans.PropertyChangeListener listener)  
      void setAsText​(java.lang.String text)
      Throws an exception as we are not representable in text form
      void setValue​(java.lang.Object value)
      Set the current color
      boolean supportsCustomEditor()
      We use JColorChooser, so return true
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ColorEditor

        public ColorEditor()
    • Method Detail

      • setValue

        public void setValue​(java.lang.Object value)
        Set the current color
        Specified by:
        setValue in interface java.beans.PropertyEditor
        Parameters:
        value - the current color
      • getValue

        public java.lang.Object getValue()
        Get the current color
        Specified by:
        getValue in interface java.beans.PropertyEditor
        Returns:
        the current color
      • isPaintable

        public boolean isPaintable()
        We paint our current color into the supplied bounding box
        Specified by:
        isPaintable in interface java.beans.PropertyEditor
        Returns:
        true as we are paintable
      • paintValue

        public void paintValue​(java.awt.Graphics gfx,
                               java.awt.Rectangle box)
        Paint our current color into the supplied bounding box
        Specified by:
        paintValue in interface java.beans.PropertyEditor
        Parameters:
        gfx - the graphics object to use
        box - the bounding box
      • getJavaInitializationString

        public java.lang.String getJavaInitializationString()
        Don't really need this
        Specified by:
        getJavaInitializationString in interface java.beans.PropertyEditor
        Returns:
        some arbitrary string
      • getAsText

        public java.lang.String getAsText()
        Not representable as a string
        Specified by:
        getAsText in interface java.beans.PropertyEditor
        Returns:
        null
      • setAsText

        public void setAsText​(java.lang.String text)
                       throws java.lang.IllegalArgumentException
        Throws an exception as we are not representable in text form
        Specified by:
        setAsText in interface java.beans.PropertyEditor
        Parameters:
        text - text
        Throws:
        java.lang.IllegalArgumentException
      • getTags

        public java.lang.String[] getTags()
        Not applicable - returns null
        Specified by:
        getTags in interface java.beans.PropertyEditor
        Returns:
        null
      • getCustomEditor

        public java.awt.Component getCustomEditor()
        Returns our JColorChooser object
        Specified by:
        getCustomEditor in interface java.beans.PropertyEditor
        Returns:
        our JColorChooser object
      • supportsCustomEditor

        public boolean supportsCustomEditor()
        We use JColorChooser, so return true
        Specified by:
        supportsCustomEditor in interface java.beans.PropertyEditor
        Returns:
        true
      • addPropertyChangeListener

        public void addPropertyChangeListener​(java.beans.PropertyChangeListener listener)
        Specified by:
        addPropertyChangeListener in interface java.beans.PropertyEditor
      • removePropertyChangeListener

        public void removePropertyChangeListener​(java.beans.PropertyChangeListener listener)
        Specified by:
        removePropertyChangeListener in interface java.beans.PropertyEditor