diff --git a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatSyntaxTextAreaActions.java b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatSyntaxTextAreaActions.java index 75cf46c44..31cfa688a 100644 --- a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatSyntaxTextAreaActions.java +++ b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatSyntaxTextAreaActions.java @@ -25,10 +25,7 @@ import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; import java.util.prefs.Preferences; -import javax.swing.JColorChooser; -import javax.swing.JDialog; -import javax.swing.JTabbedPane; -import javax.swing.SwingUtilities; +import javax.swing.*; import javax.swing.text.BadLocationException; import org.fife.ui.rtextarea.RTextArea; import org.fife.ui.rtextarea.RecordableTextAction; @@ -398,6 +395,7 @@ static class PickColorAction @Override public void actionPerformedImpl( ActionEvent e, RTextArea textArea ) { + Window window = SwingUtilities.windowForComponent((JComponent) e.getSource()); try { // find current color at caret int caretPosition = textArea.getCaretPosition(); @@ -419,7 +417,7 @@ public void actionPerformedImpl( ActionEvent e, RTextArea textArea ) { AtomicBoolean changed = new AtomicBoolean(); // show pipette color picker - Window window = SwingUtilities.windowForComponent( textArea ); + window.setVisible( false ); FlatColorPipette.pick( window, true, color -> { // update editor immediately for live preview @@ -447,9 +445,11 @@ public void actionPerformedImpl( ActionEvent e, RTextArea textArea ) { ex.printStackTrace(); } } + window.setVisible( true ); } ); } catch( BadLocationException | IndexOutOfBoundsException | NumberFormatException | UnsupportedOperationException | AWTException ex ) { ex.printStackTrace(); + window.setVisible( true ); } }