mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-12 06:15:32 -04:00
fixed a bug in the single value dialog
This commit is contained in:
parent
88807e4a34
commit
db875ae5e4
@ -79,6 +79,7 @@ public final class SingleValueDialog extends JDialog implements ModelStateObserv
|
||||
}
|
||||
|
||||
private final JTextField textField;
|
||||
private boolean textIsModifying;
|
||||
private final boolean supportsHighZ;
|
||||
private final JComboBox<InMode> formatComboBox;
|
||||
private final long mask;
|
||||
@ -249,7 +250,7 @@ public final class SingleValueDialog extends JDialog implements ModelStateObserv
|
||||
}
|
||||
|
||||
private void setText(String text) {
|
||||
if (!textField.getText().equals(text))
|
||||
if (!textIsModifying)
|
||||
textField.setText(text);
|
||||
}
|
||||
|
||||
@ -302,7 +303,7 @@ public final class SingleValueDialog extends JDialog implements ModelStateObserv
|
||||
}
|
||||
}
|
||||
|
||||
private static final class MyDocumentListener implements DocumentListener {
|
||||
private final class MyDocumentListener implements DocumentListener {
|
||||
private final Runnable runnable;
|
||||
|
||||
private MyDocumentListener(Runnable runnable) {
|
||||
@ -311,17 +312,23 @@ public final class SingleValueDialog extends JDialog implements ModelStateObserv
|
||||
|
||||
@Override
|
||||
public void insertUpdate(DocumentEvent documentEvent) {
|
||||
runnable.run();
|
||||
run();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeUpdate(DocumentEvent documentEvent) {
|
||||
runnable.run();
|
||||
run();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changedUpdate(DocumentEvent documentEvent) {
|
||||
run();
|
||||
}
|
||||
|
||||
private void run() {
|
||||
textIsModifying = true;
|
||||
runnable.run();
|
||||
textIsModifying = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user