/** * 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; }