We are about to switch to a new forum software. Until then we have removed the registration on this forum.
For convenience, I am trying to use G4P Library as my GUI. This is my first code,
package A_FirstTest;
import processing.core.*;
import g4p_controls.*;
public class MainGUI extends PApplet{
public void textfield1_change1(GTextField source, GEvent event) { //_CODE_:FirstGUI:466842:
System.out.println("clicked!");
}
public void button1_click1(GButton source, GEvent event) { //_CODE_:buttonLeft:371424:
System.out.println("clicked!");
FirstGUI.setText("YEAH");
}
public void createGUI(){
G4P.messagesEnabled(false);
G4P.setGlobalColorScheme(GCScheme.BLUE_SCHEME);
G4P.setCursor(ARROW);
surface.setTitle("Sketch Window"); //ERROR HERE!
FirstGUI = new GTextField(this, 60, 30, 230, 20, G4P.SCROLLBARS_NONE);
FirstGUI.setText("FirstGUI");
FirstGUI.setLocalColorScheme(GCScheme.PURPLE_SCHEME);
FirstGUI.setOpaque(true);
FirstGUI.addEventHandler(this, "textfield1_change1");
buttonLeft = new GButton(this, 60, 70, 80, 30);
buttonLeft.setText("Left_Button");
buttonLeft.addEventHandler(this, "button1_click1");
}
// Variable declarations
GTextField FirstGUI;
GButton buttonLeft;
}
I've got an error in surface.setTitle("Sketch Window"); Any solutions?
Answers
What does the error say?
You are trying to transfer a sketch created in Processing with G4P and the GUI Builder tool to Eclipse. The GUI Builder tool creates a separate tab called gui for the code it generates.
Processing will combine all the PDE tabs into one class when the sketch is executed so you have to do the same in Eclipse.
Obviously I don't have your main sketch code but I have modified what you have posted to work in Eclipse.