Class PaintEditor

  • All Implemented Interfaces:
    java.beans.PropertyChangeListener, java.beans.PropertyEditor, java.util.EventListener

    public class PaintEditor
    extends java.beans.PropertyEditorSupport
    implements java.beans.PropertyChangeListener
    A JavaBeans property editor for Paint instances. Obviously, we can't provide editing for every type of Paint, but we'll try to cover Paint and GradientPaint.
    • Constructor Summary

      Constructors 
      Constructor Description
      PaintEditor()
      Creates a new instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.awt.Component getCustomEditor()
      Returns a component for editing a Paint instance.
      java.lang.String getJavaInitializationString()
      Returns a string for the property value.
      java.lang.Object getValue()  
      boolean isPaintable()  
      void paintValue​(java.awt.Graphics g, java.awt.Rectangle clipRect)  
      void propertyChange​(java.beans.PropertyChangeEvent evt)  
      void setValue​(java.lang.Object value)  
      boolean supportsCustomEditor()
      Returns true to indicate that we provide a custom editor via the getCustomEditor() method.
      • Methods inherited from class java.beans.PropertyEditorSupport

        addPropertyChangeListener, firePropertyChange, getAsText, 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

      • PaintEditor

        public PaintEditor()
        Creates a new instance.
    • Method Detail

      • propertyChange

        public void propertyChange​(java.beans.PropertyChangeEvent evt)
        Specified by:
        propertyChange in interface java.beans.PropertyChangeListener
      • isPaintable

        public boolean isPaintable()
        Specified by:
        isPaintable in interface java.beans.PropertyEditor
        Overrides:
        isPaintable in class java.beans.PropertyEditorSupport
      • paintValue

        public void paintValue​(java.awt.Graphics g,
                               java.awt.Rectangle clipRect)
        Specified by:
        paintValue in interface java.beans.PropertyEditor
        Overrides:
        paintValue in class java.beans.PropertyEditorSupport
      • getValue

        public java.lang.Object getValue()
        Specified by:
        getValue in interface java.beans.PropertyEditor
        Overrides:
        getValue in class java.beans.PropertyEditorSupport
      • setValue

        public void setValue​(java.lang.Object value)
        Specified by:
        setValue in interface java.beans.PropertyEditor
        Overrides:
        setValue in class java.beans.PropertyEditorSupport
      • getJavaInitializationString

        public java.lang.String getJavaInitializationString()
        Returns a string for the property value.
        Specified by:
        getJavaInitializationString in interface java.beans.PropertyEditor
        Overrides:
        getJavaInitializationString in class java.beans.PropertyEditorSupport
        Returns:
        A string for the property value.
      • getCustomEditor

        public java.awt.Component getCustomEditor()
        Returns a component for editing a Paint instance.
        Specified by:
        getCustomEditor in interface java.beans.PropertyEditor
        Overrides:
        getCustomEditor in class java.beans.PropertyEditorSupport
        Returns:
        A component for editing.
      • supportsCustomEditor

        public boolean supportsCustomEditor()
        Returns true to indicate that we provide a custom editor via the getCustomEditor() method.
        Specified by:
        supportsCustomEditor in interface java.beans.PropertyEditor
        Overrides:
        supportsCustomEditor in class java.beans.PropertyEditorSupport
        Returns:
        true.