JavaFX 'Type mismatch' with root -
JavaFX 'Type mismatch' with root -
something wrong, making nice gui in scenebuilder. can add together elements vboxs , hboxs, cannot seem apply fxml javafx project.
here code
package org.ntokens.congen; import java.io.ioexception; import javafx.application.application; import javafx.fxml.fxmlloader; import javafx.scene.parent; import javafx.scene.scene; import javafx.scene.control.label; import javafx.scene.layout.vbox; import javafx.stage.stage; public class main extends application{ label label; public static void main(string[] args){ launch(args); } public void start(stage primarystage) { parent root; seek { root = fxmlloader.load(getclass().getresource("mainform.fxml")); } grab (ioexception e) { e.printstacktrace(); return; } scene scene = new scene(root); primarystage.setscene(scene); primarystage.sizetoscene(); primarystage.show(); } }
you have explicitly tell fxmlloader type of object loaded:
root = fxmlloader.<parent>load(getclass().getresource("mainform.fxml"));
javafx
Comments
Post a Comment