Skip navigation links
org.jdesktop.swingx.decorator

Class PainterHighlighter

    • Constructor Detail

      • PainterHighlighter

        public PainterHighlighter()
        Instantiates a PainterHighlighter with null painter and default predicate.
      • PainterHighlighter

        public PainterHighlighter(HighlightPredicate predicate)
        Instantiates a PainterHighlighter with null painter which uses the given predicate.
        Parameters:
        predicate - the HighlightPredicate which controls the highlight application.
      • PainterHighlighter

        public PainterHighlighter(Painter painter)
        Instantiates a PainterHighlighter with the given Painter and default predicate.
        Parameters:
        painter - the painter to use
      • PainterHighlighter

        public PainterHighlighter(HighlightPredicate predicate,
                                  Painter painter)
        Instantiates a PainterHighlighter with the given painter and predicate.
        Parameters:
        predicate -
        painter -
    • Method Detail

      • getPainter

        public Painter getPainter()
        Returns to Painter used in this Highlighter.
        Returns:
        the Painter used in this Highlighter, may be null.
      • setPainter

        public void setPainter(Painter painter)
        Sets the Painter to use in this Highlighter, may be null. Un/installs the listener to changes painter's properties.
        Parameters:
        painter - the Painter to uses for decoration.
      • installPainterListener

        protected void installPainterListener()
        Installs a listener to the painter if appropriate. This implementation registers its painterListener if the Painter is of type AbstractPainter.
      • uninstallPainterListener

        protected void uninstallPainterListener()
        Uninstalls a listener from the painter if appropriate. This implementation removes its painterListener if the Painter is of type AbstractPainter.
      • getPainterListener

        protected final java.beans.PropertyChangeListener getPainterListener()
        Lazyly creates and returns the property change listener used to listen to changes of the painter.
        Returns:
        the property change listener used to listen to changes of the painter.
      • createPainterListener

        protected java.beans.PropertyChangeListener createPainterListener()
        Creates and returns the property change listener used to listen to changes of the painter.

        This implementation fires a stateChanged on receiving any propertyChange, if the isAdjusting flag is false. Otherwise does nothing.

        Returns:
        the property change listener used to listen to changes of the painter.
      • canHighlight

        protected boolean canHighlight(java.awt.Component component,
                                       ComponentAdapter adapter)
        Subclasses may override to further limit the highlighting based on Highlighter state, f.i. a PainterHighlighter can only be applied to PainterAware components.

        This implementation returns true always.

        Overridden to return false if the Painter is null or the component is not of type PainterAware.

        Overrides:
        canHighlight in class AbstractHighlighter
        Returns:
        a boolean indication if the adapter can be highlighted based general state. This implementation returns true always.