mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-13 06:49:36 -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 final JTextField textField;
|
||||||
|
private boolean textIsModifying;
|
||||||
private final boolean supportsHighZ;
|
private final boolean supportsHighZ;
|
||||||
private final JComboBox<InMode> formatComboBox;
|
private final JComboBox<InMode> formatComboBox;
|
||||||
private final long mask;
|
private final long mask;
|
||||||
@ -249,7 +250,7 @@ public final class SingleValueDialog extends JDialog implements ModelStateObserv
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setText(String text) {
|
private void setText(String text) {
|
||||||
if (!textField.getText().equals(text))
|
if (!textIsModifying)
|
||||||
textField.setText(text);
|
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 final Runnable runnable;
|
||||||
|
|
||||||
private MyDocumentListener(Runnable runnable) {
|
private MyDocumentListener(Runnable runnable) {
|
||||||
@ -311,17 +312,23 @@ public final class SingleValueDialog extends JDialog implements ModelStateObserv
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void insertUpdate(DocumentEvent documentEvent) {
|
public void insertUpdate(DocumentEvent documentEvent) {
|
||||||
runnable.run();
|
run();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeUpdate(DocumentEvent documentEvent) {
|
public void removeUpdate(DocumentEvent documentEvent) {
|
||||||
runnable.run();
|
run();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void changedUpdate(DocumentEvent documentEvent) {
|
public void changedUpdate(DocumentEvent documentEvent) {
|
||||||
|
run();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void run() {
|
||||||
|
textIsModifying = true;
|
||||||
runnable.run();
|
runnable.run();
|
||||||
|
textIsModifying = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user