<?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 showinputdialog() - Processing 2.x and 3.x Forum</title>
      <link>https://forum.processing.org/two/discussions/tagged/feed.rss?Tag=showinputdialog%28%29</link>
      <pubDate>Sun, 08 Aug 2021 18:50:56 +0000</pubDate>
         <description>Tagged with showinputdialog() - Processing 2.x and 3.x Forum</description>
   <language>en-CA</language>
   <atom:link href="/two/discussions/taggedshowinputdialog%28%29/feed.rss" rel="self" type="application/rss+xml" />
   <item>
      <title>How to use input with (python) processing running on a mac ?</title>
      <link>https://forum.processing.org/two/discussion/23646/how-to-use-input-with-python-processing-running-on-a-mac</link>
      <pubDate>Mon, 31 Jul 2017 07:40:55 +0000</pubDate>
      <dc:creator>bcastagnetto</dc:creator>
      <guid isPermaLink="false">23646@/two/discussions</guid>
      <description><![CDATA[<p>Hi,</p>

<p>I just downloaded processing and installed python mode. I am running processing 3.3.5 on a Macbook Air (OS Sierra 10.13.6).</p>

<p>I'm trying to run a very basic code :</p>

<pre><code>a=input()
print(a)
</code></pre>

<p>But it won't work I got the error:</p>

<pre><code> processing.app.SketchException: EOFError: raw_input()
    at jycessing.mode.run.SketchRunner.convertPythonSketchError(SketchRunner.java:248)
    at jycessing.mode.run.SketchRunner.access$4(SketchRunner.java:227)
    at jycessing.mode.run.SketchRunner$3.run(SketchRunner.java:122)
    at java.lang.Thread.run(Thread.java:748)
</code></pre>

<p>What should I do please ?</p>
]]></description>
   </item>
   <item>
      <title>how to set location of popup window ?</title>
      <link>https://forum.processing.org/two/discussion/27060/how-to-set-location-of-popup-window</link>
      <pubDate>Fri, 23 Mar 2018 06:59:09 +0000</pubDate>
      <dc:creator>venitable</dc:creator>
      <guid isPermaLink="false">27060@/two/discussions</guid>
      <description><![CDATA[<p>processing 3.3.5</p>

<pre><code>import static javax.swing.JOptionPane.*;          
void draw() {
          final String id = showInputDialog("Please enter new ID");
          if (id == null)   exit();
          else if ("".equals(id)){
            showMessageDialog(null, "Empty ID Input!!!", 
            "Error", ERROR_MESSAGE);
         }
  }
</code></pre>
]]></description>
   </item>
   <item>
      <title>gctrl.pde doesn't work in Mac</title>
      <link>https://forum.processing.org/two/discussion/26543/gctrl-pde-doesn-t-work-in-mac</link>
      <pubDate>Mon, 26 Feb 2018 18:27:48 +0000</pubDate>
      <dc:creator>WATERBRAIN</dc:creator>
      <guid isPermaLink="false">26543@/two/discussions</guid>
      <description><![CDATA[<p>Hello:</p>

<p>I just installed processing on my Mac High Sierra version 10.13.3 and when try to run gctrl.pde does not work.
When executing</p>

<pre><code>String result = (String) JOptionPane.showInputDialog (this,
  "Select the serial port that corresponds to your Arduino board.",
  "Select serial port",
  JOptionPane.PLAIN_MESSAGE,
  null,
  Serial.list (),
  0);
</code></pre>

<p>gives problems in the showInputDialog function.</p>

<p>Someone could help me?</p>
]]></description>
   </item>
   <item>
      <title>How to let the user select COM (serial) port within a sketch?</title>
      <link>https://forum.processing.org/two/discussion/7140/how-to-let-the-user-select-com-serial-port-within-a-sketch</link>
      <pubDate>Thu, 11 Sep 2014 23:12:21 +0000</pubDate>
      <dc:creator>Geophyr</dc:creator>
      <guid isPermaLink="false">7140@/two/discussions</guid>
      <description><![CDATA[<p>Hi,</p>

<p>I have a relatively simple Processing sketch which connects to an external hardware sensor via Bluetooth (serial port) and visualizes the data. The sketch works acceptably on my computer, but since the COM (serial) port is hard-coded within the sketch, I need to recompile the sketch for every different computer on which I use the program.</p>

<p>To improve the portability of my Processing sketch across different computers/configurations, I would like to be able to let the user select the COM (serial) port within the sketch or "void setup()" routine.</p>

<p>Conceptually:
void setup()
{
// List all the available serial ports:
println(Serial.list());
println("Enter serial port number: ");</p>

<p>// Wait for the user to input a serial port number
// (not sure how to get user input within the setup() routine, though)
// user_serial_port = ???</p>

<p>// Open the port that the user selected using the default rate:
myPort = new Serial(this, Serial.list()[user_serial_port], 57600);
}</p>

<p>I have looked in the forum for some examples of user-selectable COM ports, but it seems like almost everyone is hard-coding the COM port number in their sketch. Thank you in advance for some help/guidance with this request.</p>

<p>Regards,</p>

<p>Geoffrey</p>
]]></description>
   </item>
   <item>
      <title>please help (seven judges)</title>
      <link>https://forum.processing.org/two/discussion/25557/please-help-seven-judges</link>
      <pubDate>Wed, 13 Dec 2017 22:43:12 +0000</pubDate>
      <dc:creator>devon_terry</dc:creator>
      <guid isPermaLink="false">25557@/two/discussions</guid>
      <description><![CDATA[<p>A sketch that will obtain seven judges' scores where each score must be between 1 and 10 inclusively. Your program will calculate and output the average of the five middle scores (in other words, throw out the highest and the lowest score before finding the average). This is what I want to do and I can do everything but figure out how to exclude the max and min scores from my average calculation.</p>
]]></description>
   </item>
   <item>
      <title>Accepting user input for visual assignment</title>
      <link>https://forum.processing.org/two/discussion/25246/accepting-user-input-for-visual-assignment</link>
      <pubDate>Tue, 28 Nov 2017 09:54:09 +0000</pubDate>
      <dc:creator>Romak1997</dc:creator>
      <guid isPermaLink="false">25246@/two/discussions</guid>
      <description><![CDATA[<p>first post here so bear with me :P</p>

<p>Now I'm not a programmer by trade, but my university offers a programming unit related to digital arts using processing.  An assignment I'm working on requires the user to input an integer value which is then used to create a range for randomization.  Ideally the output should look like a bunch of random high-rises, creating a city skyline (abstract art don't question it) with 5 "high-rises".  However, only one is appearing and the GUI appears again.  Any help would be much appreciated as I'm at wits end with my deadline approaching fast :|</p>

<p>import static javax.swing.JOptionPane.*; //GUI element class</p>

<p>void setup() {  //setup canvas
  size(1250,750); //sets size of canvas</p>

<p>frameRate(10);</p>

<p>}</p>

<p>void draw(){</p>

<pre><code>    String input = showInputDialog("Type in integer number...");
    int num = parseInt(input == null? "" : input, MIN_INT);

    if (input == null)  showMessageDialog(null, "You didn't enter anything!", "Alert", ERROR_MESSAGE);
    else if (num == MIN_INT)  showMessageDialog(null, "Entry \"" + input + "\" isn't a number!", "Alert", ERROR_MESSAGE);
    else showMessageDialog(null, "Number " + num + " has been registered.", "Info", INFORMATION_MESSAGE);



for(int i = 0 ; i &lt; 5 ; i++) {




  background(random(125,175),random(125,175),random(125,175));  //sets colour of canvas, ideally in rgb

  fill (random (150,255));

  float X = random(num,num+400);
  float Y = random(num,num+450);

  rect(X,Y,150,750);

}
</code></pre>
]]></description>
   </item>
   <item>
      <title>Why can't I get the option pane to show.</title>
      <link>https://forum.processing.org/two/discussion/24430/why-can-t-i-get-the-option-pane-to-show</link>
      <pubDate>Sat, 07 Oct 2017 12:29:01 +0000</pubDate>
      <dc:creator>stumped1</dc:creator>
      <guid isPermaLink="false">24430@/two/discussions</guid>
      <description><![CDATA[<p>A newby and my first time using Processing and I can't see how I can resolve this. I'm trying to set up a CNC drawing setup in arduino uno and the Processing option pane is not displaying correctly. I've attached a screenshot and it appears a fault is shown at line 31. 
Would greatly appreciate any help<img src="https://forum.processing.org/two/uploads/imageupload/412/C67EN4DZYET8.png" alt="Screenshot (5)" title="Screenshot (5)" /></p>
]]></description>
   </item>
   <item>
      <title>How to add character from JOptionPane to an array and prevent duplicate entries</title>
      <link>https://forum.processing.org/two/discussion/21753/how-to-add-character-from-joptionpane-to-an-array-and-prevent-duplicate-entries</link>
      <pubDate>Sun, 02 Apr 2017 01:04:39 +0000</pubDate>
      <dc:creator>dewwolf</dc:creator>
      <guid isPermaLink="false">21753@/two/discussions</guid>
      <description><![CDATA[<p>How would I go about adding letters placed inside the pane to an array so that it saves for printing? (pseudocode)</p>

<p><code>String x; 
  x= JOptionPane.showInputDialog(null, "letter entry"); 
  char y= x.charAt(0);</code></p>

<p>So it takes x and turns it to a char, but how would I add the letters inputted into an array? It takes one letter at a time, so new letters would be added as each input is accepted.</p>

<p>Also, how would I be able to prevent duplicates in this? Say the user entered "a" and tried to enter "a" again, it would create an error dialogue and ask for a different letter. Thanks in advance :)</p>
]]></description>
   </item>
   <item>
      <title>How would one go about restricting input in JOptionPane?</title>
      <link>https://forum.processing.org/two/discussion/21613/how-would-one-go-about-restricting-input-in-joptionpane</link>
      <pubDate>Sun, 26 Mar 2017 05:05:21 +0000</pubDate>
      <dc:creator>dewwolf</dc:creator>
      <guid isPermaLink="false">21613@/two/discussions</guid>
      <description><![CDATA[<p>I was wondering how I could make it so that JOptionPane uses only the first character inputted, even if multiple were used.
Eg.: if user inputs "Christmas", only the letter "C" is actually inputted and the rest is not counted. Thanks!</p>
]]></description>
   </item>
   <item>
      <title>Prompting the user to input numbers</title>
      <link>https://forum.processing.org/two/discussion/21076/prompting-the-user-to-input-numbers</link>
      <pubDate>Wed, 01 Mar 2017 11:27:45 +0000</pubDate>
      <dc:creator>Yami89</dc:creator>
      <guid isPermaLink="false">21076@/two/discussions</guid>
      <description><![CDATA[<p>Hi, I've written simple code to move an ellipse around the screen. I would like include a small function where it asks for a specific coordinate for X and Y from the user if need be. 
I have done some research on the internet and couldn't find a simple of way of doing it. What I had in my mind was to have a small area in the corner of the screen to input the X and Y coordinate, and also if there was a way of display the current X and Y positions.
Thanks</p>
]]></description>
   </item>
   <item>
      <title>Quadratic Equation Graph</title>
      <link>https://forum.processing.org/two/discussion/19780/quadratic-equation-graph</link>
      <pubDate>Fri, 16 Dec 2016 14:20:56 +0000</pubDate>
      <dc:creator>TudorBrown12</dc:creator>
      <guid isPermaLink="false">19780@/two/discussions</guid>
      <description><![CDATA[<p>The equation is not graphing properly, how do I fix it?
I am trying to make a program that accepts a quadratic equation from a user, solves the equation and also graphs the equation. I am pretty new to Processing so if I made any obvious mistakes, please help me to point it out. I adapted the code from the graph from the grafica library but I can't seem to implement it properly. 
Here is my code:</p>

<pre><code>import javax.swing.JOptionPane;
import grafica.*; 
GPlot plot1;
String input;


void setup(){
  size(500, 500);
  background(255);

  float[] firstPlotPos = new float[] {0, 0};
  float[] panelDim = new float[] {200, 200};
  float[] margins = new float[] {60, 70, 40, 30};

  GPlot plot1 = new GPlot(this);
  plot1.setPos(firstPlotPos);
  plot1.setMar(0, margins[1], margins[2], 0);
  plot1.setDim(panelDim);
  plot1.setAxesOffset(0);
  plot1.setTicksLength(-4);
  plot1.getXAxis().setDrawTickLabels(false);

  String num = JOptionPane.showInputDialog(null,"Enter the coefficient of x²: ", "Text input", JOptionPane.QUESTION_MESSAGE);
  int num1=Integer.parseInt(num);
  String num4 = JOptionPane.showInputDialog(null,"Enter the coefficient of x: ", "Text input", JOptionPane.QUESTION_MESSAGE);
  int num2=Integer.parseInt(num4);
  String num5 = JOptionPane.showInputDialog(null,"Enter the constant: ", "Text input", JOptionPane.QUESTION_MESSAGE);
  int num3=Integer.parseInt(num5);

  println(quadratic(num1, num2, num3));
  println(quadratic1(num1, num2, num3));

   int nPoints = 21; 
  GPointsArray points1 = new GPointsArray(nPoints);

  for (int i = 0; i &lt; nPoints; i++) {
    points1.add(i,(num1*((i)*(i))+(num2*(i))+num3));
    }


 plot1.setPoints(points1);
  plot1.setTitleText("Quadratic equation graph");
  plot1.getTitle().setRelativePos(1);
  plot1.getTitle().setTextAlignment(CENTER);
  plot1.getYAxis().setAxisLabelText("Y Axis");

  plot1.beginDraw();
  plot1.drawBox();
  plot1.drawXAxis();
  plot1.drawYAxis();
  plot1.drawTopAxis();
  plot1.drawRightAxis();
  plot1.drawTitle();
  plot1.drawPoints();
  plot1.drawLines();
  plot1.endDraw();
}

float quadratic(float a, float b, float c){
  return (-b + sqrt( b*b - 4*a*c)) / (2*a);
  }
  float quadratic1(float d, float e, float f){
  return (-e - sqrt( e*e - 4*d*f)) / (2*d);
  }
</code></pre>
]]></description>
   </item>
   <item>
      <title>Fibonacci sequence code.  something little wrong somewhere but not sure how to fix it.</title>
      <link>https://forum.processing.org/two/discussion/18644/fibonacci-sequence-code-something-little-wrong-somewhere-but-not-sure-how-to-fix-it</link>
      <pubDate>Thu, 20 Oct 2016 20:47:56 +0000</pubDate>
      <dc:creator>ENGG233</dc:creator>
      <guid isPermaLink="false">18644@/two/discussions</guid>
      <description><![CDATA[<p>So I need to write a code for a user to enter a number equal or greater than 3.  Then the output should be the fibonacci sequence up until that number entered.  For example, if a user enters 9, then the output should be 1,1,2,3,5,8. My problem is that it's showing a few extra terms and anything I try messes it up more. please help I would very much appreciate it.  I'm very new to processing.
Here's the code I have so far:</p>

<p>import javax.swing.JOptionPane;</p>
]]></description>
   </item>
   <item>
      <title>How can I hide characteres that are typed in showInputDialog</title>
      <link>https://forum.processing.org/two/discussion/16072/how-can-i-hide-characteres-that-are-typed-in-showinputdialog</link>
      <pubDate>Mon, 18 Apr 2016 00:33:07 +0000</pubDate>
      <dc:creator>magc</dc:creator>
      <guid isPermaLink="false">16072@/two/discussions</guid>
      <description><![CDATA[<p>Hello!!! I have been trying to hide the characters that are typed in a showInputDialog but I have not been able to do it!! when any character is introduce I want to show * I need help please!!</p>
]]></description>
   </item>
   <item>
      <title>Exported application fails. need to code signing? How to sign?</title>
      <link>https://forum.processing.org/two/discussion/15953/exported-application-fails-need-to-code-signing-how-to-sign</link>
      <pubDate>Sun, 10 Apr 2016 20:14:12 +0000</pubDate>
      <dc:creator>Per</dc:creator>
      <guid isPermaLink="false">15953@/two/discussions</guid>
      <description><![CDATA[<p>Hi!</p>

<p>I exported an application. I opens fine on my computer using mac 10.9 which I used for the export. but when open it on another mac with 10.7 it doesnt work. First I thought it was because of old operating system so I tried to export it with processing 2 instead of 3 but with the same result.</p>

<p>I looked in the system logs and it says permission denied error. I guess its because the application is not signed (?) and the apple Gatekeeper system prevent it from open.</p>

<p>How can I sign my exported application? Any help would be very much appreciated!</p>

<p>thanks</p>
]]></description>
   </item>
   <item>
      <title>Trying to increase health bar when particle system drops hits the PImage. Not sure how to do it :/</title>
      <link>https://forum.processing.org/two/discussion/15825/trying-to-increase-health-bar-when-particle-system-drops-hits-the-pimage-not-sure-how-to-do-it</link>
      <pubDate>Sun, 03 Apr 2016 18:08:19 +0000</pubDate>
      <dc:creator>AmyM</dc:creator>
      <guid isPermaLink="false">15825@/two/discussions</guid>
      <description><![CDATA[<p>The piece of code I am trying to get working is commented out in draw().</p>

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

import cc.arduino.*;

import static javax.swing.JOptionPane.*;
import javax.swing.JPasswordField;


final StringDict accounts = new StringDict(
  new String[] {
  "john", "tony", "amy"
  }
  , new String[] {
    "ilikedogs", "husky", "pepsi"
  }
  );

final JPasswordField pwd = new JPasswordField();

{
  println(accounts);
} 

PImage startGameBackground;
PImage kitchen;
PImage dog;
float dogx=800, dogy=600;
HealthBar hb0 = new HealthBar();
boolean isWashed=false;

PImage achievment2;

int stage =1;
Serial port;

Fountain f = new Fountain();
//Ball b = new Ball(x,y,d,xs,ys);
ArrayList&lt;Ball&gt;ballList;

void setup() {
  size(1800, 900);
  String comPort = "COM3";

  stage =1;
  port = new Serial(this, comPort, 9600);

  f.fountainSetup(); 
  startGameBackground = loadImage("startGameBackground.png");
  kitchen = loadImage("kitchen.png");
  dog = loadImage("washDog.png");
  startGameBackground.resize(1800, 900);
  kitchen.resize(1800, 900);
  achievment2 = loadImage("achievment2.png");
}

void draw() {

  if (stage ==1) {

    background(startGameBackground);

    if (frameCount == 10)  surface.setVisible(true);


    String user = askUser();

    if (user == null)           confirmQuit();
    else if (!"".equals(user))  askPass(user);

  } else if (stage ==2) {

    background(kitchen);
    image(dog, dogx, dogy);
    hb0.draw();
    isWashed =true;

    f.fountainDraw();

    //if (hb0.value &lt;100) {
    //   //delay(1000);
    //   hb0.value += .5;
    // }

    // else if(hb0.value == hb0.max){
    //   println("Here is the achievment"); 
    //   image(achievment2, 500,100);
  }
}
}

String askUser() {
  String id = showInputDialog("Please enter user:");

  if (id == null)
    showMessageDialog(null, "You've canceled login operation!"
      , "Alert", ERROR_MESSAGE);

  else if ("".equals(id))
    showMessageDialog(null, "Empty user input!"
      , "Alert", ERROR_MESSAGE);

  else if (!accounts.hasKey(id = id.toLowerCase()))
    showMessageDialog(null, "Unknown \"" + id + "\" user!" + (id = "")
      , "Alert", ERROR_MESSAGE);

  return id;
}

boolean askPass(String id) {
  boolean isLogged = false;
  pwd.setText("");

  int action = showConfirmDialog(null, pwd
    , "Now enter password:", OK_CANCEL_OPTION);

  if (action != OK_OPTION) {
    showMessageDialog(null, "Password input canceled!"
      , "Alert", ERROR_MESSAGE);

    return false;
  }

  String phrase = pwd.getText();
  //String phrase = new String(pwd.getPassword());

  if ("".equals(phrase))
    showMessageDialog(null, "Empty password input!"
      , "Alert", ERROR_MESSAGE);

  else if (accounts.get(id).equals(phrase)) {
    showMessageDialog(null, "Welcome \"" + id + "\"!\nYou're logged in!"
      , "Info", INFORMATION_MESSAGE);

    isLogged = true;
    stage=2;
  } else
    showMessageDialog(null, "Password \"" + phrase + "\" mismatch!"
      , "Alert", ERROR_MESSAGE);

  return isLogged;
}

void confirmQuit() {
  if (showConfirmDialog(null, "Wanna quit then?", "Exit"
    , OK_CANCEL_OPTION) == OK_OPTION)  exit();
}


public class Ball {

  float x, y, xSpeed, ySpeed, diameter;
  int dropColour;
  boolean isAlive;
  int stepsAlive;
  HealthBar hb0 = new HealthBar();

  public Ball(float x, float y, float d, float xs, float ys) {
    this.x=x;
    this.y =y;
    this.diameter =d;
    xSpeed =xs;
    ySpeed =ys;
    isAlive = true;
    int stepsAlive =0 ;
  }

  public void move() {
    stepsAlive++;
    x = x + xSpeed;
    y = y + ySpeed;

    if (x &gt;=800) {

      xSpeed = -xSpeed;
    }

    if (x &lt;=950) {

      xSpeed = -xSpeed;
    }

    ySpeed = ySpeed +0.1F;

    if (y  &gt; 800) {
      ySpeed = -ySpeed;
    }
  }

  public void isDead() {

    if (stepsAlive &gt;= 400) {
      isAlive = false;
    }

    if (dist(x, y, dogx, dogy) &lt;100  ) {

      isAlive = false;
    }

    if (y  &gt; 800) {
      isAlive =false;
    }
  }
}


import ddf.minim.*;

public class Fountain {
  ArrayList&lt;Ball&gt; ballList;
  AudioPlayer player;
  Minim minim;
  HealthBar hb0 = new HealthBar();

  void fountainSetup() {
    //size(600,600); 
    ballList = new ArrayList&lt;Ball&gt;();
    //minim = new Minim(this);
  }

  public void fountainDraw() {
    //background(255,255,255);

    // if (mousePressed){
    if (mousePressed ==true) {
      float xSpeed = (float)(-3 + Math.random()*6);
      Ball b = new Ball(880, 400, 20, xSpeed, -2); 

      b.dropColour = color(204, 255, 255);

      ballList.add(b);
    }

    for (int i =0; i &lt;ballList.size(); i++) {
      Ball b2 = ballList.get(i);

      fill(b2.dropColour);
      ellipse(b2.x, b2.y, b2.diameter, b2.diameter);
      b2.move();
      //println("working");

      b2.isDead();

      if (b2.isAlive == false)
        ballList.remove(b2);

          println(dogy + ""+ "This thing is broke");
        }
      }
    }

class HealthBar {
  float value, max, x, y, w, h;
  color backing, bar;
  HealthBar(){
    value = 0;
    max = 100;
    x = 800;
    y = 60;
    w = 200;
    h = 30;
    backing = color(255,0,0);
    bar = color(0,255,0);
  }
  void draw(){
    fill(backing);
    stroke(0);
    rect(x,y,w,h);
    fill(bar);
    rect(x,y,map(value,0,max,0,w),h);
  }
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>reading and writing to a file to make a user</title>
      <link>https://forum.processing.org/two/discussion/15769/reading-and-writing-to-a-file-to-make-a-user</link>
      <pubDate>Wed, 30 Mar 2016 16:07:36 +0000</pubDate>
      <dc:creator>AmyM</dc:creator>
      <guid isPermaLink="false">15769@/two/discussions</guid>
      <description><![CDATA[<p>Hi guys.
So far I have a log in that only allows users from the actual code. I would like to change it to be reading and writing to a file? have you guys any advice how id do this?</p>

<pre><code>import static javax.swing.JOptionPane.*;
import javax.swing.JPasswordField;

final StringDict accounts = new StringDict(
  new String[] {
  "baptiste", "tanguy", "alexis"
  }
  , new String[] {
    "bap", "guy", "ex"
  }
  );

final JPasswordField pwd = new JPasswordField();

{
  println(accounts);
}

void draw() {
  if (frameCount == 1)  frame.setVisible(false);

  String user = askUser();

  if (user == null)           confirmQuit();
  else if (!"".equals(user))  askPass(user);
}

String askUser() {
  String id = showInputDialog("Please enter user:");

  if (id == null)
    showMessageDialog(null, "You've canceled login operation!"
      , "Alert", ERROR_MESSAGE);

  else if ("".equals(id))
    showMessageDialog(null, "Empty user input!"
      , "Alert", ERROR_MESSAGE);

  else if (!accounts.hasKey(id = id.toLowerCase()))
    showMessageDialog(null, "Unknown \"" + id + "\" user!" + (id = "")
      , "Alert", ERROR_MESSAGE);

  return id;
}

boolean askPass(String id) {
  boolean isLogged = false;
  pwd.setText("");

  int action = showConfirmDialog(null, pwd
    , "Now enter password:", OK_CANCEL_OPTION);

  if (action != OK_OPTION) {
    showMessageDialog(null, "Password input canceled!"
      , "Alert", ERROR_MESSAGE);

    return false;
  }

  String phrase = pwd.getText();
  //String phrase = new String(pwd.getPassword());

  if ("".equals(phrase))
    showMessageDialog(null, "Empty password input!"
      , "Alert", ERROR_MESSAGE);

  else if (accounts.get(id).equals(phrase)) {
    showMessageDialog(null, "Welcome \"" + id + "\"!\nYou're logged in!"
      , "Info", INFORMATION_MESSAGE);

    isLogged = true;
  } else
    showMessageDialog(null, "Password \"" + phrase + "\" mismatch!"
      , "Alert", ERROR_MESSAGE);

  return isLogged;
}

void confirmQuit() {
  if (showConfirmDialog(null, "Wanna quit then?", "Exit"
    , OK_CANCEL_OPTION) == OK_OPTION)  exit();
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>Petit problème .</title>
      <link>https://forum.processing.org/two/discussion/15439/petit-probleme</link>
      <pubDate>Fri, 11 Mar 2016 18:50:53 +0000</pubDate>
      <dc:creator>Grool</dc:creator>
      <guid isPermaLink="false">15439@/two/discussions</guid>
      <description><![CDATA[<p>Bonjour, j'ai un problème, j'aimerais mettre en relation la réponse d'un Dialog car pour un jeu, selon la reponse, la vitesse de mon objet changerait. J'ai besoin de cette aide pour avancer dans mon programme que je souhaiterais présenter pour le BAC. Merci</p>
]]></description>
   </item>
   <item>
      <title>upload image knob!!</title>
      <link>https://forum.processing.org/two/discussion/15390/upload-image-knob</link>
      <pubDate>Wed, 09 Mar 2016 22:35:56 +0000</pubDate>
      <dc:creator>agustinr</dc:creator>
      <guid isPermaLink="false">15390@/two/discussions</guid>
      <description><![CDATA[<p>Hello! I presented a doubt in the CP5 library! I need it to load an image on a knob and me is impossible. I am a beginner in processing and I can not solve it! This is for a project and appreciate answers! sorry for my bad English . Cheers!</p>
]]></description>
   </item>
   <item>
      <title>Want to write a program that takes a number input from user and prints weather or not it is even</title>
      <link>https://forum.processing.org/two/discussion/14770/want-to-write-a-program-that-takes-a-number-input-from-user-and-prints-weather-or-not-it-is-even</link>
      <pubDate>Fri, 05 Feb 2016 13:51:34 +0000</pubDate>
      <dc:creator>AmazingSuperDry</dc:creator>
      <guid isPermaLink="false">14770@/two/discussions</guid>
      <description><![CDATA[<p>I'm really stuck as to how to collect and assign an input from a user? Very new to programming?</p>
]]></description>
   </item>
   <item>
      <title>Check Array Contents with ArrayList</title>
      <link>https://forum.processing.org/two/discussion/869/check-array-contents-with-arraylist</link>
      <pubDate>Fri, 01 Nov 2013 11:58:55 +0000</pubDate>
      <dc:creator>bourdonprince</dc:creator>
      <guid isPermaLink="false">869@/two/discussions</guid>
      <description><![CDATA[<p>Hi!</p>

<p>I have a string array of user ids, and I would like to add a new id to my arraylist, only when this value is not in the arraylist.</p>

<p>I do the following, but I don't get any results. Can someone recommend something?</p>

<pre><code>String[] usersIDs = {
  "001", "002", "003"
};

ArrayList&lt;String&gt; identifiedUsers = new ArrayList&lt;String&gt;();

void keyReleased() {
  if (key == 'a') {
    for (int y=0; y&lt;usersIDs.length; y++) {
      for (int i=0; i&lt;identifiedUsers.size(); i++) {
        if (identifiedUsers.get(i).equals(usersIDs[y])) {
          println("a");
        } 
        else {
          println("b");
          identifiedUsers.add(usersIDs[0]);
        }
      }
    }
  }
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>Finding the right serial port for Arduino</title>
      <link>https://forum.processing.org/two/discussion/13527/finding-the-right-serial-port-for-arduino</link>
      <pubDate>Sun, 15 Nov 2015 16:38:20 +0000</pubDate>
      <dc:creator>salvatore_94</dc:creator>
      <guid isPermaLink="false">13527@/two/discussions</guid>
      <description><![CDATA[<p>Hi guys,
in my project i have to communicate with arduino by the serial port.
I'm using this code:</p>

<blockquote class="Quote">
  <p>port = new Serial(this, Serial.list()[0], 115200);</p>
</blockquote>

<p>But is there a way to find automatically the right port? because on others computers i have always to change the number of port, like 1 or 2.
Is there a command that can do that?</p>

<p>Thank you</p>
]]></description>
   </item>
   <item>
      <title>Storing Input After Using JPaneOption</title>
      <link>https://forum.processing.org/two/discussion/13492/storing-input-after-using-jpaneoption</link>
      <pubDate>Thu, 12 Nov 2015 01:21:20 +0000</pubDate>
      <dc:creator>collivan0497</dc:creator>
      <guid isPermaLink="false">13492@/two/discussions</guid>
      <description><![CDATA[<p>I was successful in making a dialogue window, and having the pop up window allow users to type in input. However I have 2 problems:
1. I need the input the user have me to be stored in array to use later, but I can't seem to figure that out 
2. The input type is a number and I know that it needs to be converted.</p>

<p>Help!!! (Thanks in advance)</p>
]]></description>
   </item>
   <item>
      <title>PLEASE HELP. New to processing &amp; I am having a very hard time understanding.</title>
      <link>https://forum.processing.org/two/discussion/13287/please-help-new-to-processing-i-am-having-a-very-hard-time-understanding</link>
      <pubDate>Mon, 26 Oct 2015 20:02:05 +0000</pubDate>
      <dc:creator>cgrayyy3</dc:creator>
      <guid isPermaLink="false">13287@/two/discussions</guid>
      <description><![CDATA[<p>The directions are to write a program that...
- Asks a user how many class grades will be entered
Use a while statement to loop for the number of grades to be received by the user. In the loop...
-Ask a user for a letter grade
-Ask the user whether the grade is from a class that is an AP class (char Y or N?)
In the program write a function that receives the letter grade from a non-AP Class and returns the value of the quality point for the letter grade to the main program</p>

<p>Also, write a function that receives the letter grade but figures the quality point for the AP class grade, and returns that value to the main program.
Call the appropriate function defined above based on the user input of the class being AP or non-AP.</p>

<p>When it returns to the main program,
- print the quality point
- accumulate (sum) the quality points that are returned each time</p>

<p>When the loop is completed (counter&gt;the number of grades to be entered)
Calculate the GPA
Print the GPA.</p>

<p>Help is very appreciated..</p>
]]></description>
   </item>
   <item>
      <title>Help! Help! Please. mouseClicked</title>
      <link>https://forum.processing.org/two/discussion/13008/help-help-please-mouseclicked</link>
      <pubDate>Wed, 14 Oct 2015 12:42:30 +0000</pubDate>
      <dc:creator>Methew</dc:creator>
      <guid isPermaLink="false">13008@/two/discussions</guid>
      <description><![CDATA[<p>Hi,</p>

<p>I am looking for someone who can help me with a problem. Its a beginner problem, but I am learning.</p>

<p>I want to make a menuscreen before the game will start. So first you need to put your name on it and then you ll begin. but my problem is, that I can't select on a textbox for putting a name.</p>

<p>// huidige naam die je typt
String naamSpeler1="";
String naamSpeler2="";
String savedPlayer1;
String savedPlayer2;</p>

<p>void setup() {
  size(444, 444);
  background(51);
}</p>

<p>void draw () {
  background(111);</p>

<p>// Tekst boven
  fill(0, 255, 163); // groen
  text("SPELER 1", 20, 60);
  text("SPELER 2", 20, 80);</p>

<p>// naam op vulhokje
  noFill();
  stroke(255);
  rect (10, 115, 170, 20);
  rect (10, 200, 170, 20);
  // text 
  fill(255); // white
  text(naamSpeler1, 20, 129);
  text(naamSpeler2, 20, 216);</p>

<p>//start knop
  noFill();
  rect(305,300,60,20);
  textSize(15);
  text("START",310,315);</p>

<p>} 
void keyPressed () {</p>

<p>if (key == ENTER) {//heeft gekozen voor naam 
    if (!naamSpeler1.equals("")|| !naamSpeler2.equals("")) {
      savedPlayer1 = naamSpeler1;
      naamSpeler1 = "";
      println (savedPlayer1);
      savedPlayer2 = naamSpeler2;
      naamSpeler2 = "";
      println (savedPlayer2);
    }
  }
  //else
  {
    // record the keys (in the current word) 
    naamSpeler1 = naamSpeler1 + (key+"");
    naamSpeler2 = naamSpeler2 + (key+"");</p>

<p>} //else
} // func 
//</p>

<p>its in dutch but you ll understand what I mean, if you run it.</p>
]]></description>
   </item>
   <item>
      <title>In the GOL program by shiffman I want to input values for board in run time instead of a random func</title>
      <link>https://forum.processing.org/two/discussion/12949/in-the-gol-program-by-shiffman-i-want-to-input-values-for-board-in-run-time-instead-of-a-random-func</link>
      <pubDate>Sun, 11 Oct 2015 19:14:52 +0000</pubDate>
      <dc:creator>D_Bharathi_Ganesh</dc:creator>
      <guid isPermaLink="false">12949@/two/discussions</guid>
      <description><![CDATA[<p>While Using the game of life program of the series " nature of code " by daniel shiffman, I  want to fill the board with input values given by me in run time of the program instead of using a random function as it has been done in the GOL program. when I tried getting input for board using normal java method I'm not able to fill the board in run time, so please suggest a solution for my problem.</p>
]]></description>
   </item>
   <item>
      <title>How do I create a code that tracks characters pressed in a given sequence (like a password)?</title>
      <link>https://forum.processing.org/two/discussion/12724/how-do-i-create-a-code-that-tracks-characters-pressed-in-a-given-sequence-like-a-password</link>
      <pubDate>Tue, 29 Sep 2015 10:09:43 +0000</pubDate>
      <dc:creator>iamjforst</dc:creator>
      <guid isPermaLink="false">12724@/two/discussions</guid>
      <description><![CDATA[<p>Hi,</p>

<p>I am working on a project in which nine keys are in play. Each of the keys are connected to a specific sound, which is played when the key is pressed (using minim). But if I want the sketch to be able to track the previously pressed keys to identify if a specific code/password is pressed (keys pressed and released individually but in a specific order), how do I write this?</p>
]]></description>
   </item>
   <item>
      <title>Running exit() from settings() causes NullPointerException</title>
      <link>https://forum.processing.org/two/discussion/12210/running-exit-from-settings-causes-nullpointerexception</link>
      <pubDate>Sat, 22 Aug 2015 21:39:47 +0000</pubDate>
      <dc:creator>ryansheets15</dc:creator>
      <guid isPermaLink="false">12210@/two/discussions</guid>
      <description><![CDATA[<p>Any time I try to call exit() from settings(), it will cause a NullPointerException. It will work fine if I call it from anywhere else. Any idea of why? or how to fix it?</p>
]]></description>
   </item>
   <item>
      <title>Input an integer value</title>
      <link>https://forum.processing.org/two/discussion/9563/input-an-integer-value</link>
      <pubDate>Tue, 24 Feb 2015 16:22:39 +0000</pubDate>
      <dc:creator>xristosk</dc:creator>
      <guid isPermaLink="false">9563@/two/discussions</guid>
      <description><![CDATA[<p>Seems dump but I cannot find a way to input an integer using the keyboard. I tried the following but it doesn't work. 
int a;
if ((keyPressed == true) {
a=key;
}</p>
]]></description>
   </item>
   <item>
      <title>Input not working correctly?</title>
      <link>https://forum.processing.org/two/discussion/7966/input-not-working-correctly</link>
      <pubDate>Tue, 04 Nov 2014 21:08:26 +0000</pubDate>
      <dc:creator>Tormidal</dc:creator>
      <guid isPermaLink="false">7966@/two/discussions</guid>
      <description><![CDATA[<p>Hey guys, im trying to make a program that shoots a projectile at specified angle, but my code draws both the projectile shooting at a pre-determined angle, and asks the user for input at the same time. Im at a loss for what to do here....
I want to get user input for an angle, and then draw the projectile being fired AT the angle the user typed in.</p>

<pre><code>float currT, maxT, xpos, ypos, angle, v, g, deltaT;
String typing = "";
String saved = "";
PFont f;
void setup() {
  background(255);
  size(500,500);
  f = createFont("Arial",16,true);
    // Time starts at 0
    currT = 0;
    // Enter the angle below in degrees(angle)
    angle = 45;
    // Below converts angle from degrees to radians
    angle = (angle) * PI / 180;
    // Enter the velocity below (v)
    v = 75;
    // Gravity is equal to 9.8 m/s (g)
    g = 9.8;
    // How quickly it updates is deltaT (for faster draw times, use a higher number)
    deltaT = .01;
    // This is the max time the animation will run (when ypos is less than or equal to 0)
    maxT = 2*v*sin(angle) / g;
    // This is the position on the x-axis
    xpos = v * currT * cos(angle);
    // This is the position on the y-axis
    ypos = (v * currT * sin(angle)) - .5 * (g * (sq(currT)));
}
void draw() {
  int indent = 25;
  textFont(f);
  fill (0);
  text("Click in the applet and type an angle. \nHit return to save what you typed. ", indent, 40);
  text(typing,indent,90);
  text(saved,indent,130);
  noLoop();
}
void keyPressed() {
  if (key == '\n' ) {
    saved = typing;
    typing = "";
    angle = (Float.valueOf(saved));
    angle = (angle) * PI / 180;
    drawYes();
  } else {
    typing = typing + key;
  }
}
void drawYes() {
    // Advance currT
    currT = currT + deltaT;
    // Test if the simulation should be stopped (if the current time is greater than max time)
    if(currT &gt; maxT) {
      noLoop();
    }
    // Calculate the new x &amp; y position based on currT
    xpos = v * currT * cos(angle);
    ypos = (v * currT * sin(angle)) - 0.5 * (g * (sq(currT)));

    // Draw the current information in the window
    drawPosition();
    // Draw the ellipse in the window
    drawShot();
    loop();
}
void drawPosition() {
  fill(255);
  stroke(255);
  rect(0,0,500,30);
  stroke(0);
  fill(0);
      String text = "time:" + nf(currT, 4, 2) 
                  + " xpos:" + int(xpos) + " ypos:" + int(ypos);
      text(text, 10, 20);
}


void drawShot() {
    ellipse(xpos, 500-ypos, 1, 1);
}
</code></pre>
]]></description>
   </item>
   </channel>
</rss>