I've just found this library, which seems to b exactly what I need - a simple box that cn have text typed into it, then a copy of the string typed saved when the enter key is pressed. This is the example code from the library for a text field which is great, but it didnt seem to work with the sketch I have already so I wanted to test it out my making it print "click' when it was clicked on, but even that's not working...could someone explain to me what the actionPerformed() is triggered by? - the docs. say:
Quote:If it exists, the actionPerfomed() method is called every time a GUI component generates an event. It is passed a GUIEvent as an argument. Events are generated on button click, checkbox state change, radio button state change, and text field focus change.
The event notification is sent to the listener declared in the particular component's addActionListener() method.
Syntax
void actionPerformed (GUIEvent e) {
// Statements here will be executed whenever a GUIEvent is generated
}
..but nothing happens when im clicking.
Quote:import interfascia.*;
GUIController c;
IFTextField t;
IFLabel l;
void setup() {
size(200, 100);
background(150);
c = new GUIController(this);
t = new IFTextField("Text Field", 25, 30, 150);
l = new IFLabel("", 25, 70);
c.add(t);
c.add(l);
t.addActionListener(this);
}
void draw() {
}
void actionPerformed(GUIEvent e) {
println("click");
if (e.getMessage().equals("Completed")) {
l.setLabel(t.getValue());
}
}
Hope that makes some sort of sense! Thanks.