message when running p5 for the first time and serial port sucks

This commit is contained in:
benfry
2002-11-19 08:03:38 +00:00
parent 7712637a2e
commit f12b2b45c3
2 changed files with 21 additions and 9 deletions

View File

@@ -22,6 +22,9 @@ public class PdeBase extends Frame implements ActionListener {
protected RedoAction redoAction;
protected UndoManager undo = new UndoManager();
// indicator that this is the first time this feller has used p5
static boolean firstTime;
boolean errorState;
PdeEditor editor;
@@ -297,7 +300,6 @@ public class PdeBase extends Frame implements ActionListener {
//menu.addSeparator();
serialMenu = new Menu("Serial Port");
menu.add(serialMenu);
buildSerialMenu();
externalEditorItem = new CheckboxMenuItem("Use External Editor");
externalEditorItem.addItemListener(new ItemListener() {
@@ -341,6 +343,7 @@ public class PdeBase extends Frame implements ActionListener {
editor.frame = frame; // no longer really used
editor.init();
rebuildSketchbookMenu(sketchbookMenu);
buildSerialMenu();
frame.show(); // added back in for pde
}
@@ -714,7 +717,7 @@ public class PdeBase extends Frame implements ActionListener {
SerialMenuListener listener = new SerialMenuListener();
String defaultName = get("serial.port", "unspecified");
//boolean found;
boolean problem = false;
try {
Enumeration portList = CommPortIdentifier.getPortIdentifiers();
@@ -733,18 +736,24 @@ public class PdeBase extends Frame implements ActionListener {
}
}
} catch (UnsatisfiedLinkError e) {
e.printStackTrace();
JOptionPane.showMessageDialog(frame,
"Serial port support not installed. " +
"Check the readme for instructions if you " +
"need to use the serial port",
"Serial Port Warning",
JOptionPane.WARNING_MESSAGE);
//e.printStackTrace();
problem = true;
} catch (Exception e) {
System.out.println("exception building serial menu");
e.printStackTrace();
}
// only warn them if this is the first time
//if (getInteger("window.x", 0) == 0) {
if (firstTime) {
JOptionPane.showMessageDialog(frame,
"Serial port support not installed.\n" +
"Check the readme for instructions if you " +
"need to use the serial port. ",
"Serial Port Warning",
JOptionPane.WARNING_MESSAGE);
}
}

View File

@@ -373,6 +373,9 @@ public class PdeEditor extends Panel {
// the app reaches here when no sketch.properties file exists
//e.printStackTrace();
// indicator that this is the first time this feller has used p5
PdeBase.firstTime = true;
// even if folder for 'default' user doesn't exist, or
// sketchbook itself is missing, mkdirs() will make it happy
userName = "default";