load image, video on a second window
in
Programming Questions
•
6 months ago
Hi all,
I'm trying to load a image or a video in a second window but i cant it promtps a Nullpointer error. What am I doing wrong? Many thanks id advice. Best regards
PFrame f;
secondApplet s;
import java.awt.Frame;
void setup() {
size(320, 240);
PFrame f = new PFrame();
}
void draw() {
background(255,0,0);
fill(255);
rect(10,10,frameCount%100,10);
s.background(0, 0, 255);
s.fill(100);
s.rect(10,20,frameCount%100,10);
s.redraw();
}
public class PFrame extends Frame {
public PFrame() {
setBounds(100,100,400,300);
s = new secondApplet();
add(s);
s.init();
show();
}
}
public class secondApplet extends PApplet {
PImage img;
public void setup() {
size(400, 300);
noLoop();
img = loadImage("ny.jpg");
}
public void draw() {
image(img, 0, 0);
}
}
2