I have made a simple interface using myGUI, which will eventually send data when buttons are clicked.
however i am having some trouble just printing a line when the buttons are clicked. when you click the buttons, a line should print "pressed 1" or "pressed 2". but nothing happens.
Code:
import mkv.MyGUI.*;
MyGUI gui;
MyGUIStyle style1, style2;
MyGUIButton b1, b2;
void setup(){
gui = new MyGUI(this);
MyGUIStyle style1 = new MyGUIStyle(this);
MyGUIStyle style2 = new MyGUIStyle(this);
MyGUIButton b1 = new MyGUIButton(this,20,10,"one",30,10);
MyGUIButton b2 = new MyGUIButton(this,20,30,"two",30,10);
style1.background = color(0,0,0);
style1.buttonFace = color(255,255,255);
style1.buttonHighlight = color(33,66,99);
style2.background = color(66,66,66);
style2.buttonFace = color(188,188,188);
style2.buttonHighlight = color(99,66,33);
b1.setStyle(style1);
b2.setStyle(style2);
gui.add(b1);
gui.add(b2);
}
void draw(){
}
void actionPerformed(ActionEvent e) {
if(e.getSource() == b1) {
println("PRESSED 1");
}
else if(e.getSource() == b2) {
println("PRESSED 2 ");
}
}