I am new in Javafx programming with java for graphic interfaces, and after research for possible solutions, i still have the problem
I've got this code in my Main Javafx App which extends Application
public void initRootLayout() throws IOException {
FXMLLoader loader;
Parent rootLayout;
loader = new FXMLLoader();
loader.setLocation(getClass().getResource("/fiec/dst/seer/screen/login/login.fxml"));
rootLayout = loader.load();
LoginController = (loginFXMLController)loader.getController();
// Show the scene containing the root layout.
Scene scene = new Scene(rootLayout);
primaryStage.setScene(scene);
primaryStage.setMaximized(false);
primaryStage.setResizable(false);
primaryStage.show();
}
LoginController is an instance of loginFXMLController which is the controller of fxml file that displays a login interface (user and password).
I don't know if i'm in the right path, but i have a method in Main class that needs to check if user and password are corrects(these attributes are in loginFXMLController), as you may see, first i call load method, and i need to ask constantly the values of user and password provided from LoginController.
initRootLayout is called in start method of Main Application
@Override
public void start(Stage primaryStage) throws IOException {
this.primaryStage = primaryStage;
this.primaryStage.setTitle("System");
initRootLayout();
}
I need help, because with these i'm getting the exception: java.lang.NullPointerException when i call attributes from LoginController
This is de StackTrace :
java.lang.NullPointerException
at fiec.dst.seer.main.RFIDReader.messageReceived(RFIDReader.java:323)
at org.llrp.ltk.net.LLRPIoHandlerAdapterImpl.messageReceived(LLRPIoHandlerAdapterImpl.java:109)
at org.apache.mina.common.support.AbstractIoFilterChain$TailFilter.messageReceived(AbstractIoFilterChain.java:570)
at org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:299)
at org.apache.mina.common.support.AbstractIoFilterChain.access$1100(AbstractIoFilterChain.java:53)
at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(AbstractIoFilterChain.java:648)
at org.apache.mina.filter.codec.support.SimpleProtocolDecoderOutput.flush(SimpleProtocolDecoderOutput.java:58)
at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:180)
at org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:299)
at org.apache.mina.common.support.AbstractIoFilterChain.access$1100(AbstractIoFilterChain.java:53)
at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(AbstractIoFilterChain.java:648)
at org.apache.mina.filter.executor.ExecutorFilter.processEvent(ExecutorFilter.java:220)
at org.apache.mina.filter.executor.ExecutorFilter$ProcessEventsRunnable.run(ExecutorFilter.java:264)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51)
at java.lang.Thread.run(Unknown Source)
MainApp extends from Application and implements LLRPEndpoint LLRPEndpoint contains methods to communicate with objects with RFID tags
This problem occurs when i try to get attribute from loginFXMLController (user and password)