textfield.setText("");
parseInput(message);
}
});
Keymap keymap = textfield.getKeymap();
keymap
.addActionForKeyStroke(
KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_UP, 0),
new AbstractAction() {
public void actionPerformed(java.awt.event.ActionEvent e) {
if (inputHistoryIndex > 0)
inputHistoryIndex--;
if (inputHistory.size() > 0)
textfield.setText(
(String) inputHistory.get(inputHistoryIndex));
}
});
keymap
.addActionForKeyStroke(
KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_DOWN, 0),
new AbstractAction() {
public void actionPerformed(java.awt.event.ActionEvent e) {
if (inputHistoryIndex < inputHistory.size())
inputHistoryIndex++;
if (inputHistoryIndex == inputHistory.size())
textfield.setText("");
else
textfield.setText(
(String) inputHistory.get(inputHistoryIndex));
}
});
keymap
.addActionForKeyStroke(
KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ESCAPE, 0),
new AbstractAction() {
public void actionPerformed(java.awt.event.ActionEvent e) {
inputHistoryIndex = inputHistory.size();