mirror of
https://github.com/processing/processing4.git
synced 2026-02-11 17:40:48 +01:00
change to not draw on-screen until draw mode app has completed
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
import java.awt.*; // for window
|
||||
import java.awt.event.*; // also for window
|
||||
import java.io.*;
|
||||
import java.lang.reflect.*;
|
||||
|
||||
#ifndef RXTX
|
||||
import javax.comm.*;
|
||||
@@ -74,6 +75,7 @@ public class PdeRuntime implements PdeMessageConsumer {
|
||||
" " + x1 + " " + y1);
|
||||
new PdeMessageSiphon(process.getInputStream(), this);
|
||||
new PdeMessageSiphon(process.getErrorStream(), this);
|
||||
|
||||
} else {
|
||||
Class c = Class.forName(className);
|
||||
applet = (BApplet) c.newInstance();
|
||||
@@ -95,6 +97,29 @@ public class PdeRuntime implements PdeMessageConsumer {
|
||||
}
|
||||
applet.start();
|
||||
|
||||
// check to see if it's a draw mode applet
|
||||
boolean drawMode = false;
|
||||
try {
|
||||
Method meth[] = c.getDeclaredMethods();
|
||||
for (int i = 0; i < meth.length; i++) {
|
||||
//System.out.println(meth[i].getName());
|
||||
if (meth[i].getName().equals("draw")) drawMode = true;
|
||||
}
|
||||
} catch (SecurityException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// if it's a draw mode app, don't even show on-screen
|
||||
// until it's finished rendering, otherwise the width/height
|
||||
// may not have been properly set.
|
||||
if (drawMode) {
|
||||
while (applet.frame != 1) {
|
||||
try {
|
||||
//System.out.println("waiting to complete drawing");
|
||||
Thread.sleep(5);
|
||||
} catch (InterruptedException e) { }
|
||||
}
|
||||
}
|
||||
|
||||
if (editor.presenting) {
|
||||
//window = new Window(new Frame());
|
||||
// toxi_030903: attach applet window to editor's presentation window
|
||||
@@ -150,7 +175,15 @@ public class PdeRuntime implements PdeMessageConsumer {
|
||||
|
||||
//System.out.println(SystemColor.windowBorder.toString());
|
||||
|
||||
//window.setLayout(new BorderLayout());
|
||||
/*
|
||||
int appletWidth = applet.width;
|
||||
int appletHeight = applet.height;
|
||||
if ((appletWidth == 0) || (appletHeight == 0)) {
|
||||
appletWidth = BApplet.DEFAULT_WIDTH;
|
||||
appletWidth = BApplet.DEFAULT_HEIGHT;
|
||||
}
|
||||
*/
|
||||
|
||||
window.setLayout(null);
|
||||
if (editor.presenting) {
|
||||
window.setBounds((screen.width - applet.width) / 2,
|
||||
|
||||
Reference in New Issue
Block a user