Fix behaviour when typing fast.
This commit is contained in:
parent
dc2d218969
commit
68d6021eb4
1 changed files with 1 additions and 13 deletions
|
@ -26,21 +26,9 @@ public class MainPanel {
|
||||||
public MainPanel() {
|
public MainPanel() {
|
||||||
parse = false;
|
parse = false;
|
||||||
inputField.addKeyListener(new KeyAdapter() {
|
inputField.addKeyListener(new KeyAdapter() {
|
||||||
@Override
|
|
||||||
public void keyPressed(KeyEvent e) {
|
|
||||||
parse = e.getKeyCode() == KeyEvent.VK_BACK_SPACE || inputField.getSelectedText() != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void keyReleased(KeyEvent e) {
|
public void keyReleased(KeyEvent e) {
|
||||||
if (parse) {
|
|
||||||
outputField.setText(StringUtils.extractUpperCase(inputField.getText()));
|
outputField.setText(StringUtils.extractUpperCase(inputField.getText()));
|
||||||
} else {
|
|
||||||
char key = e.getKeyChar();
|
|
||||||
if (Character.isUpperCase(key)) {
|
|
||||||
outputField.setText(outputField.getText() + key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
copyToClipboardButton.addActionListener(e -> {
|
copyToClipboardButton.addActionListener(e -> {
|
||||||
|
|
Loading…
Reference in a new issue