Skip to content

Commit f9e15f4

Browse files
committed
TextEditor: filter JTextField shows "filter..." in gray when empty and having lost focus.
1 parent d0b569d commit f9e15f4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/main/java/org/scijava/ui/swing/script/TextEditor.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,12 @@ public TextEditor(final Context context) {
695695
});
696696
filter.addFocusListener(new FocusListener() {
697697
@Override
698-
public void focusLost(FocusEvent e) {}
698+
public void focusLost(FocusEvent e) {
699+
if (0 == filter.getText().length()) {
700+
filter.setForeground(Color.gray);
701+
filter.setText("filter...");
702+
}
703+
}
699704

700705
@Override
701706
public void focusGained(FocusEvent e) {

0 commit comments

Comments
 (0)