python runs, but doesn't quit

This commit is contained in:
benfry
2001-07-26 20:20:31 +00:00
parent 0819b2743d
commit 568bd4a6ff
4 changed files with 8 additions and 111 deletions
+1 -1
View File
@@ -79,7 +79,7 @@ public class PdeApplet extends Applet
}
//add(hostess = new PdeEditor(this, program));
PdeEditor editor = new PdeEditor(this, program);
if (beautify) editor.doBeautify();
//if (beautify) editor.doBeautify();
setLayout(new BorderLayout());
add("Center", editor);
-103
View File
@@ -1,103 +0,0 @@
#ifdef EDITOR
import java.awt.*;
public class DbnEditorGraphics extends DbnGraphics {
static Font plainFont = new Font("Helvetica", Font.PLAIN, 10);
Color tickColor;
Color bgStippleColor;
DbnEditor editor;
public DbnEditorGraphics(int width, int height, Color tickColor,
Color bgColor, Color bgStippleColor,
DbnEditor editor) {
super(width, height, bgColor);
this.tickColor = tickColor;
this.bgStippleColor = bgStippleColor;
this.editor = editor;
}
public Dimension preferredSize() {
return new Dimension(width1*magnification + 100,
height1*magnification + 100);
}
public void base() {
if (baseImage == null) updateBase = true;
if (updateBase) {
// these few lines completely identical to DbnGraphics.base()
Dimension dim = preferredSize();
baseImage = createImage(dim.width, dim.height);
baseGraphics = baseImage.getGraphics();
lastImage = createImage(width, height);
lastGraphics = lastImage.getGraphics();
gx = (dim.width - width*magnification) / 2;
gy = (dim.height - height*magnification) / 2;
// draw background
Graphics g = baseGraphics;
g.setColor(bgColor);
g.fillRect(0, 0, dim.width, dim.height);
if (!bgColor.equals(bgStippleColor)) {
g.setColor(bgStippleColor);
int count = 2 * Math.max(dim.width, dim.height);
for (int i = 0; i < count; i += 2) {
g.drawLine(0, i, i, 0);
}
}
g.setFont(plainFont);
FontMetrics metrics = g.getFontMetrics();
int lineheight = metrics.getAscent() +
metrics.getDescent();
// put ticks around (only if in edit mode)
g.setColor(tickColor);
int increment = (width > 101) ? 25 : 20;
int x, y;
y = gy + height*magnification;
for (x = 0; x <= width; x += increment) {
int xx = x * magnification;
g.drawLine(gx + xx, y, gx + xx, y + 4);
String num = String.valueOf(x);
g.drawString(num, gx + xx - 1, y + 2 + lineheight);
}
for (y = 0; y <= height; y += increment) {
int yy = y * magnification;
g.drawLine(gx - 4, gy + yy, gx, gy + yy);
String num = String.valueOf(y);
int numWidth = metrics.stringWidth(num);
g.drawString(num, gx - 6 - numWidth,
gy + height*magnification - yy);
}
// draw a dark frame around the runner
g.setColor(Color.black);
g.drawRect(gx-1, gy-1, width*magnification+1, height*magnification+1);
}
}
public boolean updateMouse(Event e, int x, int y) {
super.updateMouse(e, x, y);
if (e.controlDown() && (mouse[2] == 100)) {
editor.doSaveTiff();
}
if (e.shiftDown()) {
editor.highlightLine(getLine(x, height1 - y));
}
return true;
}
}
#endif
+1 -1
View File
@@ -83,7 +83,7 @@ public class PdeRunner implements Runnable {
throw new Exception("javac support not included");
#endif
} else if (program.indexOf("// dbn") < 2) {
} else if (program.indexOf("// dbn") == 0) {
#ifdef DBN
String pre = "set red 0; set green 1; set blue 2; " +
"set quicktime 0; set tiff 1; set illustrator 2; ";
+6 -6
View File
@@ -7,18 +7,18 @@ import java.util.*;
public class ProcessingApplet extends Applet
implements BagelConstants, Runnable,
MouseListener, MouseMotionListener, KeyListener {
Bagel g;
public Bagel g;
int mouseX, mouseY;
boolean mousePressed;
public int mouseX, mouseY;
public boolean mousePressed;
boolean mousePressedBriefly;
int key;
boolean keyPressed;
public int key;
public boolean keyPressed;
boolean keyPressedBriefly;
boolean timing;
int millis;
public int millis;
long actualMillis;
long millisOffset;
Calendar calendar;