-4
  1. Can one controller class have two or more initialize () ?

  2. Can multiple statements be in a single initialize() ?

@question 2...This is my controller class:

@Overide
public void initialize(URL url,ResourceBundle rb)
{
//adding itemList variable to itemBox
try{

itemBox.setValue("Gari");
itemBox.setItems(itemList);
}
catch(Exception e){
System.out.println(e);
}

//Animation for changing scene
String filename = url.getFile().substring(URL.getFile().lastIndexOf('/')+1, URL.getFile().length());


if(filename.equals("FXML.fxml")){

//calling fadeTransition method
fadeTrans(anchorPane);
}

else if(filename.equals("SignUp_In.fxml")){ 
fadeTrans (anchorPaneSignUp_In);
}

}

and it returns this error message:

java.lang.NullPointerException

Here, the multiple statements are adding itemList to itemBox and changing scene with animation

  • 1
    Answering this question as it stands would not contribute to the aim of this site (which is to provide a collection of resources for programmers). Can you formulate this into a more useful question - what are you trying to achieve that would lead you to ask this, and what have you tried in order to solve whatever problem it is you are trying to solve? – James_D Jun 14 '17 at 22:28
  • A Controller class should have one initialize() method . What does the second question means? – GOXR3PLUS Jun 15 '17 at 04:06

1 Answers1

-2
  1. no
  2. yes

Just some more characters to get over the minimum.

mipa
  • 10,369
  • 2
  • 16
  • 35