Loading...
Logo
Processing Forum
Is it possible to make a program in which a new window is opened when I click a button or something like this..
 
I know it's possible with napplet (create windowed napplet) but I'd like to read here some other solutions..
 
thank you..

Replies(3)

I posted this code in another thread, but I will repost it here.
[Moderator's note: No need to repost, I prefer to put a link to the other thread, which could be easily found!]
second (another) program window in processing?
Has the linked-to page been changed?

I see:

Requested URL not found!

It looks like it...
I've no clue where I got this, it's from the old forum but an example which creates a second window:

Copy code
  1. PFrame f;
  2. secondApplet s;
  3. void setup() {
  4.  size(320, 240);
  5.  PFrame f = new PFrame();
  6. }
  7. void draw() {
  8.   background(255,0,0);
  9.    fill(255);
  10.    rect(10,10,frameCount0,10);
  11.    s.background(0, 0, 255);
  12.    s.fill(100);
  13.    s.rect(10,20,frameCount0,10);
  14.    s.redraw();
  15. }
  16. public class PFrame extends Frame {
  17.     public PFrame() {
  18.         setBounds(100,100,400,300);
  19.         s = new secondApplet();
  20.         add(s);
  21.         s.init();
  22.         show();
  23.     }
  24. }
  25. public class secondApplet extends PApplet {
  26.     public void setup() {
  27.         size(400, 300);
  28.         noLoop();
  29.     }
  30.     public void draw() {
  31.     }
  32. }
I suppose a link would be easier...