Class TextUIWrapper<UI extends javax.swing.plaf.TextUI>

  • Type Parameters:
    UI -
    Direct Known Subclasses:
    TextUIWrapper.DefaultWrapper

    public abstract class TextUIWrapper<UI extends javax.swing.plaf.TextUI>
    extends java.lang.Object
    TODO:
    Author:
    Peter Weishapl
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected TextUIWrapper​(java.lang.Class<UI> wrapperClass)  
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      static TextUIWrapper<? extends PromptTextUI> getDefaultWrapper()  
      java.lang.Class<UI> getWrapperClass()
      Returns the wrapper class.
      void install​(javax.swing.text.JTextComponent textComponent, boolean stayOnUIChange)
      Wraps and replaces the current UI of the given textComponent, by calling wrapUI(JTextComponent) if necessary.
      protected boolean replaceUIIfNeeded​(javax.swing.text.JTextComponent textComponent)
      Wraps and replaces the text components current UI by calling #wrapUI(TextUI), if the text components current UI is not an instance of the given wrapper class.
      void uninstall​(javax.swing.text.JTextComponent textComponent)
      Removes the PropertyChangeListener, which listens for "UI" property changes (if installed) and then calls JComponent.updateUI() on the textComponent to set the UI object provided by the current UIDefaults.
      abstract UI wrapUI​(javax.swing.text.JTextComponent textComponent)
      Override to return the appropriate UI wrapper object for the given TextUI.
      • Methods inherited from class java.lang.Object

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

      • TextUIWrapper

        protected TextUIWrapper​(java.lang.Class<UI> wrapperClass)
    • Method Detail

      • install

        public final void install​(javax.swing.text.JTextComponent textComponent,
                                  boolean stayOnUIChange)

        Wraps and replaces the current UI of the given textComponent, by calling wrapUI(JTextComponent) if necessary.

        Parameters:
        textComponent -
        stayOnUIChange - if true, a PropertyChangeListener is registered, which listens for UI changes and wraps any new UI object.
      • replaceUIIfNeeded

        protected boolean replaceUIIfNeeded​(javax.swing.text.JTextComponent textComponent)
        Wraps and replaces the text components current UI by calling #wrapUI(TextUI), if the text components current UI is not an instance of the given wrapper class.
        Parameters:
        textComponent -
        Returns:
        true if the UI has been replaced
      • wrapUI

        public abstract UI wrapUI​(javax.swing.text.JTextComponent textComponent)
        Override to return the appropriate UI wrapper object for the given TextUI.
        Parameters:
        textUI -
        Returns:
        the wrapping UI
      • getWrapperClass

        public java.lang.Class<UI> getWrapperClass()
        Returns the wrapper class.
        Returns:
        the wrapper class
      • uninstall

        public final void uninstall​(javax.swing.text.JTextComponent textComponent)

        Removes the PropertyChangeListener, which listens for "UI" property changes (if installed) and then calls JComponent.updateUI() on the textComponent to set the UI object provided by the current UIDefaults.

        Parameters:
        textComponent -