public class CommandHistory extends KeyAdapter
Constructor and Description |
---|
CommandHistory() |
CommandHistory(File file)
A CommamdHistory which will persist in a text file, as long the application sends us a save() before exiting.
|
Modifier and Type | Method and Description |
---|---|
void |
addField(JTextComponent text) |
void |
addMenuAndField(JMenu menu,
int firstItem,
JTextComponent text)
Registers a text field and a menu; text may already be known here, but menu must not
|
void |
addToHistory(String command_) |
void |
clear() |
void |
keyPressed(KeyEvent e) |
String |
last() |
void |
save() |
keyReleased, keyTyped
public CommandHistory()
public CommandHistory(File file)
file
- if null, no persistencepublic void clear()
public void save()
public void addField(JTextComponent text)
public void addMenuAndField(JMenu menu, int firstItem, JTextComponent text)
menu
- firstItem
- first item to be used for history ( >=0 )text
- public void keyPressed(KeyEvent e)
keyPressed
in interface KeyListener
keyPressed
in class KeyAdapter
public void addToHistory(String command_)
public String last()