Package org.jdesktop.swingx.plaf
Class TextUIWrapper<UI extends javax.swing.plaf.TextUI>
- java.lang.Object
-
- org.jdesktop.swingx.plaf.TextUIWrapper<UI>
-
- 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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TextUIWrapper.DefaultWrapper
-
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 giventextComponent
, by callingwrapUI(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 thePropertyChangeListener
, which listens for "UI" property changes (if installed) and then callsJComponent.updateUI()
on thetextComponent
to set the UI object provided by the currentUIDefaults
.abstract UI
wrapUI(javax.swing.text.JTextComponent textComponent)
Override to return the appropriate UI wrapper object for the givenTextUI
.
-
-
-
Constructor Detail
-
TextUIWrapper
protected TextUIWrapper(java.lang.Class<UI> wrapperClass)
-
-
Method Detail
-
getDefaultWrapper
public static final TextUIWrapper<? extends PromptTextUI> getDefaultWrapper()
-
install
public final void install(javax.swing.text.JTextComponent textComponent, boolean stayOnUIChange)
Wraps and replaces the current UI of the given
textComponent
, by callingwrapUI(JTextComponent)
if necessary.- Parameters:
textComponent
-stayOnUIChange
- iftrue
, aPropertyChangeListener
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 givenTextUI
.- 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 callsJComponent.updateUI()
on thetextComponent
to set the UI object provided by the currentUIDefaults
.- Parameters:
textComponent
-
-
-