I am very new to JavaFX and know nothing about it. I have been watching YouTube videos on how to use Scene Builder; but somehow when I'm on this part, I can't set the code and this is the message that prompts:
I need a fix for my problem that keeps on occurring.
Login.fxml
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.PasswordField?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.text.Font?>
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="820.0" prefWidth="1080.0" style="-fx-background-color: #1D242A;" xmlns="http://javafx.com/javafx/21" xmlns:fx="http://javafx.com/fxml/1" fx:controller="LoginController">
<children>
<Pane layoutX="315.0" layoutY="230.0" prefHeight="455.0" prefWidth="450.0" style="-fx-background-color: #2F353A;">
<children>
<Button fx:id="LoginBtn" layoutX="34.0" layoutY="397.0" mnemonicParsing="false" prefHeight="35.0" prefWidth="382.0" style="-fx-background-color: #158BF8;" text="Login" textFill="WHITE">
<font>
<Font name="System Bold" size="20.0" />
</font>
</Button>
<Label fx:id="WelcomeBack" layoutX="129.0" layoutY="14.0" text="Welcome Back" textFill="WHITE">
<font>
<Font name="System Bold" size="28.0" />
</font>
</Label>
<Label fx:id="Sign_In" layoutX="197.0" layoutY="54.0" text="Sign In" textFill="#aeaeae">
<font>
<Font name="System Bold" size="17.0" />
</font>
</Label>
<Label fx:id="Password" layoutX="55.0" layoutY="246.0" text="Password" textFill="#aeaeae">
<font>
<Font name="System Bold" size="17.0" />
</font>
</Label>
<PasswordField layoutX="55.0" layoutY="280.0" prefHeight="33.0" prefWidth="339.0" promptText="Enter your password" />
<TextField fx:id="txt_user" layoutX="55.0" layoutY="181.0" prefHeight="33.0" prefWidth="339.0" promptText="Enter you username" />
<Label fx:id="Username" layoutX="53.0" layoutY="144.0" text="Username" textFill="#aeaeae">
<font>
<Font name="System Bold" size="17.0" />
</font>
</Label>
</children>
</Pane>
<Label fx:id="label_Budo" layoutX="343.0" layoutY="139.0" text="BUDO Enterprise Inc." textFill="WHITE">
<font>
<Font name="System Bold" size="40.0" />
</font>
</Label>
</children>
</AnchorPane>
and this one is the controller:
import java.net.URL;
import java.util.ResourceBundle;
import javafx.application.Application;
import javafx.fxml.*;
import javafx.scene.*;
import javafx.scene.control.*;
import javafx.stage.Stage;
public class LoginController implements Initializable {
@Override
public void initialize(URL url, ResourceBundle rb) {
}
}

Your posted
LoginController"has no injectable field…named for the idLoginBtn". As @jewelsea comments,SceneBuilder > View > Show Sample Controller Skeletoncan produce theLoginControllershown below. I placed your "Login.fxml" in apackagenamedtemp, using the fully qualified name:I added a simple "LoginApp.java", also shown below, to produce the image below. Note how "LoginApp.java" loads "Login.fxml", parsing it for a field that is named
LoginBtnand annotated@FXML.LoginController.java:
LoginApp.java