I'm trying to create two windows with Processing. Before you mark this as a duplicate, as there are other questions similar to this, I have a specific error and I can't find a solution. When I try to add(s)
I get the error The method add(Component) in the type Container is not applicable for the arguments (evolution_simulator.SecondApplet)
I'm not sure how to fix this, and any help would be appreciated. Here is the code:
import javax.swing.*;
PFrame f;
void setup() {
size(320, 240);
f = new PFrame();
}
void draw() {
}
public class PFrame extends JFrame {
SecondApplet s;
public PFrame() {
setBounds(100,100,400,300);
s = new SecondApplet();
add(s); // error occurs here
s.init();
show();
}
}
public class SecondApplet extends PApplet {
public void setup() {
size(400, 300);
noLoop();
}
public void draw() {
}
}