<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
      <title>Tagged with settings() - Processing 2.x and 3.x Forum</title>
      <link>https://forum.processing.org/two/discussions/tagged/feed.rss?Tag=settings%28%29</link>
      <pubDate>Sun, 08 Aug 2021 18:22:16 +0000</pubDate>
         <description>Tagged with settings() - Processing 2.x and 3.x Forum</description>
   <language>en-CA</language>
   <atom:link href="/two/discussions/taggedsettings%28%29/feed.rss" rel="self" type="application/rss+xml" />
   <item>
      <title>Moving existing from Processing 2 to 3: error with size(1350,1080);</title>
      <link>https://forum.processing.org/two/discussion/28013/moving-existing-from-processing-2-to-3-error-with-size-1350-1080</link>
      <pubDate>Wed, 23 May 2018 19:29:24 +0000</pubDate>
      <dc:creator>Pinto318</dc:creator>
      <guid isPermaLink="false">28013@/two/discussions</guid>
      <description><![CDATA[<p>error: cannot be used here.<br />
void setup() {
         size(1350,1080);</p>
]]></description>
   </item>
   <item>
      <title>stream video on second monitor</title>
      <link>https://forum.processing.org/two/discussion/27915/stream-video-on-second-monitor</link>
      <pubDate>Fri, 04 May 2018 16:22:23 +0000</pubDate>
      <dc:creator>secondsky</dc:creator>
      <guid isPermaLink="false">27915@/two/discussions</guid>
      <description><![CDATA[<p>Hi All, i would be able to stream two video on two different monitor, at the same time.
So far this is the code i written to stream one on the secondary monitor, but is not working:</p>

<pre><code>import processing.video.*;

final PApplet projector0 = new ProjectorSketch();
final PApplet projector1 = new ProjectorSketch();

void setup() {
  size(300, 300, JAVA2D);
  smooth(4);
  noLoop();
  stroke(-1);

  runSketch(new String[] { "--display=1", "--present",  "--sketch-path=" + sketchPath(), "Projector" }, projector0);

}

void draw() {
  background(0);
}


class ProjectorSketch extends PApplet {
  Movie movie;


 void setup() {

   stroke(#FFFF00);
   movie = new Movie(this, "transit.mov");
  movie.loop();

   }


  public void settings() {
    size(displayWidth, displayHeight, JAVA2D);

  }

  void draw() {

  image(movie, 0, 0, width, height);
  }
}

public void movieEvent(Movie m) {
  m.read();
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>what are the differences between setup() and settings()?</title>
      <link>https://forum.processing.org/two/discussion/27819/what-are-the-differences-between-setup-and-settings</link>
      <pubDate>Sun, 22 Apr 2018 10:30:32 +0000</pubDate>
      <dc:creator>greenleafvolatile</dc:creator>
      <guid isPermaLink="false">27819@/two/discussions</guid>
      <description><![CDATA[<p>It's in the API, but the explanation there is too vague for me. I don't get it. Can someone elucidate?</p>
]]></description>
   </item>
   <item>
      <title>with second applet, strange errors about createGraphics</title>
      <link>https://forum.processing.org/two/discussion/27782/with-second-applet-strange-errors-about-creategraphics</link>
      <pubDate>Tue, 17 Apr 2018 03:23:45 +0000</pubDate>
      <dc:creator>prismspecs</dc:creator>
      <guid isPermaLink="false">27782@/two/discussions</guid>
      <description><![CDATA[<pre><code>PGraphics canvas;

void setup() {
  size(400, 400, P3D);
  canvas = createGraphics(400, 400, P3D);

  String[] args = {"YourSketchNameHere"};
  SecondApplet sa = new SecondApplet();
  PApplet.runSketch(args, sa);
}

void draw() {

  canvas.beginDraw();
  canvas.background(127);
  canvas.lights();
  canvas.translate(width/2, height/2);
  canvas.rotateX(frameCount * 0.01);
  canvas.rotateY(frameCount * 0.01);  
  canvas.box(150);
  canvas.endDraw();
  image(canvas, 0, 0);
}     

public class SecondApplet extends PApplet {

  public void settings() {
    size(200, 100,P3D);
  }
  public void draw() {
    background(255);
    fill(0);
    ellipse(100, 50, 10, 10);
  }
}
</code></pre>

<p>With that code I get "createGraphics() requires size to use P3D or P2D" (paraphrasing)</p>

<p>Or if I try to create an instance of a Syphon window, for example, I get null pointer.</p>

<p>What's the deal? My goal is to create a 2-window app with Syphon output from one window and a P5 control setup on the other.</p>
]]></description>
   </item>
   <item>
      <title>Error message: Usage: PApplet</title>
      <link>https://forum.processing.org/two/discussion/27648/error-message-usage-papplet</link>
      <pubDate>Mon, 02 Apr 2018 15:37:47 +0000</pubDate>
      <dc:creator>barny1952</dc:creator>
      <guid isPermaLink="false">27648@/two/discussions</guid>
      <description><![CDATA[<p>I am working only since a short time with Processing. I always get this error message:</p>

<p><code>Usage: PApplet &lt;appletname&gt;</code></p>

<p>For example I am using these 2 Java-files in a project:</p>

<p>Main.java:</p>

<pre><code>`package de.hpi.javaide.firststeps;
import processing.core.PApplet;
public class Main {
    public static void main(String[] args) {
        PApplet.main(new String[]{"--present", "de.hpi.javaide.firststeps.Game"});
    }
}
`
</code></pre>

<p>Game.java:</p>

<p><code>package de.hpi.javaide.firststeps;
    import processing.core.PApplet;
    <a href="/two/profile/SuppressWarnings">@SuppressWarnings</a>("serial")
    public class Game extends PApplet {
        <a href="/two/profile/Override">@Override</a>
        public void setup() {
            noStroke();
            fill(255, 10, 10);
            rectMode(CORNER);
            rect(5, -100, 20, 10);
        }
        <a href="/two/profile/Override">@Override</a>
        public void draw() {
        }
    }</code></p>

<p>These files come from a course of OpenHPI. Last year processing worked without any problem. Now I get the above shown error code when using any java file using process.</p>

<p>I am using eclipse neon, java version "1.8.0_161" and  core.jar (version 3)</p>

<p>Any help appreciated!
Thanks in advance for your help!</p>
]]></description>
   </item>
   <item>
      <title>Second applet and Classes</title>
      <link>https://forum.processing.org/two/discussion/26310/second-applet-and-classes</link>
      <pubDate>Sun, 11 Feb 2018 03:59:46 +0000</pubDate>
      <dc:creator>vjjv</dc:creator>
      <guid isPermaLink="false">26310@/two/discussions</guid>
      <description><![CDATA[<p>Hey, i`ve this simple code:</p>

<pre><code>PWindow w;
Radar r;

void settings() {
  size(500, 500, P3D);
}
void setup() {
  w = new PWindow();
  r = new Radar();
}


void draw() {

  translate(width/2, height/2);
  box(200);
}

class Radar{

Radar(){
}

void display(){
  stroke(255);
  ellipse(width/2, height/2, 100, 100);
}

}

class PWindow extends PApplet {

  PWindow() {
    super();
    PApplet.runSketch(new String[] {this.getClass().getSimpleName()}, this);

  }

  void settings() {
    size(500, 500, P2D);
  }

void setup(){
background(0);
}

  void draw(){
  r.display();
  }
}
</code></pre>

<p>but it doesn't work (crash). im really don't know how use a class inside a extra applet.
any suggestion?</p>
]]></description>
   </item>
   <item>
      <title>100% CPU utilisation when playing multiple videos using the video library</title>
      <link>https://forum.processing.org/two/discussion/14329/100-cpu-utilisation-when-playing-multiple-videos-using-the-video-library</link>
      <pubDate>Fri, 08 Jan 2016 01:14:24 +0000</pubDate>
      <dc:creator>alzxul</dc:creator>
      <guid isPermaLink="false">14329@/two/discussions</guid>
      <description><![CDATA[<p>Hi,</p>

<p>I'm trying to play some movies and sound in a processing sketch; there are 10 movies and 1 sound file - all the movies are fairly small [&lt;=5MB]; I create them in setup and call .play() on them, and then in draw() I use image() on them, and I also use movieEvent() function to call .read() on them; whenever I run this the videos lag and my CPU spikes to 100%</p>

<p>Surely playing 10 concurrent movies isn't that onerous?</p>

<p>Does anyone have any ideas for how to improve the performance or can tell me if I'm doing something wrong or missing something?</p>

<p>Any help would be much appreciated, thanks</p>

<p>Thanks</p>
]]></description>
   </item>
   <item>
      <title>Hi - wanting to make the screen size same as the image size automatically</title>
      <link>https://forum.processing.org/two/discussion/25613/hi-wanting-to-make-the-screen-size-same-as-the-image-size-automatically</link>
      <pubDate>Mon, 18 Dec 2017 03:19:36 +0000</pubDate>
      <dc:creator>zymon</dc:creator>
      <guid isPermaLink="false">25613@/two/discussions</guid>
      <description><![CDATA[<p>//trying to make the image fit within the screen. 
//I did try adding the pixel sizes with image (img,0,0,1000,1000) it worked
//but I might not always know the image size so how to make it automatic
//BTW this code must be so bad it hung my PC.</p>

<pre><code>PImage img; //image is 1000x1000 pixels

int x = img.width;  //x is same as image width
int y = img.height;  //y is same as image height

Void setup() {
 size (x,y);  //screen size is same as image
 img = loadImage ("01.JPG"); 
}

voif draw() {
  image (img, 0,0); 
}
</code></pre>

<p>//I need to know how to manipulate image sizes without distorting the propotions</p>
]]></description>
   </item>
   <item>
      <title>Refferancing applets</title>
      <link>https://forum.processing.org/two/discussion/25507/refferancing-applets</link>
      <pubDate>Mon, 11 Dec 2017 08:13:02 +0000</pubDate>
      <dc:creator>LaxOfBayDay</dc:creator>
      <guid isPermaLink="false">25507@/two/discussions</guid>
      <description><![CDATA[<p>If I wanted to write code in one applet's "draw" to display an image in the other, what would I do?</p>

<p>In the situation below, if I move "image(example.get(0),0,0);" to draw and put "sa." or "SecondApplet." in front of it. I get an error that the name isn't recognizable or that I'm mixing static with non-static. How would I refer to the second applet in this case?</p>

<pre><code>ArrayList&lt;PImage&gt; example = new ArrayList&lt;PImage&gt;();

void setup() {
  size(100, 100);

  text.add(loadImage("example.png"));

  String[] args = {"TwoFrameTest"};
  SecondApplet sa = new SecondApplet();
  PApplet.runSketch(args, sa);
}

void draw() {
  background(0);
  ellipse(50, 50, 10, 10);

}     

public class SecondApplet extends PApplet {

  public void settings() {
    size(200, 100);
  }
  public void draw() {
    background(255);
    fill(0);
    ellipse(100, 50, 10, 10);
    //////////
    image(example.get(0),0,0);
    /////////
  }
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>Can't load image</title>
      <link>https://forum.processing.org/two/discussion/25448/can-t-load-image</link>
      <pubDate>Fri, 08 Dec 2017 05:37:20 +0000</pubDate>
      <dc:creator>LaxOfBayDay</dc:creator>
      <guid isPermaLink="false">25448@/two/discussions</guid>
      <description><![CDATA[<p>So I need to make an app with two windows. I got this code online and it works but I cant load an image into it (the commented out part is mine). Any idea why the app freezes when I try to run it while loading an image?</p>

<blockquote class="Quote">
  <p>class PWindow extends PApplet {
     //   PImage[] subs = new PImage[2];
       // String testKey="m";
    PWindow() {
      super();
      PApplet.runSketch(new String[] {this.getClass().getSimpleName()}, this);
  <br />
    }</p>
  
  <p>void settings() {
      size(1920, 1080);
    }</p>
  
  <p>void setup() {
      background(150);
      //  subs[0]=loadImage("test.png");
    }</p>
  
  <p>void draw() {
      //if (keyPressed &amp;&amp; key == testKey.charAt(0)){
     // image(subs[0], 0,0);
     println("well it works");
      //}
    }</p>
  
  <p>void mousePressed() {
      println("mousePressed in secondary window");
    }
  }</p>
</blockquote>
]]></description>
   </item>
   <item>
      <title>"size cannot be used here" / loading images in settings()</title>
      <link>https://forum.processing.org/two/discussion/25270/size-cannot-be-used-here-loading-images-in-settings</link>
      <pubDate>Wed, 29 Nov 2017 14:10:22 +0000</pubDate>
      <dc:creator>pacoruiz</dc:creator>
      <guid isPermaLink="false">25270@/two/discussions</guid>
      <description><![CDATA[<p>Hi, Im executing this code and find this error: "size cannot be used here"</p>

<pre><code>PImage img;
PImage picture;
Integer[] palette;

void setup(){
  img = loadImage("palette.jpg");
  palette = getPalette(img);
  picture = loadImage("picture.jpg");
  size(picture.width,picture.height);
  background(255);
}

void draw(){
  colour(picture, palette);
  noLoop();
} 
</code></pre>
]]></description>
   </item>
   <item>
      <title>Size problem on two window at the same sketch</title>
      <link>https://forum.processing.org/two/discussion/23268/size-problem-on-two-window-at-the-same-sketch</link>
      <pubDate>Fri, 30 Jun 2017 13:55:56 +0000</pubDate>
      <dc:creator>forty69</dc:creator>
      <guid isPermaLink="false">23268@/two/discussions</guid>
      <description><![CDATA[<p>Hi Everyone,</p>

<p>I have written a code that uses the "controlP5" library. The sketch has some sliders and textboxes. The setup function of the sketch has the information about the position of the gui elements.</p>

<p>So, I want to make a simulation. In fact, I did on other sketch, but I got a size problem when I implement the simulation and the code on the same sketch. Let me explain a bit more about the simulation :</p>

<p>I used P3D to apply the coordinates of the shape by using vertex function.</p>

<p>Here is a quick example of what I did so far :</p>

<pre><code>          public class SecondApplet extends PApplet {
          public void settings() {
                size(1000, 600,P3D);
              }
          public void setup() {

            translate(width/2,height/3, -200);
            stroke(255);
            noFill();

            beginShape();

            vertex(-82.27,0,47.5); vertex(0,0,-23.75);
            vertex(82.27,0,47.5); vertex(-82.27,0,47.5);


            vertex(-270,0,0); vertex(-65,397.5,0);
            vertex(32.5,397.5,-56.3); vertex(32.5,397.5,56.3);

            vertex(-65,397.5,0); vertex(32.5,397.5,56.3);
            vertex(135,0,233.827); vertex(82.27,0,47.5);

            vertex(0,0,-23.75); vertex(135,0,-233.827);
            vertex(32.5,397.5,-56.3);
            endShape();
          }
        }

        void setup() {
          size(1000,800);
          frameRate(25);

          controlP5 = new ControlP5(this);
          controlP5.setAutoInitialization(false);

          /* Setups of the gui elements ...
              -----------------------*/

          SecondApplet sa = new SecondApplet();
          String[] args = {"TwoFrameTest"};
          PApplet.runSketch(args, sa);
          updateGuiElements();
        }
</code></pre>

<p>So, the situation is the size problem on the two windows that I wanted to see when I run the sketch. The main window, which is on the "void setup()" section, is smaller than the second window.</p>

<p>I tried to find out the solution, but I couldn't overcome this problem. What I have to do in order to solve this situation ?</p>

<p>( I tried to explain the problem as well as I can).</p>

<p>I am looking forward to your suggestions. Thanks in advanced.</p>

<p>Have a nice works to all..</p>
]]></description>
   </item>
   <item>
      <title>Canvas size does not fill Android Emulator screen</title>
      <link>https://forum.processing.org/two/discussion/22948/canvas-size-does-not-fill-android-emulator-screen</link>
      <pubDate>Mon, 05 Jun 2017 23:17:52 +0000</pubDate>
      <dc:creator>mapk</dc:creator>
      <guid isPermaLink="false">22948@/two/discussions</guid>
      <description><![CDATA[<p>I'm using Android Studio and am aware that the <code>size()</code> method doesn't work, so I tried removing it altogether, but my canvas is super small within the emulator. Anyone know how to force it to be fullscreen?</p>

<pre><code>public class Sketch extends PApplet {

    public void setup() {
        background(52,74,85);
        noLoop();
    }

    public void draw() {
        ellipse(width/2, height/2, 100, 100);
    }
}
</code></pre>

<p>IMAGE:
<img src="https://cldup.com/r8GdGJbUhp.png" alt="" /></p>
]]></description>
   </item>
   <item>
      <title>GL video 1.2.1</title>
      <link>https://forum.processing.org/two/discussion/21587/gl-video-1-2-1</link>
      <pubDate>Fri, 24 Mar 2017 17:21:04 +0000</pubDate>
      <dc:creator>RaulF</dc:creator>
      <guid isPermaLink="false">21587@/two/discussions</guid>
      <description><![CDATA[<p>Hi there!</p>

<p>I have installed the last GL video version, to see if I can solve my "jump" problems (<a href="https://forum.processing.org/two/discussion/13673/jump-in-videolibrary-causes-java-error#latest" target="_blank" rel="nofollow">https://forum.processing.org/two/discussion/13673/jump-in-videolibrary-causes-java-error#latest</a>).</p>

<p>But, with version 1.2.1 playing the videos the image freezes constantly.</p>

<p>I'm testing it in 5 different Raspberry at the same time, with the same results (253% CPU!). All software updated.</p>

<pre><code>PID USER      PR  NI    VIRT    RES       SHR S    %CPU  %MEM     TIME+ COMMAND                 
1033 pi        20   0  457288  91032  13084 S 253.2 23.2 351:44.38 java 
</code></pre>

<p>I'm also playing the same video file in 8 Raspberry, same hardware and software, but with GL video 1.2. Better performance:</p>

<pre><code>PID USER      PR  NI    VIRT    RES        SHR S      %CPU   %MEM   TIME+ COMMAND                 
1069 pi         0 -20  371956  58540  12232 S  48.3 14.9 136:07.68 java   
</code></pre>

<p>Video file:</p>

<p>Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, smpte170m/smpte170m/bt709), 800x480, 9462 kb/s, SAR 1:1 DAR 5:3, 60 fps, 60 tbr, 60 tbn, 120 tbc (default)<br />
Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, 1 channels, s16, 768 kb/s (default)</p>

<p>Any help is welcome!</p>

<p>Best.</p>
]]></description>
   </item>
   <item>
      <title>Is there a way to determine display size prior to setting screen size?</title>
      <link>https://forum.processing.org/two/discussion/20952/is-there-a-way-to-determine-display-size-prior-to-setting-screen-size</link>
      <pubDate>Wed, 22 Feb 2017 16:34:52 +0000</pubDate>
      <dc:creator>Jackieh111</dc:creator>
      <guid isPermaLink="false">20952@/two/discussions</guid>
      <description><![CDATA[<p>I'm writing a program that will run on different screen sizes so I want to dynamically set the screen size in setup. Can I find out the width and height of the attached display at run time and then set screen size?
I don't want to use fullScreen as sometimes the attached display will be just too big and I want to put a max on setup size.</p>

<p>Any suggestions?</p>
]]></description>
   </item>
   <item>
      <title>size() not working in a different tab?</title>
      <link>https://forum.processing.org/two/discussion/21821/size-not-working-in-a-different-tab</link>
      <pubDate>Wed, 05 Apr 2017 09:49:44 +0000</pubDate>
      <dc:creator>Helis</dc:creator>
      <guid isPermaLink="false">21821@/two/discussions</guid>
      <description><![CDATA[<p>Hey there.
I'm new to processing, so pardon me if it's a dumb question, but I'm kinda dumbfounded.</p>

<p>So, I'm following D. Shiffman's "Nature of Code" course on Youtube.</p>

<pre><code>class Mover {

  PVector position;
  PVector velocity;
  PVector acceleration;
  float mass;

  Mover() {
    position = new PVector(random(width), 0);
    velocity = new PVector(0,0);
    acceleration = new PVector(0,0);
    mass = random(0.5, 4);
  }

  void applyForce(PVector force) {
     PVector f = PVector.div(force, mass);
     acceleration.add(f);
  }

  void update() {
    velocity.add(acceleration);
    position.add(velocity);
    acceleration.mult(0);
  }

  void display() {
    stroke(0);
    fill(127);
    ellipse(position.x,position.y, mass * 20, mass * 20);
  }

  void checkEdges() {

    if (position.x &gt; width) {
      position.x = width;
      velocity.x *= -1;
    } else if (position.x &lt; 0) {
      velocity.x *= -1;
      position.x = 0;
    }

    if (position.y &gt; height) {
      velocity.y *= -1;
      position.y = height;
    }

  }

}

Mover[] movers;


void setup() {
  size(640, 360);
  movers = new Mover[5];
  for(int i = 0; i &lt; movers.length; i++) {
    movers[i] = new Mover();
  }
}

void draw() {
   background(255);

  for(Mover m: movers) {
    PVector gravity = new PVector(0, 0.3);
    gravity.mult(m.mass);
    m.applyForce(gravity);



    if(mousePressed) {
      PVector friction = m.velocity.copy();
      friction.normalize();
      friction.mult(-1);
      float c = 0.1;
      friction.mult(c);
      m.applyForce(friction);
    }


    m.update();
    m.checkEdges();
    m.display();
  }
}
</code></pre>

<p>This example works perfectly fine when placed in a single tab. But then I decided to leave the class in one tab and the rest of the stuff in another one. And as soon as my setup() gets moved to a new tab, I get an error "size() cannot be used here" when trying to run the sketch.</p>

<p>Processing considers multiple tabs to be just one big file, doesn't it? So how does this make sense?</p>
]]></description>
   </item>
   <item>
      <title>size() variable error</title>
      <link>https://forum.processing.org/two/discussion/21314/size-variable-error</link>
      <pubDate>Fri, 10 Mar 2017 16:42:37 +0000</pubDate>
      <dc:creator>Frey</dc:creator>
      <guid isPermaLink="false">21314@/two/discussions</guid>
      <description><![CDATA[<p>Hi, I want to set the size based on an image dimensions.</p>

<p>What am I doing wrong?
<a rel="nofollow" href="https://forum.processing.org/two/uploads/imageupload/445/ODGZGEL7YGYB.jpg" title="Error">Error</a></p>

<p>(if I print the value, it's ok).</p>

<p>def setup():</p>

<pre><code> photo = loadImage("Photo.jpg")
 print(photo.height)
 image(photo, 0, 0)
</code></pre>

<p>Thank you!</p>
]]></description>
   </item>
   <item>
      <title>Remove processing-java window</title>
      <link>https://forum.processing.org/two/discussion/20798/remove-processing-java-window</link>
      <pubDate>Tue, 14 Feb 2017 17:42:49 +0000</pubDate>
      <dc:creator>usernamevalid</dc:creator>
      <guid isPermaLink="false">20798@/two/discussions</guid>
      <description><![CDATA[<p>Im running processing-java from cmd line in another app. The app creates an image in an offscreen buffer, saves it and exits. 
However when ever the app is called there is still a window that pops up on screen, it takes focus away anything on screen. Is there a way to run processing-java with no window?</p>

<p>Thanks</p>
]]></description>
   </item>
   <item>
      <title>Trouble with window size when using SecondApplet</title>
      <link>https://forum.processing.org/two/discussion/19860/trouble-with-window-size-when-using-secondapplet</link>
      <pubDate>Wed, 21 Dec 2016 05:59:35 +0000</pubDate>
      <dc:creator>BlindAssassin111</dc:creator>
      <guid isPermaLink="false">19860@/two/discussions</guid>
      <description><![CDATA[<p>First off I am new to processing and GUI in java. I am trying to port a program I made in matlab (I know what you are thinking, but it was due to the fact I had to take a class that used it for my degree, and since it has a super simple GUI maker) to java so I can make an executable from it and distribute it.</p>

<p>Now the issue I am having is for some reason the settings function under the SecondApplet class seems to affect the window that is made using the original setup function. So when the program is ran, the window is reduced to a super small ~100x100 size even if both size calls are size(1280,650), as well the second window now is the correct size. But if the settings function is commented out, the original window is correct, and the new window will be ~100x100.</p>

<p>Goal is to have the button called "Suspension_Setup" open a new window to enter data about the suspension points on the users vehicle, and then save them in a file to be used by the original window to display what I am trying to do.</p>

<p>If anyone can, could I also get an answer on a good way to close the second window, while preserving the original window? I have looked, but the only thing I have seen is using PFrame, and I don't know if I need that yet.</p>

<p>This is super bare bones right now due to the fact I am trying to just make the framework for the interface first, and ran into this issue very quickly.</p>

<p>Code:</p>

<pre><code>import controlP5.*;  // Importing GUI library

ControlP5 cp5;  // Creating a new object for the GUI library

CheckBox checkbox;  // Creating a checkbox object

DropdownList d1, d2;  // Creating a Dropdown menu object

boolean show = false;  // Setting the default state of the second window to false

void setup()
{
  size(1280, 650);
  cp5 = new ControlP5(this);
  checkbox = cp5.addCheckBox("checkBox")
    .setPosition(500, 500)
    .setColorForeground(color(120))
    .setColorActive(color(255))
    .setColorLabel(color(255))
    .setSize(40, 40)
    .setItemsPerRow(3)
    .setSpacingColumn(30)
    .setSpacingRow(20)
    .addItem("0", 0)
    .addItem("50", 50)
    .addItem("100", 100)
    .addItem("150", 150)
    .addItem("200", 200)
    .addItem("255", 255);

  // create a DropdownList
  d1 = cp5.addDropdownList("myList-d1").setPosition(500, 20);

  formatDropdown(d1); // customize the first list

  // create a second DropdownList
  d2 = cp5.addDropdownList("myList-d2").setPosition(500, 80);

  formatDropdown(d2); // customize the second list

  // create a new button with name 'buttonA'
  cp5.addButton("Suspension_Setup")
    .setPosition(0, 0)
    .setSize(80, 30);
}


void formatDropdown(DropdownList ddl)
{
  // a convenience function to customize a DropdownList
  ddl.setSize(200, 200);
  ddl.setBackgroundColor(color(190));
  ddl.setItemHeight(30);
  ddl.setBarHeight(30);
  ddl.setCaptionLabel("dropdown");
  for (int i = 0; i &lt; 40; i++)
  {
    ddl.addItem("item " + i, i);
  }
  //ddl.scroll(0);
  ddl.setColorBackground(color(60));
  ddl.setColorActive(color(255, 128));
  ddl.close();

  // remove items from the pulldown menu  by name
  // d1.removeItem("item "+cnt);

  // add new items to the pulldown menu
  // int n = (int)(random(100000));
  // d1.addItem("item "+n, n);
}

void keyPressed()  // Might be used in future for shortcuts or special features
{

}

// function Suspension_Setup will receive changes from controller with name Suspension_Setup
public void Suspension_Setup(int theValue) {
  println("a button event from Suspension_Setup: "+theValue);
  show = true;
  String[] args = {"TwoFrameTest"};
  SecondApplet sa = new SecondApplet();
  PApplet.runSketch(args, sa);
}

void controlEvent(ControlEvent theEvent)
{
  // DropdownList is of type ControlGroup.
  // A controlEvent will be triggered from inside the ControlGroup class.
  // therefore you need to check the originator of the Event with
  // if (theEvent.isGroup())
  // to avoid an error message thrown by controlP5.

  if (theEvent.isGroup())
  {
    // check if the Event was triggered from a ControlGroup
    println("event from group : "+theEvent.getGroup().getValue()+" from "+theEvent.getGroup());
  } else if (theEvent.isController())
  {
    println("event from controller : "+theEvent.getController().getValue()+" from "+theEvent.getController());
  }
}

void draw()
{
  background(0);
}


public class SecondApplet extends PApplet
{
  public void settings()
  {
    size(1280, 650);
  }
  public void draw()
  {
    if (show)
    {
      background(255);
      noFill();
      ellipse(100, 50, 10, 10);
    }
    show = false;
  }
}
</code></pre>

<p>Thank you for the help!</p>
]]></description>
   </item>
   <item>
      <title>How to set size() before running the Applet?</title>
      <link>https://forum.processing.org/two/discussion/19747/how-to-set-size-before-running-the-applet</link>
      <pubDate>Wed, 14 Dec 2016 17:41:04 +0000</pubDate>
      <dc:creator>ardias</dc:creator>
      <guid isPermaLink="false">19747@/two/discussions</guid>
      <description><![CDATA[<p>Hello,
I'm trying to set the size of my sketch via Java-Properties read from a configuration file.
So the code for that has to be executed before settings() and setup(). Is this even possible in processing?</p>
]]></description>
   </item>
   <item>
      <title>Can I start processing without opening a window?</title>
      <link>https://forum.processing.org/two/discussion/18794/can-i-start-processing-without-opening-a-window</link>
      <pubDate>Sun, 30 Oct 2016 17:11:50 +0000</pubDate>
      <dc:creator>Matei</dc:creator>
      <guid isPermaLink="false">18794@/two/discussions</guid>
      <description><![CDATA[<p>So it's something very basic, but I really wonder if there is a way to do it, as I searched for a while without success. My purpose is to manipulate image files. So, I don't need anything to be displayed until I choose a file. Once done, I want the image to be displayed with the proper dimensions. Here is the very simple code for that, <strong>but I can't get rid of the first window of 600x600 pixels</strong>, so maybe you know a way to do that?</p>

<pre><code>PImage loadedImgage;
String selectedPath = "";

void fileSelected(File selection) {
  selectedPath = selection.getAbsolutePath();
}

void setup() {
  size(600, 600);
  selectInput("Select a file to process:", "fileSelected");
}

void draw() {  
  if(selectedPath != ""){
    loadedImgage = loadImage(selectedPath);
    image(loadedImgage, 0, 0);
  }
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>cannot pass a variable to the fullScreen() function</title>
      <link>https://forum.processing.org/two/discussion/18729/cannot-pass-a-variable-to-the-fullscreen-function</link>
      <pubDate>Wed, 26 Oct 2016 15:33:26 +0000</pubDate>
      <dc:creator>magrini</dc:creator>
      <guid isPermaLink="false">18729@/two/discussions</guid>
      <description><![CDATA[<p>Hello, I need to call the fullScreen function, in the setup, with the value of  a variable (1 or 2).
You can't do it. 
And you can't even make an "if  then" selecting fullScreen(1) or fullScreen(2). It looks like the fullScreen function
is NOT a real function, but a sort of macro...
So now I must to compile TWO different applications, one if I want to use screen 1 and one for the screen 2.
Sorry, but It's just ridicolous.</p>
]]></description>
   </item>
   <item>
      <title>"Size() cannot be used here" Error for "size (800, 600, P3D)"</title>
      <link>https://forum.processing.org/two/discussion/18521/size-cannot-be-used-here-error-for-size-800-600-p3d</link>
      <pubDate>Wed, 12 Oct 2016 18:25:48 +0000</pubDate>
      <dc:creator>grapher85</dc:creator>
      <guid isPermaLink="false">18521@/two/discussions</guid>
      <description><![CDATA[<p>I am new to Processing.  I picked up the book Processing: A Programming Handbook for Visual Designers and Artists so started going through that.  I have been trying out code that I have come across from others and had an error, that I wanted to ask the forum for help.  I am running Processing 3.2.1 on Windows 10 but getting an error on the below code "size (800, 600, P3D)" the window at bottom says size() cannot be user here.  If someone can kindly review the below code and let me know what needs to be changed, I would greatly appreciate it.  Thanks
<a rel="nofollow" href="https://dribbble.com/shots/1754428-Wave">https://dribbble.com/shots/1754428-Wave</a> <img src="" alt="" /></p>

<p>Code below</p>

<pre><code>            // by d whyte

int[][] result;
float t;

float ease(float p) {
  return 3*p*p - 2*p*p*p;
}

float ease(float p, float g) {
  if (p &lt; 0.5) 
    return 0.5 * pow(2*p, g);
  else
    return 1 - 0.5 * pow(2*(1 - p), g);
}

float mn = .5*sqrt(3);

void setup() {
  setup_();
  result = new int[width*height][3];
}

void draw() {

  if (!recording) {
    t = mouseX*1.0/width;
    draw_();
  } else {
    for (int i=0; i&lt;width*height; i++)
      for (int a=0; a&lt;3; a++)
        result[i][a] = 0;

    for (int sa=0; sa&lt;samplesPerFrame; sa++) {
      t = map(frameCount-1 + sa*shutterAngle/samplesPerFrame, 0, numFrames, 0, 1);
      draw_();
      loadPixels();
      for (int i=0; i&lt;pixels.length; i++) {
        result[i][0] += pixels[i] &gt;&gt; 16 &amp; 0xff;
        result[i][1] += pixels[i] &gt;&gt; 8 &amp; 0xff;
        result[i][2] += pixels[i] &amp; 0xff;
      }
    }

    loadPixels();
    for (int i=0; i&lt;pixels.length; i++)
      pixels[i] = 0xff &lt;&lt; 24 | 
        int(result[i][0]*1.0/samplesPerFrame) &lt;&lt; 16 | 
        int(result[i][1]*1.0/samplesPerFrame) &lt;&lt; 8 | 
        int(result[i][2]*1.0/samplesPerFrame);
    updatePixels();

    saveFrame("f###.gif");
    if (frameCount==numFrames)
      exit();
  }
}

//////////////////////////////////////////////////////////////////////////////

int samplesPerFrame = 16;
int numFrames = 96;        
float shutterAngle = .5;

boolean recording = true;

void setup_() {
  size(800, 600, P3D);
  smooth(8);
  rectMode(CENTER);
  stroke(70,150,200);
  noFill();
  strokeWeight(2);
}

float x, y, z, tt;
int N = 24, M = 16;
float l = 500, w = 320;
int n = 120;
float h = 120;
float q = 0.00011, ll = .000035;

void draw_() {
  background(250); 
  pushMatrix();
  translate(width/2, height/2 - 25);
  rotateX(PI*.24);
  for (int i=0; i&lt;N; i++) {
    x = map(i, 0, N-1, -l/2, l/2);
    strokeWeight(1.6);
    if(i==0 || i==N-1)
      strokeWeight(4);
    beginShape();
    for (int j=0; j&lt;n; j++) {
      y = map(j, 0, n-1, -w/2-1, w/2+1);
      z = h*sin(TWO_PI*t - q*(x*x + y*y))*exp(-ll*(x*x + y*y));
      vertex(x, y, z);
    }
    endShape();
  }
  for (int i=0; i&lt;M; i++) {
    y = map(i, 0, M-1, -w/2, w/2);
    strokeWeight(1.6);
    if(i==0 || i==M-1)
      strokeWeight(4);
    beginShape();
    for (int j=0; j&lt;n; j++) {
      x = map(j, 0, n-1, -l/2-1, l/2+1);
      z = h*sin(TWO_PI*t - q*(x*x + y*y))*exp(-ll*(x*x + y*y));
      vertex(x, y, z);
    }
    endShape();
  }
  popMatrix();
}
</code></pre>

<p><img src="https://forum.processing.org/two/uploads/imageupload/768/QG17EZBPW5LO.png" alt="2016-10-12_164700" title="2016-10-12_164700" /></p>
]]></description>
   </item>
   <item>
      <title>Eclipse Not Changing Size</title>
      <link>https://forum.processing.org/two/discussion/18286/eclipse-not-changing-size</link>
      <pubDate>Sun, 25 Sep 2016 07:23:34 +0000</pubDate>
      <dc:creator>Zac</dc:creator>
      <guid isPermaLink="false">18286@/two/discussions</guid>
      <description><![CDATA[<p>I just followed this tutorial - <a href="https://processing.org/tutorials/eclipse/" target="_blank" rel="nofollow">https://processing.org/tutorials/eclipse/</a> - to set up Processing in Eclipse. I used the Processing 2 core file as the imported core.</p>

<p>When I try and changed the size in settings it does not work but it does in setup. Why is this the case?</p>

<p>Thanks</p>
]]></description>
   </item>
   <item>
      <title>Setting img as background - Coordinate out of bounds</title>
      <link>https://forum.processing.org/two/discussion/18227/setting-img-as-background-coordinate-out-of-bounds</link>
      <pubDate>Wed, 21 Sep 2016 04:29:44 +0000</pubDate>
      <dc:creator>nach</dc:creator>
      <guid isPermaLink="false">18227@/two/discussions</guid>
      <description><![CDATA[<p>Hey guys, I'm trying to display and image as my background in the <code>void setup()</code> but it shows me the <em>ArrayIndexOutOfBoundException: Coordinate out of bounds!</em> error.
However, when I use <code>background(img);</code> in the <code>void draw()</code> , it works.</p>

<pre><code>PImage sourceImg;
int dw, dh;

void setup () {
  sourceImg = loadImage("test2.jpg");
  surface.setResizable(true);
  dw = sourceImg.width;
  dh = sourceImg.height;
  surface.setSize(dw, dh);
  background(sourceImg); //HERE IT GIVES ME THE ERROR
}

void draw() {
  //background(sourceImg); //HERE IT WORKS
}
</code></pre>

<p>I don't know how to fix this. I need the background image to be drawn one time at the start of the program. What does that error mean?</p>

<p>Thx in advance!</p>
]]></description>
   </item>
   <item>
      <title>How to set processing to automatically detect an image size and set it as a background?</title>
      <link>https://forum.processing.org/two/discussion/18033/how-to-set-processing-to-automatically-detect-an-image-size-and-set-it-as-a-background</link>
      <pubDate>Thu, 01 Sep 2016 14:42:54 +0000</pubDate>
      <dc:creator>testnia</dc:creator>
      <guid isPermaLink="false">18033@/two/discussions</guid>
      <description><![CDATA[<p>From my understanding, setting a background image in processing requires the size of the window to match the dimension of the image.</p>

<pre><code>PImage img = loadImage("background.jpg"); //a 100x100 background image.
size(100,100);
background(img);
</code></pre>

<p>However, since size() does not take in variables, how are we suppose to define a background with variable dimensions?</p>

<p>I have tested with the surface.setSize() function but it does not see to work.</p>

<p>Example:</p>

<pre><code>PImage img = loadImage("background.jpg"); //a 100x100 background image.
surface.setSize(img.width,img.height);
background(img);
</code></pre>
]]></description>
   </item>
   <item>
      <title>Processing doesn't let me use the size of the image for the size of the window</title>
      <link>https://forum.processing.org/two/discussion/17551/processing-doesn-t-let-me-use-the-size-of-the-image-for-the-size-of-the-window</link>
      <pubDate>Sat, 16 Jul 2016 17:01:57 +0000</pubDate>
      <dc:creator>cadavara</dc:creator>
      <guid isPermaLink="false">17551@/two/discussions</guid>
      <description><![CDATA[<p>I got the following code from a tutorial. I checked it with the reference and it should work.</p>

<p>The error I get is: "The size of this sketch could not be determined from your code. Use only numbers (not variables) for the size() command. Read the size() reference for more details.".</p>

<p><code>void setup(){
  PImage img = loadImage("image.jpg"); 
  size(img.width*2, img.height, P2D); 
  }</code></p>
]]></description>
   </item>
   <item>
      <title>How to open a second window?</title>
      <link>https://forum.processing.org/two/discussion/16965/how-to-open-a-second-window</link>
      <pubDate>Fri, 03 Jun 2016 03:24:59 +0000</pubDate>
      <dc:creator>wsl1998</dc:creator>
      <guid isPermaLink="false">16965@/two/discussions</guid>
      <description><![CDATA[<p>I'm working on a project and I need to create a second window. Does anyone know how this can be done?</p>
]]></description>
   </item>
   <item>
      <title>Eclipse is Only Giving Small Window</title>
      <link>https://forum.processing.org/two/discussion/16991/eclipse-is-only-giving-small-window</link>
      <pubDate>Sat, 04 Jun 2016 18:26:13 +0000</pubDate>
      <dc:creator>Synan</dc:creator>
      <guid isPermaLink="false">16991@/two/discussions</guid>
      <description><![CDATA[<p>Hello. I'm trying to use the Processing Library in my Eclipse project, but it's only showing a small window. When I run the same code in the Processing 3 IDE, it shows the whole window. The only difference is that I have this in eclipse before the setup and draw:
public void setings(){
    size(1920, 1080, "processing.opengl.PGraphics3D");
}</p>

<p>instead of the same thing in the Startup of Processing. I can't find anyone else with this problem, though. And no matter how I change the size setting it doesn't effect the resulting window.</p>

<p>I can see the top left corner of what I'm trying to draw if that helps.
Thank you</p>
]]></description>
   </item>
   <item>
      <title>null pointer exception when loading image in settings P3.1.1</title>
      <link>https://forum.processing.org/two/discussion/16705/null-pointer-exception-when-loading-image-in-settings-p3-1-1</link>
      <pubDate>Thu, 19 May 2016 17:22:47 +0000</pubDate>
      <dc:creator>x13420x</dc:creator>
      <guid isPermaLink="false">16705@/two/discussions</guid>
      <description><![CDATA[<pre><code>PImage canvas;PImage paint;
void settings(){
selectInput("Please select canvas:", "selectImage");
interrupt();
println("dog",input,"dog");
canvas = loadImage(input);
size(canvas.width, canvas.height);
noSmooth();} 
</code></pre>

<p>Posted this as a bug they are saying that I am doing it wrong.....but works fine in 3.1
<a href="https://github.com/processing/processing-docs/issues/436" target="_blank" rel="nofollow">https://github.com/processing/processing-docs/issues/436</a></p>

<p>If there a better way of doing this???image is loaded....github seems  very chaotic...like fixing one thing often messes up other stuff.</p>
]]></description>
   </item>
   </channel>
</rss>