java - JavaFX 8, controllers inheritance -
i have sort of problem during migration javafx 2.2 javafx 8; javafx 8 doesn't support static @fxml elements.
i have following situation (code simplified):
parent controller:
public abstract class parentcontroller implements initializable { @fxml protected label parentlabel; @override public void initialize(url location, resourcebundle resources) { // smth } }
child controller (there not 1 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 code parentlabel static , worked fine. have nullpointerexception while trying settext on label.
i'm looking simplest solution in 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>
Comments
Post a Comment