javafx - JafaFx Load FXML file Error Null Pointer Exception -
i have exception whith no difinition of error when trying load window button login. before worked fine, dont know why shoing error java.lang.nullpointerexception, there line in console , couldnt find whats wrong. hears files .
<splitpane dividerpositions="0.5" maxheight="-infinity" maxwidth="-infinity" minheight="-infinity" minwidth="-infinity" orientation="vertical" prefheight="400.0" prefwidth="600.0" xmlns="http://javafx.com/javafx/8.0.40" xmlns:fx="http://javafx.com/fxml/1" fx:controller="controller.mainentredcontroller"> <items> <menubar> <menus> <menu mnemonicparsing="false" text="file"> <items> <menuitem mnemonicparsing="false" text="close" /> </items> </menu> <menu mnemonicparsing="false" text="edit"> <items> <menuitem mnemonicparsing="false" text="delete" /> </items> </menu> <menu mnemonicparsing="false" text="help"> <items> <menuitem mnemonicparsing="false" text="about" /> </items> </menu> </menus> </menubar> <tabpane prefheight="200.0" prefwidth="200.0" tabclosingpolicy="unavailable"> <tabs> <tab text="home" /> </tabs> </tabpane> </items> </splitpane>
and function lunchs view in class named maincontroller
public void loginbtnclick(actionevent event) throws exception{ string usern = username.gettext(); string pass = txtpassword.gettext(); try { if( con.logindatabase(usern, pass)){ lblstatus.settext("login successfully"); stage primarystage1 = new stage(); parent root = fxmlloader.load(getclass().getresource("/application/viewsfx/mainentredhome.fxml")); scene scene = new scene(root); scene.getstylesheets().add(getclass().getresource("application.css").toexternalform()); primarystage1.setscene(scene); primarystage1.show(); // closing login scene stage stage = (stage) btnlogin.getscene().getwindow(); stage.close(); }else { lblstatus.settext("login failed"); } } catch (exception e) { system.out.println(e); system.out.println("ani hna mebloki"); }
and controller of splitpane view class named mainentrecontroller, when click on logni shows me eception java.lang.nullpointerexception
Comments
Post a Comment