java - Caused by: javafx.fxml.LoadException error -


this code worked, i'm in trouble. think problem, idk:

caused by: javafx.fxml.loadexception:      /c:/users/alex/workspace/fxmlexample/bin/application/login.fxml:10 

i don't know / understand wrong in these codes. in main run scene. » main.java

package application;  import javafx.application.application; import javafx.fxml.fxmlloader; import javafx.stage.stage; import javafx.scene.parent; import javafx.scene.scene;  public class main extends application {      parent root;      @override     public void start(stage stage) throws exception {         root = fxmlloader.load(getclass().getresource("login.fxml"));          scene scene = new scene(root, 800, 600);          stage.settitle("login system");         stage.setscene(scene);         stage.show();     }      public static void main(string[] args) {         launch(args);     } } 

» login.fxml, here think problem

<?xml version="1.0" encoding="utf-8"?>  <?import java.net.*?> <?import javafx.geometry.*?> <?import javafx.scene.control.*?> <?import javafx.scene.layout.*?> <?import javafx.scene.text.*?>  <gridpane xmlns:fx="http://javafx.com/fxml" fx:controller="fxmlexample.buton"     alignment="center" hgap="10" vgap="10" styleclass="root">     <padding>         <insets top="25" right="25" bottom="10" left="25" />     </padding>      <text fx:id="bunvenit" text="bun venit!" gridpane.columnindex="0"         gridpane.rowindex="0" />      <text fx:id="text" text="logheaza-te folosind datele tale personale:"         gridpane.columnindex="0" gridpane.rowindex="1" gridpane.columnspan="2" />      <label text="username:" gridpane.columnindex="0"         gridpane.rowindex="2" />      <textfield fx:id="username" gridpane.columnindex="1"         gridpane.rowindex="2" />      <label text="parola:" gridpane.columnindex="0" gridpane.rowindex="3" />      <passwordfield fx:id="parola" gridpane.columnindex="1"         gridpane.rowindex="3" />      <hbox spacing="10" alignment="bottom_right" gridpane.columnindex="1"         gridpane.rowindex="5">         <button text="logheaza-te" onaction="#loginbutton" />     </hbox>      <text fx:id="eroare" gridpane.columnindex="1" gridpane.rowindex="7" />      <button text="am uitat parola" gridpane.columnindex="0"         gridpane.rowindex="8" onaction="#passwordbutton" />      <button text="creeaza un cont nou" gridpane.columnindex="1"         gridpane.rowindex="8" onaction="#createaccountbutton" />      <stylesheets>         <url value="@application.css" />     </stylesheets>  </gridpane> 

» buton.java, buttons actions

package fxmlexample;  import java.io.bufferedreader; import java.io.filenotfoundexception; import java.io.filereader; import java.io.ioexception; import javafx.event.actionevent; import javafx.fxml.fxml; import javafx.fxml.fxmlloader; import javafx.scene.node; import javafx.scene.parent; import javafx.scene.scene; import javafx.scene.control.alert; import javafx.scene.control.alert.alerttype; import javafx.scene.control.buttontype; import javafx.scene.control.passwordfield; import javafx.scene.control.textfield; import javafx.scene.text.text; import javafx.stage.stage;  public abstract class buton {      private static final int scene_height = 600;     private static final int scene_width = 800;     @fxml     private text eroare;     @fxml     private textfield username;     @fxml     private passwordfield parola;     @fxml     private parent root;      /* loginbutton */     @fxml     protected void loginbutton(actionevent event) throws ioexception {         boolean gasit = false;         try (bufferedreader buf = new bufferedreader(new    filereader("data//in//users.txt"))) {             string linie;             gasit = false;             while ((linie = buf.readline()) != null) {                 string part[] = linie.split(" ");                 if (username.gettext().equals(part[0]) && parola.gettext().equals(part[1])) {                     gasit = true;                 }             }          } catch (filenotfoundexception e) {             e.printstacktrace();         } catch (ioexception e) {             e.printstacktrace();         }          if (gasit) {             parent root = fxmlloader.load(getclass().getresource("../application/logged.fxml"));             scene scene = new scene(root, scene_width, scene_height);             stage stage = (stage) ((node) event.getsource()).getscene().getwindow();             stage.setscene(scene);             stage.settitle("felicitari, te-ai logat cu succes!");             stage.show();         } else {             eroare.settext("username sau parola incorecta!");         }     } } 

» errors:

exception in application start method java.lang.reflect.invocationtargetexception     @ sun.reflect.nativemethodaccessorimpl.invoke0(native method)     @ sun.reflect.nativemethodaccessorimpl.invoke(unknown source)     @ sun.reflect.delegatingmethodaccessorimpl.invoke(unknown source)     @ java.lang.reflect.method.invoke(unknown source)     @ com.sun.javafx.application.launcherimpl.launchapplicationwithargs(unknown source)     @ com.sun.javafx.application.launcherimpl.launchapplication(unknown source)     @ sun.reflect.nativemethodaccessorimpl.invoke0(native method)     @ sun.reflect.nativemethodaccessorimpl.invoke(unknown source)     @ sun.reflect.delegatingmethodaccessorimpl.invoke(unknown source)     @ java.lang.reflect.method.invoke(unknown source)     @ sun.launcher.launcherhelper$fxhelper.main(unknown source) caused by: java.lang.runtimeexception: exception in application start method     @ com.sun.javafx.application.launcherimpl.launchapplication1(unknown source)     @ com.sun.javafx.application.launcherimpl.lambda$launchapplication$156(unknown source)     @ java.lang.thread.run(unknown source) caused by: javafx.fxml.loadexception:  /c:/users/alex/workspace/fxmlexample/bin/application/login.fxml:10      @ javafx.fxml.fxmlloader.constructloadexception(unknown source)     @ javafx.fxml.fxmlloader.access$700(unknown source)     @ javafx.fxml.fxmlloader$valueelement.processattribute(unknown source)     @ javafx.fxml.fxmlloader$instancedeclarationelement.processattribute(unknown source)     @ javafx.fxml.fxmlloader$element.processstartelement(unknown source)     @ javafx.fxml.fxmlloader$valueelement.processstartelement(unknown source)     @ javafx.fxml.fxmlloader.processstartelement(unknown source)     @ javafx.fxml.fxmlloader.loadimpl(unknown source)     @ javafx.fxml.fxmlloader.loadimpl(unknown source)     @ javafx.fxml.fxmlloader.loadimpl(unknown source)     @ javafx.fxml.fxmlloader.loadimpl(unknown source)     @ javafx.fxml.fxmlloader.loadimpl(unknown source)     @ javafx.fxml.fxmlloader.loadimpl(unknown source)     @ javafx.fxml.fxmlloader.loadimpl(unknown source)     @ javafx.fxml.fxmlloader.load(unknown source)     @ application.main.start(main.java:15)     @ com.sun.javafx.application.launcherimpl.lambda$launchapplication1$163(unknown source)     @ com.sun.javafx.application.platformimpl.lambda$runandwait$176(unknown source)     @ com.sun.javafx.application.platformimpl.lambda$null$174(unknown source)     @ java.security.accesscontroller.doprivileged(native method)     @ com.sun.javafx.application.platformimpl.lambda$runlater$175(unknown source)     @ com.sun.glass.ui.invokelaterdispatcher$future.run(unknown source)     @ com.sun.glass.ui.win.winapplication._runloop(native method)     @ com.sun.glass.ui.win.winapplication.lambda$null$149(unknown source)     ... 1 more caused by: java.lang.instantiationexception     @ sun.reflect.instantiationexceptionconstructoraccessorimpl.newinstance(unknown source)     @ java.lang.reflect.constructor.newinstance(unknown source)     @ java.lang.class.newinstance(unknown source)     @ sun.reflect.misc.reflectutil.newinstance(unknown source)     ... 23 more exception running application application.main 

it says:

java.lang.instantiationexception @ sun.reflect.instantiationexceptionconstructoraccessorimpl.newinstance(unknown source) @ java.lang.reflect.constructor.newinstance(unknown source) 

it cannot instantiate abstract buton class. make concrete.


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

css - Can I use the :after pseudo-element on an input field? -