コード例 #1
0
 /**
  * Method used by the SystemIO class to get interactive user input requested by a running MIPS
  * program (e.g. syscall #5 to read an integer). SystemIO knows whether simulator is being run at
  * command line by the user, or by the GUI. If run at command line, it gets input from System.in
  * rather than here.
  *
  * <p>This is an overloaded method. This version, with the String parameter, is used to get input
  * from a popup dialog.
  *
  * @param prompt Prompt to display to the user.
  * @return User input.
  */
 public String getInputString(String prompt) {
   String input;
   JOptionPane pane =
       new JOptionPane(prompt, JOptionPane.QUESTION_MESSAGE, JOptionPane.DEFAULT_OPTION);
   pane.setWantsInput(true);
   JDialog dialog = pane.createDialog(Globals.getGui(), "MIPS Keyboard Input");
   dialog.setVisible(true);
   input = (String) pane.getInputValue();
   this.postRunMessage(Globals.userInputAlert + input + "\n");
   return input;
 }
コード例 #2
0
 /**
  * Will select the specified line in an editor tab. If the file is open but not current, its tab
  * will be made current. If the file is not open, it will be opened in a new tab and made current,
  * however the line will not be selected (apparent apparent problem with JEditTextArea).
  *
  * @param fileName A String containing the file path name.
  * @param line Line number for error message
  * @param column Column number for error message
  */
 public void selectEditorTextLine(String fileName, int line, int column) {
   EditTabbedPane editTabbedPane =
       (EditTabbedPane) Globals.getGui().getMainPane().getEditTabbedPane();
   EditPane editPane, currentPane = null;
   editPane = editTabbedPane.getEditPaneForFile(new java.io.File(fileName).getPath());
   if (editPane != null) {
     if (editPane != editTabbedPane.getCurrentEditTab()) {
       editTabbedPane.setCurrentEditTab(editPane);
     }
     currentPane = editPane;
   } else { // file is not open.  Try to open it.
     if (editTabbedPane.openFile(new java.io.File(fileName))) {
       currentPane = editTabbedPane.getCurrentEditTab();
     }
   }
   // If editPane == null, it means the desired file was not open.  Line selection
   // does not properly with the JEditTextArea editor in this situation (it works
   // fine for the original generic editor).  So we just won't do it. DPS 9-Aug-2010
   if (editPane != null && currentPane != null) {
     currentPane.selectLine(line, column);
   }
 }