I am attempting to re create a simple JFrame with several textFields, a submit and clear button, just like figure 8-2 in the following tutorial:
http://docs.oracle.com/javafx/2/ui_controls/text-field.htm
But I keep getting an error:
Exception in thread "main" java.lang.ExceptionInInitializerError
Caused by: java.lang.IllegalStateException: Toolkit not initialized
At this line of code:
final TextField totTime = new TextField();
I am somewhat new to using Javafx, so why am I given this error? Thanks!
public static void main(String[] args) throws IOException
{
//Creating GridPane container
GridPane grid = new GridPane();
grid.setPadding(new Insets(10, 10, 10, 10));
grid.setVgap(5);
grid.setHgap(5);
//Defining Total Time
final TextField totTime = new TextField();
totTime.setPromptText("Enter Simulation Duration (Double)");
totTime.setPrefColumnCount(5);
totTime.getText();
GridPane.setConstraints(totTime, 0, 0);
grid.getChildren().add(totTime);
//Defining the Submit button
Button submit = new Button("Submit");
GridPane.setConstraints(submit, 1, 0);
grid.getChildren().add(submit);
//Defining the Clear button
Button clear = new Button("Clear");
GridPane.setConstraints(clear, 1, 1);
grid.getChildren().add(clear);
}