diff --git a/src/sic/asm/ErrorCatcher.java b/src/sic/asm/ErrorCatcher.java index 09e645c..ba13be9 100644 --- a/src/sic/asm/ErrorCatcher.java +++ b/src/sic/asm/ErrorCatcher.java @@ -39,11 +39,14 @@ public void printByRow(int row) { System.err.println(err); } - public void print() { + public String print() { + String allErrs=""; for ( ; lastPrinted < errs.size(); lastPrinted++) { AsmError err = errs.get(lastPrinted); System.err.println(err); + allErrs+=(err+"\n"); } + return allErrs; } public boolean shouldEnd() { diff --git a/src/sic/sim/MainView.java b/src/sic/sim/MainView.java index a1a6bc0..64311ac 100644 --- a/src/sic/sim/MainView.java +++ b/src/sic/sim/MainView.java @@ -331,7 +331,14 @@ public void loadAsm(File file) { ErrorCatcher errorCatcher = assembler.errorCatcher; Program program = assembler.assemble(Utils.readFile(file)); if (errorCatcher.count() > 0) { - errorCatcher.print(); + String allErrs = errorCatcher.print(); + JTextArea errArea = new JTextArea(allErrs); + JScrollPane scrollPane = new JScrollPane(errArea); + errArea.setLineWrap(true); + errArea.setWrapStyleWord(true); + scrollPane.setPreferredSize(new Dimension( 250, 250 )); + JOptionPane.showMessageDialog(mainFrame, scrollPane, "Error", JOptionPane.INFORMATION_MESSAGE); + updateView(); if (errorCatcher.shouldEnd()) { return; }