import org.jmol.util.Logger;
import org.jmol.util.CommandHistory;
-public final class ScriptWindow extends JPanel
- implements ActionListener, EnterListener{
+public final class ScriptWindow extends JPanel implements ActionListener,
+ EnterListener
+{
private ConsoleTextPane console;
+
private JButton closeButton;
+
private JButton runButton;
+
private JButton haltButton;
+
private JButton clearButton;
+
private JButton historyButton;
+
private JButton stateButton;
- JmolViewer viewer;
+
+ JmolViewer viewer;
+
AppJmol appJmol;
public ScriptWindow(AppJmol appJmol)
this.viewer = appJmol.viewer;
this.appJmol = appJmol;
-
setLayout(new BorderLayout());
console = new ConsoleTextPane(this);
-
console.setPrompt();
- add(new JScrollPane(console)
- , BorderLayout.CENTER);
+ add(new JScrollPane(console), BorderLayout.CENTER);
JPanel buttonPanel = new JPanel();
add(buttonPanel, BorderLayout.SOUTH);
runButton = new JButton(GT._("Run"));
haltButton = new JButton(GT._("Halt"));
runButton.addActionListener(this);
- // buttonPanel.add(runButton);
+ // buttonPanel.add(runButton);
haltButton.addActionListener(this);
- // buttonPanel.add(haltButton);
+ // buttonPanel.add(haltButton);
haltButton.setEnabled(false);
clearButton = new JButton(GT._("Clear"));
closeButton.addActionListener(this);
buttonPanel.add(closeButton);
- for(int i=0; i<buttonPanel.getComponentCount(); i++)
+ for (int i = 0; i < buttonPanel.getComponentCount(); i++)
{
- // ((JButton)buttonPanel.getComponent(i))
- // .setMargin(new Insets(0, 0, 0, 0));
+ // ((JButton)buttonPanel.getComponent(i))
+ // .setMargin(new Insets(0, 0, 0, 0));
}
}
- public void sendConsoleEcho(String strEcho) {
- if (strEcho != null && !isError) {
+ public void sendConsoleEcho(String strEcho)
+ {
+ if (strEcho != null && !isError)
+ {
console.outputEcho(strEcho);
}
boolean isError = false;
- void setError(boolean TF) {
+
+ void setError(boolean TF)
+ {
isError = TF;
- //if (isError)
- //console.recallCommand(true);
+ // if (isError)
+ // console.recallCommand(true);
}
- public void sendConsoleMessage(String strStatus) {
- if (strStatus == null) {
+ public void sendConsoleMessage(String strStatus)
+ {
+ if (strStatus == null)
+ {
console.clearContent();
console.outputStatus("");
- } else if (strStatus.indexOf("ERROR:") >= 0) {
+ }
+ else if (strStatus.indexOf("ERROR:") >= 0)
+ {
console.outputError(strStatus);
isError = true;
- } else if (!isError) {
+ }
+ else if (!isError)
+ {
console.outputStatus(strStatus);
}
}
- public void notifyScriptTermination(String strMsg, int msWalltime) {
- if (strMsg != null && strMsg.indexOf("ERROR") >= 0) {
+ public void notifyScriptTermination(String strMsg, int msWalltime)
+ {
+ if (strMsg != null && strMsg.indexOf("ERROR") >= 0)
+ {
console.outputError(strMsg);
}
runButton.setEnabled(true);
haltButton.setEnabled(false);
}
- public void enterPressed() {
+ public void enterPressed()
+ {
runButton.doClick(100);
- // executeCommand();
+ // executeCommand();
}
-
- class ExecuteCommandThread extends Thread {
+ class ExecuteCommandThread extends Thread
+ {
String strCommand;
- ExecuteCommandThread (String command) {
+
+ ExecuteCommandThread(String command)
+ {
strCommand = command;
}
- public void run() {
- try {
+ public void run()
+ {
+ try
+ {
executeCommand(strCommand);
- } catch (Exception ie) {
- Logger.debug("execution command interrupted!"+ie);
+ } catch (Exception ie)
+ {
+ Logger.debug("execution command interrupted!" + ie);
}
}
}
ExecuteCommandThread execThread;
- void executeCommandAsThread(){
+
+ void executeCommandAsThread()
+ {
String strCommand = console.getCommandString().trim();
- if (strCommand.length() > 0) {
+ if (strCommand.length() > 0)
+ {
execThread = new ExecuteCommandThread(strCommand);
execThread.start();
}
}
- void executeCommand(String strCommand) {
+ void executeCommand(String strCommand)
+ {
boolean doWait;
setError(false);
console.appendNewline();
console.setPrompt();
- if (strCommand.length() > 0) {
+ if (strCommand.length() > 0)
+ {
String strErrorMessage = null;
doWait = (strCommand.indexOf("WAIT ") == 0);
- if (doWait) { //for testing, mainly
+ if (doWait)
+ { // for testing, mainly
// demonstrates using the statusManager system.
runButton.setEnabled(false);
haltButton.setEnabled(true);
Vector info = (Vector) viewer
- .scriptWaitStatus(strCommand.substring(5),
- "+fileLoaded,+scriptStarted,+scriptStatus,+scriptEcho,+scriptTerminated");
+ .scriptWaitStatus(strCommand.substring(5),
+ "+fileLoaded,+scriptStarted,+scriptStatus,+scriptEcho,+scriptTerminated");
runButton.setEnabled(true);
haltButton.setEnabled(false);
/*
* info = [ statusRecortSet0, statusRecortSet1, statusRecortSet2, ...]
* statusRecordSet = [ statusRecord0, statusRecord1, statusRecord2, ...]
- * statusRecord = [int msgPtr, String statusName, int intInfo, String msg]
+ * statusRecord = [int msgPtr, String statusName, int intInfo, String
+ * msg]
*/
- for (int i = 0; i < info.size(); i++) {
+ for (int i = 0; i < info.size(); i++)
+ {
Vector statusRecordSet = (Vector) info.get(i);
- for (int j = 0; j < statusRecordSet.size(); j++) {
+ for (int j = 0; j < statusRecordSet.size(); j++)
+ {
Vector statusRecord = (Vector) statusRecordSet.get(j);
Logger.info("msg#=" + statusRecord.get(0) + " "
- + statusRecord.get(1) + " intInfo=" + statusRecord.get(2)
- + " stringInfo=" + statusRecord.get(3));
+ + statusRecord.get(1) + " intInfo="
+ + statusRecord.get(2) + " stringInfo="
+ + statusRecord.get(3));
}
}
console.appendNewline();
- } else {
+ }
+ else
+ {
boolean isScriptExecuting = viewer.isScriptExecuting();
if (viewer.checkHalt(strCommand))
- strErrorMessage = (isScriptExecuting ? "string execution halted with " + strCommand : "no script was executing");
+ strErrorMessage = (isScriptExecuting ? "string execution halted with "
+ + strCommand
+ : "no script was executing");
else
- strErrorMessage = "";//viewer.scriptCheck(strCommand);
- //the problem is that scriptCheck is synchronized, so these might get backed up.
- if (strErrorMessage != null && strErrorMessage.length() > 0) {
+ strErrorMessage = "";// viewer.scriptCheck(strCommand);
+ // the problem is that scriptCheck is synchronized, so these might get
+ // backed up.
+ if (strErrorMessage != null && strErrorMessage.length() > 0)
+ {
console.outputError(strErrorMessage);
- } else {
- //runButton.setEnabled(false);
+ }
+ else
+ {
+ // runButton.setEnabled(false);
haltButton.setEnabled(true);
viewer.script(strCommand);
}
console.grabFocus();
}
- public void actionPerformed(ActionEvent e) {
+ public void actionPerformed(ActionEvent e)
+ {
Object source = e.getSource();
- if (source == closeButton) {
+ if (source == closeButton)
+ {
appJmol.showConsole(false);
- } else if (source == runButton) {
+ }
+ else if (source == runButton)
+ {
executeCommandAsThread();
- } else if (source == clearButton) {
+ }
+ else if (source == clearButton)
+ {
console.clearContent();
- } else if (source == historyButton) {
+ }
+ else if (source == historyButton)
+ {
console.clearContent(viewer.getSetHistory(Integer.MAX_VALUE));
- } else if (source == stateButton) {
+ }
+ else if (source == stateButton)
+ {
console.clearContent(viewer.getStateInfo());
- } else if (source == haltButton) {
+ }
+ else if (source == haltButton)
+ {
viewer.haltScriptExecution();
}
console.grabFocus(); // always grab the focus (e.g., after clear)
}
}
-class ConsoleTextPane extends JTextPane {
+class ConsoleTextPane extends JTextPane
+{
ConsoleDocument consoleDoc;
+
EnterListener enterListener;
+
JmolViewer viewer;
- ConsoleTextPane(ScriptWindow scriptWindow) {
+ ConsoleTextPane(ScriptWindow scriptWindow)
+ {
super(new ConsoleDocument());
- consoleDoc = (ConsoleDocument)getDocument();
+ consoleDoc = (ConsoleDocument) getDocument();
consoleDoc.setConsoleTextPane(this);
this.enterListener = (EnterListener) scriptWindow;
this.viewer = scriptWindow.viewer;
}
- public String getCommandString() {
+ public String getCommandString()
+ {
String cmd = consoleDoc.getCommandString();
return cmd;
}
- public void setPrompt() {
+ public void setPrompt()
+ {
consoleDoc.setPrompt();
}
- public void appendNewline() {
+ public void appendNewline()
+ {
consoleDoc.appendNewline();
}
- public void outputError(String strError) {
+ public void outputError(String strError)
+ {
consoleDoc.outputError(strError);
}
- public void outputErrorForeground(String strError) {
+ public void outputErrorForeground(String strError)
+ {
consoleDoc.outputErrorForeground(strError);
}
- public void outputEcho(String strEcho) {
+ public void outputEcho(String strEcho)
+ {
consoleDoc.outputEcho(strEcho);
}
- public void outputStatus(String strStatus) {
+ public void outputStatus(String strStatus)
+ {
consoleDoc.outputStatus(strStatus);
}
- public void enterPressed() {
+ public void enterPressed()
+ {
if (enterListener != null)
enterListener.enterPressed();
}
- public void clearContent() {
+ public void clearContent()
+ {
clearContent(null);
}
- public void clearContent(String text) {
+
+ public void clearContent(String text)
+ {
consoleDoc.clearContent();
if (text != null)
consoleDoc.outputEcho(text);
setPrompt();
}
- /* (non-Javadoc)
- * @see java.awt.Component#processKeyEvent(java.awt.event.KeyEvent)
- */
-
- /**
- * Custom key event processing for command 0 implementation.
- *
- * Captures key up and key down strokes to call command history
- * and redefines the same events with control down to allow
- * caret vertical shift.
- *
- * @see java.awt.Component#processKeyEvent(java.awt.event.KeyEvent)
- */
- protected void processKeyEvent(KeyEvent ke)
- {
- // Id Control key is down, captures events does command
- // history recall and inhibits caret vertical shift.
- if (ke.getKeyCode() == KeyEvent.VK_UP
- && ke.getID() == KeyEvent.KEY_PRESSED
- && !ke.isControlDown())
- {
- recallCommand(true);
- }
- else if (
- ke.getKeyCode() == KeyEvent.VK_DOWN
- && ke.getID() == KeyEvent.KEY_PRESSED
- && !ke.isControlDown())
- {
- recallCommand(false);
- }
- // If Control key is down, redefines the event as if it
- // where a key up or key down stroke without modifiers.
- // This allows to move the caret up and down
- // with no command history recall.
- else if (
- (ke.getKeyCode() == KeyEvent.VK_DOWN
- || ke.getKeyCode() == KeyEvent.VK_UP)
- && ke.getID() == KeyEvent.KEY_PRESSED
- && ke.isControlDown())
- {
- super
- .processKeyEvent(new KeyEvent(
- (Component) ke.getSource(),
- ke.getID(),
- ke.getWhen(),
- 0, // No modifiers
- ke.getKeyCode(),
- ke.getKeyChar(),
- ke.getKeyLocation()));
- }
- // Standard processing for other events.
- else
- {
- super.processKeyEvent(ke);
- //check command for compiler-identifyable syntax issues
- //this may have to be taken out if people start complaining
- //that only some of the commands are being checked
- //that is -- that the script itself is not being fully checked
-
- //not perfect -- help here?
- if (ke.getID() == KeyEvent.KEY_RELEASED
- && (ke.getKeyCode() > KeyEvent.VK_DOWN) || ke.getKeyCode() == KeyEvent.VK_BACK_SPACE)
- checkCommand();
- }
- }
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.awt.Component#processKeyEvent(java.awt.event.KeyEvent)
+ */
- /**
+ /**
+ * Custom key event processing for command 0 implementation.
+ *
+ * Captures key up and key down strokes to call command history and redefines
+ * the same events with control down to allow caret vertical shift.
+ *
+ * @see java.awt.Component#processKeyEvent(java.awt.event.KeyEvent)
+ */
+ protected void processKeyEvent(KeyEvent ke)
+ {
+ // Id Control key is down, captures events does command
+ // history recall and inhibits caret vertical shift.
+ if (ke.getKeyCode() == KeyEvent.VK_UP
+ && ke.getID() == KeyEvent.KEY_PRESSED && !ke.isControlDown())
+ {
+ recallCommand(true);
+ }
+ else if (ke.getKeyCode() == KeyEvent.VK_DOWN
+ && ke.getID() == KeyEvent.KEY_PRESSED && !ke.isControlDown())
+ {
+ recallCommand(false);
+ }
+ // If Control key is down, redefines the event as if it
+ // where a key up or key down stroke without modifiers.
+ // This allows to move the caret up and down
+ // with no command history recall.
+ else if ((ke.getKeyCode() == KeyEvent.VK_DOWN || ke.getKeyCode() == KeyEvent.VK_UP)
+ && ke.getID() == KeyEvent.KEY_PRESSED && ke.isControlDown())
+ {
+ super.processKeyEvent(new KeyEvent((Component) ke.getSource(), ke
+ .getID(), ke.getWhen(), 0, // No modifiers
+ ke.getKeyCode(), ke.getKeyChar(), ke.getKeyLocation()));
+ }
+ // Standard processing for other events.
+ else
+ {
+ super.processKeyEvent(ke);
+ // check command for compiler-identifyable syntax issues
+ // this may have to be taken out if people start complaining
+ // that only some of the commands are being checked
+ // that is -- that the script itself is not being fully checked
+
+ // not perfect -- help here?
+ if (ke.getID() == KeyEvent.KEY_RELEASED
+ && (ke.getKeyCode() > KeyEvent.VK_DOWN)
+ || ke.getKeyCode() == KeyEvent.VK_BACK_SPACE)
+ checkCommand();
+ }
+ }
+
+ /**
* Recall command history.
- *
- * @param up - history up or down
+ *
+ * @param up -
+ * history up or down
*/
- void recallCommand(boolean up) {
- String cmd = viewer.getSetHistory(up ? -1 : 1);
- if (cmd == null) {
+ void recallCommand(boolean up)
+ {
+ String cmd = viewer.getSetHistory(up ? -1 : 1);
+ if (cmd == null)
+ {
return;
}
- try {
- if (cmd.endsWith(CommandHistory.ERROR_FLAG)) {
+ try
+ {
+ if (cmd.endsWith(CommandHistory.ERROR_FLAG))
+ {
cmd = cmd.substring(0, cmd.indexOf(CommandHistory.ERROR_FLAG));
consoleDoc.replaceCommand(cmd, true);
- } else {
+ }
+ else
+ {
consoleDoc.replaceCommand(cmd, false);
}
- } catch (BadLocationException e) {
+ } catch (BadLocationException e)
+ {
e.printStackTrace();
}
}
- void checkCommand() {
+ void checkCommand()
+ {
String strCommand = consoleDoc.getCommandString();
if (strCommand.length() == 0)
return;
consoleDoc
- .colorCommand(viewer.scriptCheck(strCommand) == null ? consoleDoc.attUserInput
- : consoleDoc.attError);
+ .colorCommand(viewer.scriptCheck(strCommand) == null ? consoleDoc.attUserInput
+ : consoleDoc.attError);
}
-
}
-class ConsoleDocument extends DefaultStyledDocument {
+class ConsoleDocument extends DefaultStyledDocument
+{
ConsoleTextPane consoleTextPane;
SimpleAttributeSet attError;
+
SimpleAttributeSet attEcho;
+
SimpleAttributeSet attPrompt;
+
SimpleAttributeSet attUserInput;
+
SimpleAttributeSet attStatus;
- ConsoleDocument() {
+ ConsoleDocument()
+ {
super();
attError = new SimpleAttributeSet();
StyleConstants.setItalic(attStatus, true);
}
- void setConsoleTextPane(ConsoleTextPane consoleTextPane) {
+ void setConsoleTextPane(ConsoleTextPane consoleTextPane)
+ {
this.consoleTextPane = consoleTextPane;
}
- Position positionBeforePrompt; // starts at 0, so first time isn't tracked (at least on Mac OS X)
- Position positionAfterPrompt; // immediately after $, so this will track
- int offsetAfterPrompt; // only still needed for the insertString override and replaceCommand
+ Position positionBeforePrompt; // starts at 0, so first time isn't tracked
+ // (at least on Mac OS X)
+
+ Position positionAfterPrompt; // immediately after $, so this will track
+
+ int offsetAfterPrompt; // only still needed for the insertString override and
+ // replaceCommand
/**
* Removes all content of the script window, and add a new prompt.
*/
- void clearContent() {
- try {
- super.remove(0, getLength());
- } catch (BadLocationException exception) {
- System.out.println("Could not clear script window content: " + exception.getMessage());
- }
+ void clearContent()
+ {
+ try
+ {
+ super.remove(0, getLength());
+ } catch (BadLocationException exception)
+ {
+ System.out.println("Could not clear script window content: "
+ + exception.getMessage());
+ }
}
- void setPrompt() {
- try {
+ void setPrompt()
+ {
+ try
+ {
super.insertString(getLength(), "$ ", attPrompt);
setOffsetPositions();
consoleTextPane.setCaretPosition(offsetAfterPrompt);
- } catch (BadLocationException e) {
+ } catch (BadLocationException e)
+ {
e.printStackTrace();
}
}
- void setOffsetPositions() {
- try {
+ void setOffsetPositions()
+ {
+ try
+ {
offsetAfterPrompt = getLength();
positionBeforePrompt = createPosition(offsetAfterPrompt - 2);
// after prompt should be immediately after $ otherwise tracks the end
// of the line (and no command will be found) at least on Mac OS X it did.
positionAfterPrompt = createPosition(offsetAfterPrompt - 1);
- } catch (BadLocationException e) {
+ } catch (BadLocationException e)
+ {
e.printStackTrace();
}
}
- void setNoPrompt() {
- try {
+ void setNoPrompt()
+ {
+ try
+ {
offsetAfterPrompt = getLength();
positionAfterPrompt = positionBeforePrompt = createPosition(offsetAfterPrompt);
consoleTextPane.setCaretPosition(offsetAfterPrompt);
- } catch (BadLocationException e) {
+ } catch (BadLocationException e)
+ {
e.printStackTrace();
}
}
- // it looks like the positionBeforePrompt does not track when it started out as 0
+ // it looks like the positionBeforePrompt does not track when it started out
+ // as 0
// and a insertString at location 0 occurs. It may be better to track the
// position after the prompt in stead
- void outputBeforePrompt(String str, SimpleAttributeSet attribute) {
- try {
+ void outputBeforePrompt(String str, SimpleAttributeSet attribute)
+ {
+ try
+ {
int pt = consoleTextPane.getCaretPosition();
Position caretPosition = createPosition(pt);
pt = positionBeforePrompt.getOffset();
- super.insertString(pt, str+"\n", attribute);
+ super.insertString(pt, str + "\n", attribute);
setOffsetPositions();
pt = caretPosition.getOffset();
consoleTextPane.setCaretPosition(pt);
- } catch (BadLocationException e) {
+ } catch (BadLocationException e)
+ {
e.printStackTrace();
}
}
- void outputError(String strError) {
+ void outputError(String strError)
+ {
outputBeforePrompt(strError, attError);
}
- void outputErrorForeground(String strError) {
- try {
- super.insertString(getLength(), strError+"\n", attError);
+ void outputErrorForeground(String strError)
+ {
+ try
+ {
+ super.insertString(getLength(), strError + "\n", attError);
consoleTextPane.setCaretPosition(getLength());
- } catch (BadLocationException e) {
+ } catch (BadLocationException e)
+ {
e.printStackTrace();
}
}
- void outputEcho(String strEcho) {
+ void outputEcho(String strEcho)
+ {
outputBeforePrompt(strEcho, attEcho);
}
- void outputStatus(String strStatus) {
+ void outputStatus(String strStatus)
+ {
outputBeforePrompt(strStatus, attStatus);
}
- void appendNewline() {
- try {
+ void appendNewline()
+ {
+ try
+ {
super.insertString(getLength(), "\n", attUserInput);
consoleTextPane.setCaretPosition(getLength());
- } catch (BadLocationException e) {
+ } catch (BadLocationException e)
+ {
e.printStackTrace();
}
}
// override the insertString to make sure everything typed ends up at the end
- // or in the 'command line' using the proper font, and the newline is processed.
+ // or in the 'command line' using the proper font, and the newline is
+ // processed.
public void insertString(int offs, String str, AttributeSet a)
- throws BadLocationException {
+ throws BadLocationException
+ {
int ichNewline = str.indexOf('\n');
if (ichNewline > 0)
str = str.substring(0, ichNewline);
- if (ichNewline != 0) {
- if (offs < offsetAfterPrompt) {
+ if (ichNewline != 0)
+ {
+ if (offs < offsetAfterPrompt)
+ {
offs = getLength();
}
super.insertString(offs, str, a == attError ? a : attUserInput);
- consoleTextPane.setCaretPosition(offs+str.length());
+ consoleTextPane.setCaretPosition(offs + str.length());
}
- if (ichNewline >= 0) {
+ if (ichNewline >= 0)
+ {
consoleTextPane.enterPressed();
}
}
- String getCommandString() {
+ String getCommandString()
+ {
String strCommand = "";
- try {
+ try
+ {
int cmdStart = positionAfterPrompt.getOffset();
- strCommand = getText(cmdStart, getLength() - cmdStart);
+ strCommand = getText(cmdStart, getLength() - cmdStart);
while (strCommand.length() > 0 && strCommand.charAt(0) == ' ')
strCommand = strCommand.substring(1);
- } catch (BadLocationException e) {
+ } catch (BadLocationException e)
+ {
e.printStackTrace();
}
return strCommand;
}
- public void remove(int offs, int len)
- throws BadLocationException {
- if (offs < offsetAfterPrompt) {
+ public void remove(int offs, int len) throws BadLocationException
+ {
+ if (offs < offsetAfterPrompt)
+ {
len -= offsetAfterPrompt - offs;
if (len <= 0)
return;
offs = offsetAfterPrompt;
}
super.remove(offs, len);
-// consoleTextPane.setCaretPosition(offs);
+ // consoleTextPane.setCaretPosition(offs);
}
public void replace(int offs, int length, String str, AttributeSet attrs)
- throws BadLocationException {
- if (offs < offsetAfterPrompt) {
- if (offs + length < offsetAfterPrompt) {
+ throws BadLocationException
+ {
+ if (offs < offsetAfterPrompt)
+ {
+ if (offs + length < offsetAfterPrompt)
+ {
offs = getLength();
length = 0;
- } else {
+ }
+ else
+ {
length -= offsetAfterPrompt - offs;
offs = offsetAfterPrompt;
}
}
super.replace(offs, length, str, attrs);
-// consoleTextPane.setCaretPosition(offs + str.length());
+ // consoleTextPane.setCaretPosition(offs + str.length());
}
- /**
+ /**
* Replaces current command on script.
- *
- * @param newCommand new command value
- * @param isError true to set error color ends with #??
- *
+ *
+ * @param newCommand
+ * new command value
+ * @param isError
+ * true to set error color ends with #??
+ *
* @throws BadLocationException
*/
- void replaceCommand(String newCommand, boolean isError) throws BadLocationException {
+ void replaceCommand(String newCommand, boolean isError)
+ throws BadLocationException
+ {
if (positionAfterPrompt == positionBeforePrompt)
return;
replace(offsetAfterPrompt, getLength() - offsetAfterPrompt, newCommand,
- isError ? attError : attUserInput);
+ isError ? attError : attUserInput);
}
- void colorCommand(SimpleAttributeSet att) {
+ void colorCommand(SimpleAttributeSet att)
+ {
if (positionAfterPrompt == positionBeforePrompt)
return;
- setCharacterAttributes(offsetAfterPrompt, getLength() - offsetAfterPrompt, att, true);
+ setCharacterAttributes(offsetAfterPrompt, getLength()
+ - offsetAfterPrompt, att, true);
}
}
-interface EnterListener {
+interface EnterListener
+{
public void enterPressed();
}
-