SwingX: fixed NullPointerException in FlatCaret when using org.jdesktop.swingx.prompt.PromptSupport.setPrompt() on a text field and then switching theme

This commit is contained in:
Karl Tauber
2021-12-15 11:37:35 +01:00
parent 0bd1e413b0
commit f8c769644d
2 changed files with 9 additions and 0 deletions

View File

@@ -101,6 +101,9 @@ public class FlatCaret
// adds selection highlights to the text component highlighter
if( isSelectionVisible() ) {
EventQueue.invokeLater( () -> {
if( getComponent() == null )
return; // was deinstalled
if( isSelectionVisible() ) {
setSelectionVisible( false );
setSelectionVisible( true );
@@ -253,6 +256,9 @@ public class FlatCaret
// select all
if( c instanceof JFormattedTextField ) {
EventQueue.invokeLater( () -> {
if( getComponent() == null )
return; // was deinstalled
select( 0, doc.getLength() );
} );
} else {