This is the code to load the second form
public void ToLogin() throws IOException { Message msg = new Message(); msg.show("登录失败"); }
This is the display code of the second form
public void show(String message) throws IOException { Parent root = FXMLLoader.load(Message.class.getResource("Message.fxml")); Scene scene = new Scene(root); stage.setScene(scene); label.setText(message);//此处抛出空指针异常 stage.initStyle(StageStyle.TRANSPARENT); stage.show(); }
This is the Message.fxml file
PHP是世界上最好的语言