diff --git a/processing/app/KjcApplet.java b/processing/app/KjcApplet.java index fe6a30fb4..2b0dc3f87 100644 --- a/processing/app/KjcApplet.java +++ b/processing/app/KjcApplet.java @@ -11,8 +11,9 @@ public class KjcApplet extends BApplet { public void run() { try { super.run(); + } catch (Exception e) { - //System.out.println("ex found in run"); + System.out.println("ex found in run"); //e.printStackTrace(); //engine.error(e); engine.newMessage = true; diff --git a/processing/app/KjcEngine.java b/processing/app/KjcEngine.java index 8904a7588..561c1ed06 100644 --- a/processing/app/KjcEngine.java +++ b/processing/app/KjcEngine.java @@ -741,6 +741,14 @@ public class KjcEngine extends PdeEngine { // has to be before init applet.serialProperties(PdeBase.properties); applet.init(); + if (applet.exception != null) { + if (applet.exception instanceof javax.comm.PortInUseException) { + throw new PdeException("Another program is already " + + "using the serial port."); + } else { + throw new PdeException(applet.exception.getMessage()); + } + } applet.start(); if (editor.presenting) { diff --git a/processing/app/PdeBase.java b/processing/app/PdeBase.java index 8dffdb454..74ef4797d 100644 --- a/processing/app/PdeBase.java +++ b/processing/app/PdeBase.java @@ -105,7 +105,7 @@ public class PdeBase extends Frame implements ActionListener { // hack for #@#)$(* macosx public Dimension getMinimumSize() { - return new Dimension(300, 300); + return new Dimension(500, 500); } @@ -719,11 +719,15 @@ public class PdeBase extends Frame implements ActionListener { String defaultName = get("serial.port", "unspecified"); boolean problem = false; + // if this is failing, it may be because + // lib/javax.comm.properties is missing try { + //System.out.println("building port list"); Enumeration portList = CommPortIdentifier.getPortIdentifiers(); while (portList.hasMoreElements()) { CommPortIdentifier portId = (CommPortIdentifier) portList.nextElement(); + //System.out.println(portId); if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) { //if (portId.getName().equals(port)) { @@ -745,8 +749,7 @@ public class PdeBase extends Frame implements ActionListener { } // only warn them if this is the first time - //if (getInteger("window.x", 0) == 0) { - if (firstTime) { + if (problem && firstTime) { JOptionPane.showMessageDialog(frame, "Serial port support not installed.\n" + "Check the readme for instructions if you " + diff --git a/processing/app/PdeEditorTextPane.java b/processing/app/PdeEditorTextPane.java index 2c070f83a..3dd978ad8 100644 --- a/processing/app/PdeEditorTextPane.java +++ b/processing/app/PdeEditorTextPane.java @@ -67,6 +67,8 @@ public class PdeEditorTextPane extends JTextPane { setStyledDocument(document); // MAYBE? textPane = this; + //setPreferredSize(new Dimension(620, 460)); + //setDoubleBuffered(true); //textPane.setCaretPosition(0); diff --git a/processing/todo.txt b/processing/todo.txt index 65a32d928..c0817bfd6 100644 --- a/processing/todo.txt +++ b/processing/todo.txt @@ -53,6 +53,9 @@ X remove .jar, .class, and .java files from the 'applet' dir When I am working in a project and I save it with another name, all the old files are copyied to new directory, and some of the old unused .class files and images remains inside new project JAR files. +X serial port +X better message for PortInUseException (full explanation) +X better message for when serial port code not available/not installed bagel _ images don't load during setup() @@ -69,9 +72,6 @@ _ set frame title of launched window to the name of the sketch _ use date in the sketch name sketch_021104 _ with a _2 if needed or '021104a' '021104b' etc _ when using save as, allow to remove the old (numbered) sketch -_ serial port -_ better message for PortInUseException (full explanation) -_ better message for when serial port code not available/not installed _ lots of problems with the console [maybe this needs to be a textarea?] _ long lines seem to be trouble _ also printing of objects, esp when null, in jdk 14