Class ColorEditor

  • All Implemented Interfaces:
    java.beans.PropertyEditor

    public class ColorEditor
    extends java.beans.PropertyEditorSupport
    Color editor that uses the JColorChooser.
    • Constructor Summary

      Constructors 
      Constructor Description
      ColorEditor()
      The default constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.awt.Component getCustomEditor()
      A PropertyEditor may chose to make available a full custom Component that edits its property value.
      java.lang.Object getValue()
      Get the value.
      boolean isPaintable()
      Return true which this editor can paint its property value.
      void paintValue​(java.awt.Graphics gfx, java.awt.Rectangle box)
      Paint a representation of the value into a given area of screen real estate.
      void setValue​(java.lang.Object value)
      Set (or change) the object that is to be edited.
      boolean supportsCustomEditor()
      Determines whether the propertyEditor can provide a custom editor.
      • Methods inherited from class java.beans.PropertyEditorSupport

        addPropertyChangeListener, firePropertyChange, getAsText, getJavaInitializationString, getSource, getTags, removePropertyChangeListener, setAsText, setSource
      • Methods inherited from class java.lang.Object

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

      • ColorEditor

        public ColorEditor()
        The default constructor.
    • Method Detail

      • getCustomEditor

        public java.awt.Component getCustomEditor()
        A PropertyEditor may chose to make available a full custom Component that edits its property value. It is the responsibility of the PropertyEditor to hook itself up to its editor Component itself and to report property value changes by firing a PropertyChange event.

        The higher-level code that calls getCustomEditor may either embed the Component in some larger property sheet, or it may put it in its own individual dialog, or ...

        Specified by:
        getCustomEditor in interface java.beans.PropertyEditor
        Overrides:
        getCustomEditor in class java.beans.PropertyEditorSupport
        Returns:
        A java.awt.Component that will allow a human to directly edit the current property value. May be null if this is not supported.
      • supportsCustomEditor

        public boolean supportsCustomEditor()
        Determines whether the propertyEditor can provide a custom editor.
        Specified by:
        supportsCustomEditor in interface java.beans.PropertyEditor
        Overrides:
        supportsCustomEditor in class java.beans.PropertyEditorSupport
        Returns:
        True if the propertyEditor can provide a custom editor.
      • setValue

        public void setValue​(java.lang.Object value)
        Set (or change) the object that is to be edited.
        Specified by:
        setValue in interface java.beans.PropertyEditor
        Overrides:
        setValue in class java.beans.PropertyEditorSupport
        Parameters:
        value - The new target object to be edited. Note that this object should not be modified by the PropertyEditor, rather the PropertyEditor should create a new object to hold any modified value.
      • getValue

        public java.lang.Object getValue()
        Get the value.
        Specified by:
        getValue in interface java.beans.PropertyEditor
        Overrides:
        getValue in class java.beans.PropertyEditorSupport
      • isPaintable

        public boolean isPaintable()
        Return true which this editor can paint its property value.
        Specified by:
        isPaintable in interface java.beans.PropertyEditor
        Overrides:
        isPaintable in class java.beans.PropertyEditorSupport
      • paintValue

        public void paintValue​(java.awt.Graphics gfx,
                               java.awt.Rectangle box)
        Paint a representation of the value into a given area of screen real estate. Note that the propertyEditor is responsible for doing its own clipping so that it fits into the given rectangle.

        If the PropertyEditor doesn't honor paint requests (see isPaintable) this method should be a silent noop.

        Specified by:
        paintValue in interface java.beans.PropertyEditor
        Overrides:
        paintValue in class java.beans.PropertyEditorSupport
        Parameters:
        gfx - Graphics object to paint into.
        box - Rectangle within graphics object into which we should paint.