title: getting an error in the initialize when I try to run my javafx application
body: <p>I was testing <strong>JavaFX</strong> application and I'm getting errors now don't know much about <strong>JavaFX</strong>, still learning it. I think its because of the <code>label.setText(numbers[0]);</code> and if I do <code>@FXML Label lebal = new Label();</code>, it wont change on action. Thanks.</p>
  
  <p>my gui class</p>
  
  <pre><code>package fx;
  
  import javafx.application.Application;
  import javafx.fxml.FXMLLoader;
  import javafx.scene.Parent;
  import javafx.scene.Scene;
  import javafx.stage.Stage;
  
  public class GUI extends Application {
  
  
  @Override
  public void start(Stage primaryStage) throws Exception {
  
      final Parent root = FXMLLoader.load(getClass().getResource("test.fxml")); //error (GUI.java:15)
      primaryStage.setTitle("Hello World!");
      primaryStage.setScene(new Scene(root, 257, 474));
      primaryStage.setResizable(false);
      primaryStage.show();
      ;
  
  }
  
  public static void main(String[] args) {
      GUI.launch(GUI.class, args);
  }
  }
  </code></pre>
  
  <p>my controller class: </p>
  
  <pre><code>package fx;
  
  import java.net.URL;
  import java.util.Arrays;
  import java.util.ResourceBundle;
  
  import javafx.event.ActionEvent;
  import javafx.event.EventHandler;
  import javafx.fxml.FXML;
  import javafx.fxml.Initializable;
  import javafx.scene.control.Button;
  import javafx.scene.control.ComboBox;
  import javafx.scene.control.Label;
  
  import com.sun.javafx.collections.ObservableListWrapper;
  
  public class myCon implements Initializable {
  
  @FXML Button button;
  @FXML ComboBox&lt;String&gt; combobox;
  @FXML Label label;
  
  
  String[] order = {"First", "second"}; 
  String[] numbers = {"one", "two"}; 
  
  
  @Override
  public void initialize(URL location, ResourceBundle resources) {
      combobox.setItems(new ObservableListWrapper&lt;&gt;(Arrays.asList(order)));
      combobox.getSelectionModel().selectFirst();
      label.setText(numbers[0]);//error here (myCon.java:32)
      System.out.println(label.getText());
      button.setOnAction(new EventHandler&lt;ActionEvent&gt;() {
  
          @Override
          public void handle(ActionEvent event) {
  label.setText(numbers[combobox.getSelectionModel().getSelectedIndex()]);
              System.out.println(label.getText());
          }
      });
  }
  </code></pre>
  
  <p>}</p>
  
  <p>the error I'm getting</p>
  
  <pre><code>Jul 01, 2013 11:45:24 AM javafx.fxml.FXMLLoader logException
  SEVERE: java.lang.NullPointerException
  /C:/Users/user/Desktop/New%20folder%20(2)/Project/bin/fx/test.fxml:-1
  at fx.myCon.initialize(myCon.java:32)
  at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2047)
  at javafx.fxml.FXMLLoader.load(FXMLLoader.java:1900)
  at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2486)
  at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2478)
  at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2472)
  at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2466)
  at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2461)
  at fx.GUI.start(GUI.java:15)
  at com.sun.javafx.application.LauncherImpl$5.run(LauncherImpl.java:315)
  at com.sun.javafx.application.PlatformImpl$4.run(PlatformImpl.java:174)
  at com.sun.javafx.application.PlatformImpl$3.run(PlatformImpl.java:141)
  at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
  at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:29)
  at com.sun.glass.ui.win.WinApplication$2$1.run(WinApplication.java:62)
  at java.lang.Thread.run(Unknown Source)
  
  Exception in Application start method
  Exception in thread "main" java.lang.RuntimeException: Exception in Application start          method
  at      com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:399)
  at com.sun.javafx.application.LauncherImpl.access$000(LauncherImpl.java:47)
  at com.sun.javafx.application.LauncherImpl$1.run(LauncherImpl.java:115)
  at java.lang.Thread.run(Unknown Source)
  Caused by: java.lang.NullPointerException
  at fx.myCon.initialize(myCon.java:32)
  at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2047)
  at javafx.fxml.FXMLLoader.load(FXMLLoader.java:1900)
  at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2486)
  at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2478)
  at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2472)
  at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2466)
  at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2461)
  at fx.GUI.start(GUI.java:15)
  at com.sun.javafx.application.LauncherImpl$5.run(LauncherImpl.java:315)
  at com.sun.javafx.application.PlatformImpl$4.run(PlatformImpl.java:174)
  at com.sun.javafx.application.PlatformImpl$3.run(PlatformImpl.java:141)
  at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
  at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:29)
  at com.sun.glass.ui.win.WinApplication$2$1.run(WinApplication.java:62)
  ... 1 more
  </code></pre>