Fix behaviour when typing fast.

This commit is contained in:
Gabriel Augendre 2015-06-05 15:48:10 +02:00
parent dc2d218969
commit 68d6021eb4
1 changed files with 1 additions and 13 deletions

View File

@ -26,21 +26,9 @@ public class MainPanel {
public MainPanel() {
parse = false;
inputField.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
parse = e.getKeyCode() == KeyEvent.VK_BACK_SPACE || inputField.getSelectedText() != null;
}
@Override
public void keyReleased(KeyEvent e) {
if (parse) {
outputField.setText(StringUtils.extractUpperCase(inputField.getText()));
} else {
char key = e.getKeyChar();
if (Character.isUpperCase(key)) {
outputField.setText(outputField.getText() + key);
}
}
outputField.setText(StringUtils.extractUpperCase(inputField.getText()));
}
});
copyToClipboardButton.addActionListener(e -> {