Ohh you just want a simple way to interact with a parameter in your sketch.
Check out some of the Interaction examples that show how to modify your sketch dynamically based on user input from the mouse.
Also there's an easy to use GUI toolkit called Interfascia (there are probably many more) for processing that lets you use textfield's that you can have interact with your sketch.
http://superstable.net/interfascia/download.htm
Here's an example that lets you type in the radius of a circle that will be drawn:
http://ddaniels.net/ddanielsblog/processing/GUISketch/
Code:
import interfascia.*;
GUIController c;
IFTextField radiusTxt;
IFLabel label1;
float radius = 30;
DecimalFormat format;
void setup() {
size(400, 400);
background(200);
c = new GUIController(this);
label1 = new IFLabel("radius = ", 25, 1);
radiusTxt = new IFTextField("radius", 75, 1, 50, radius+"");
radiusTxt.addActionListener(this);
c.add(label1);
c.add(radiusTxt);
format = new DecimalFormat();
format.setMaximumFractionDigits(2);
}
void draw() {
background(200);
if(radius>0) {
ellipse(width/2, height/2, radius, radius);
}
}
void actionPerformed(GUIEvent e) {
float temp;
if (e.getMessage().equals("Modified")) {
if (e.getSource() == radiusTxt) {
try {
radius = Float.parseFloat(radiusTxt.getValue());
} catch (Exception e2) { }
}
}
}