Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PickColorAction:Hide main window if FlatColorPipette is shown #719

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand All @@ -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
Expand Down Expand Up @@ -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 );
}
}

Expand Down