I am attempting to load the main screen for my application, which in fact never actually runs and shows a screen. Upon further investigation (running it through the NetBeans debugger), I found that my code never executes after FXMLLoader.load(url); -- it stops there, and does not throw any error. I do know that the url is correct- I checked the value of it, and it is correct. Anyone know how to fix it? Thanks in advance!
<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?>
<?import javafx.scene.text.*?>
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="- Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="graphics.MainScreenController">
<children>
<Text fx:id="funds" layoutX="489.0" layoutY="383.0" strokeType="OUTSIDE" strokeWidth="0.0" text="USD 52,356,000.07">
</Text>
</children></AnchorPane>
package graphics;
import java.io.IOException;
import java.net.URL;
import java.util.ResourceBundle;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.application.Application;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.MenuButton;
import javafx.scene.control.MenuItem;
import javafx.scene.layout.VBox;
import javafx.scene.shape.Rectangle;
import javafx.scene.text.Text;
import javafx.stage.Stage;
/**
* FXML Controller class
*
*/
public class MainScreenController extends Application implements Initializable {
@FXML
private Text funds;
/**
* Initializes the controller class.
*/
public void initialize(URL url, ResourceBundle rb) {
start(new Stage());
}
@Override
public void start(Stage primaryStage){
Parent root = null;
try {
URL url = getClass().getResource("MainScreen.fxml");
root = FXMLLoader.load(url);
} catch (Exception ex) {
Logger.getLogger(MainScreenController.class.getName()).log(Level.SEVERE, null, ex);
}
Scene scene = new Scene(root,1200,800);
primaryStage.setTitle("Title");
primaryStage.setScene(scene);
primaryStage.show();
}
}