简体   繁体   中英

How do i get rid of this error? When i try to open with SceneBuilder it doesnt work

When i try to open my Login.FXML file it gives me this error:

screenshot of error: https://ibb.co/7rcpD1y

this is the code for the Login.fxml file:

<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ComboBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.PasswordField?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.effect.Glow?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.text.Font?>

<AnchorPane prefHeight="456.0" prefWidth="389.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="application.MainController">
   <children>
      <Button layoutX="160.0" layoutY="376.0" mnemonicParsing="false" onAction="#Login" text="Login" textFill="#371aed">
         <font>
            <Font size="18.0" />
         </font></Button>
      <TextField fx:id="txtUserName" layoutX="83.0" layoutY="248.0" promptText="UserName">
         <font>
            <Font size="18.0" />
         </font>
      </TextField>
      <PasswordField fx:id="txPassword" layoutX="83.0" layoutY="302.0" promptText="Password">
         <font>
            <Font size="18.0" />
         </font>
      </PasswordField>
      <Label fx:id="lblStatus" layoutX="163.0" layoutY="341.0" prefHeight="27.0" prefWidth="64.0" text="Status" textFill="#d02020">
         <font>
            <Font size="18.0" />
         </font>
      </Label>
      <ImageView fitHeight="150.0" fitWidth="200.0" layoutX="95.0" layoutY="26.0" pickOnBounds="true" preserveRatio="true"> 
      <image>
      <Image url="" />
      </image>
      </ImageView>
      <Label layoutX="149.0" layoutY="176.0" text="Login Form">
         <font>
            <Font size="18.0" />
         </font>
      </Label>
      <ComboBox fx:id="combobox" layoutX="120.0" layoutY="210.0" prefWidth="150.0" promptText="Client/Employee" />
   </children>
   <effect>
      <Glow />
   </effect>
   <opaqueInsets>
      <Insets />
   </opaqueInsets>
</AnchorPane>

Any ways how i can fix this?

please help me i need this for my computer science prjoect. thank you

If you press the "Show Details" button, the stack trace tells you the problem:

java.io.IOException: javafx.fxml.LoadException: 
/Users/jdenvir/Desktop/Login.fxml:38

    at com.oracle.javafx.scenebuilder.kit.fxom.FXOMLoader.load(FXOMLoader.java:101)
    at com.oracle.javafx.scenebuilder.kit.fxom.FXOMDocument.<init>(FXOMDocument.java:93)
    at com.oracle.javafx.scenebuilder.kit.fxom.FXOMDocument.<init>(FXOMDocument.java:110)
    at com.oracle.javafx.scenebuilder.kit.editor.EditorController.updateFxomDocument(EditorController.java:2560)
    at com.oracle.javafx.scenebuilder.kit.editor.EditorController.setFxmlTextAndLocation(EditorController.java:763)
    at com.oracle.javafx.scenebuilder.app.DocumentWindowController.loadFromFile(DocumentWindowController.java:386)
    at com.oracle.javafx.scenebuilder.app.SceneBuilderApp.performOpenFiles(SceneBuilderApp.java:665)
    at com.oracle.javafx.scenebuilder.app.SceneBuilderApp.performOpenFile(SceneBuilderApp.java:601)
    at com.oracle.javafx.scenebuilder.app.SceneBuilderApp.performControlAction(SceneBuilderApp.java:203)
    at com.oracle.javafx.scenebuilder.app.menubar.MenuBarController$ApplicationControlActionController.perform(MenuBarController.java:1778)
    at com.oracle.javafx.scenebuilder.app.menubar.MenuBarController.handleOnActionMenu(MenuBarController.java:1222)
    at com.oracle.javafx.scenebuilder.app.menubar.MenuBarController.lambda$new$4(MenuBarController.java:1216)
    at javafx.base/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
    at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
    at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
    at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
    at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at javafx.base/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
    at javafx.base/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
    at javafx.base/javafx.event.Event.fireEvent(Event.java:198)
    at javafx.controls/javafx.scene.control.MenuItem.fire(MenuItem.java:465)
    at javafx.controls/com.sun.javafx.scene.control.GlobalMenuAdapter.lambda$bindMenuItemProperties$2(GlobalMenuAdapter.java:153)
    at javafx.base/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
    at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
    at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
    at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
    at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at javafx.base/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
    at javafx.base/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
    at javafx.base/javafx.event.Event.fireEvent(Event.java:198)
    at javafx.controls/javafx.scene.control.MenuItem.fire(MenuItem.java:465)
    at javafx.graphics/com.sun.javafx.tk.quantum.GlassSystemMenu$1.action(GlassSystemMenu.java:234)
Caused by: javafx.fxml.LoadException: 
/Users/jdenvir/Desktop/Login.fxml:38

    at javafx.fxml/javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2625)
    at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2603)
    at javafx.fxml/javafx.fxml.FXMLLoader.load(FXMLLoader.java:2450)
    at com.oracle.javafx.scenebuilder.kit.fxom.FXOMLoader.load(FXOMLoader.java:96)
    ... 31 more
Caused by: java.lang.IllegalArgumentException: URL must not be empty
    at javafx.graphics/javafx.scene.image.Image.validateUrl(Image.java:1084)
    at javafx.graphics/javafx.scene.image.Image.<init>(Image.java:688)
    at javafx.fxml/com.sun.javafx.fxml.builder.JavaFXImageBuilder.build(JavaFXImageBuilder.java:47)
    at javafx.fxml/com.sun.javafx.fxml.builder.JavaFXImageBuilder.build(JavaFXImageBuilder.java:37)
    at javafx.fxml/javafx.fxml.FXMLLoader$ValueElement.processEndElement(FXMLLoader.java:771)
    at javafx.fxml/javafx.fxml.FXMLLoader.processEndElement(FXMLLoader.java:2838)
    at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2557)
    ... 33 more

Specifically:

Caused by: java.lang.IllegalArgumentException: URL must not be empty
    at javafx.graphics/javafx.scene.image.Image.validateUrl(Image.java:1084)
    at javafx.graphics/javafx.scene.image.Image.<init>(Image.java:688)

Either remove the <Image> element on line 38, or specify a valid URL for its Image .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM