I have some sort of problem during migration from javafx 2.2 to javafx 8; Javafx 8 doesn't support static @FXML elements.
I have the following situation (code is simplified):
Parent controller:
public abstract class ParentController implements Initializable {
@FXML
protected Label parentLabel;
@Override
public void initialize(URL location, ResourceBundle resources) {
// do smth
}
}
Child Controller (there is not only one child):
public class ChildController extends ParentController {
@Override
public void initialize(URL location, ResourceBundle resources) {
super.initialize(location, resources);
parentLabel.setText("text");
}
}
In previous version of this code parentLabel was static and it worked fine. But now I have NullPointerException while trying to setText on label.
I'm looking for the simplest solution in this situation.
UPD 1.
child fxml:
<AnchorPane id="" fx:id="apDentalClinics" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="590.0" prefWidth="1200.0" style="" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/8" fx:controller="com.package.ChildController">
<children>
//Something here, except our lable
</children>
</AnchorPane>