X serial port

X   better message for PortInUseException (full explanation)
X   better message for when serial port code not available/not installed
This commit is contained in:
benfry
2002-11-19 08:44:37 +00:00
parent f12b2b45c3
commit 4fa553d250
5 changed files with 21 additions and 7 deletions
+2 -1
View File
@@ -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;
+8
View File
@@ -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) {
+6 -3
View File
@@ -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 " +
+2
View File
@@ -67,6 +67,8 @@ public class PdeEditorTextPane extends JTextPane {
setStyledDocument(document);
// MAYBE? textPane = this;
//setPreferredSize(new Dimension(620, 460));
//setDoubleBuffered(true);
//textPane.setCaretPosition(0);
+3 -3
View File
@@ -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