JavaFX - Adding buttons dynamically to fxml created VBox - java

I am trying to add x number of buttons to a VBox located in a scrollpane.
The Vbox, and scrollpane are made with scenebuilder.
However i can't seem to connect the VBox to the controller as a variable.
The piece of code that spawns the scene is the following:
Stage stage = MyMain.stage;
stage.setScene(new Scene(FXMLLoader.load(getClass().getResource("/main/fxml/catEdit.fxml"))));
stage.show();
My FXML is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.layout.VBox?>
<BorderPane maxHeight="-Infinity"
maxWidth="-Infinity"
minHeight="-Infinity"
minWidth="-Infinity"
prefHeight="400.0"
prefWidth="600.0"
xmlns="http://javafx.com/javafx/8.0.111"
xmlns:fx="http://javafx.com/fxml/1"
fx:controller="main.controllers.CatEditCon">
<center>
<ScrollPane prefHeight="200.0" prefWidth="200.0" BorderPane.alignment="CENTER">
<content>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="200.0" prefWidth="200.0">
<children>
<VBox fx:id="catBox" alignment="CENTER" prefHeight="200.0" prefWidth="100.0" />
</children></AnchorPane>
</content>
</ScrollPane>
</center>
</BorderPane>
And the controller is:
package main.controllers;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.layout.VBox;
import main.MyMain;
import main.database.master.Category;
import main.fxml.custom.CatBut;
public class CatEditCon{
#FXML public VBox catBox;
public CatEditCon(){
catBox = new VBox();
updateScroll();
}
public void updateScroll(){
Category cat = MyMain.baseData.getCategories();
System.out.println(catBox);
int len = MyMain.baseData.getArticles().size();
for(int i = 0 ; i < len; i++ ){
System.out.println(""+i);
Button b = new Button();
catBox.getChildren().add(b);
}
}
}
Any tips to what i do wrong?
The scene opens, and the sysout counts upwards as it should. But no buttons appear?
If the catBox isnt initialized in the constructor, i get a nullPionter to that object. So it is as if i don't make the connection to the fxml object.

Related

JavaFX: expanding TextArea, Listview (Vgrow/Hgrow = 'ALWAYS' doesn't work)

I have a simple JavaFX application, a BorderLayout with an AnchorPane and inside two panes, one contains a HBox and a VBox with a TextArea and a ListView. I would like them to increase in width, as I increase the window size. I have tried Vgrow/Hgrow = 'ALWAYS' and Max Width/Max Height = 'MAX_VALUE' on the the controls but nothing works.- (I use Scene Builder to create the fxml)
The FXML is the following:
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.ListView?>
<?import javafx.scene.control.TextArea?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.layout.VBox?>
<BorderPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" xmlns="http://javafx.com/javafx/18" xmlns:fx="http://javafx.com/fxml/1">
<center>
<AnchorPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="200.0" BorderPane.alignment="CENTER">
<children>
<Pane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="200.0" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="0.0" />
<Pane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="200.0" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="200.0">
<children>
<HBox maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="200.0">
<children>
<VBox maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="200.0" HBox.hgrow="ALWAYS">
<children>
<TextArea maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="200.0" VBox.vgrow="ALWAYS" />
<ListView maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="200.0" VBox.vgrow="ALWAYS" />
</children>
</VBox>
</children>
</HBox>
</children>
</Pane>
</children>
</AnchorPane>
</center>
</BorderPane>
My java application class (HelloApplication):
package com.example.demo;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.stage.Stage;
import java.io.IOException;
public class HelloApplication extends Application {
#Override
public void start(Stage stage) throws IOException {
FXMLLoader fxmlLoader = new FXMLLoader(HelloApplication.class.getResource("hello-view.fxml"));
Scene scene = new Scene(fxmlLoader.load());
stage.setTitle("Hello!");
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
launch();
}
}
UPDATE: I removed the unnecessary AnchorPane and other Panes, kept only a VBox and placed it in another BorderLayout, take a look, now seems perfect :)
Don't hard-code sizes, and don't use layout panes such as Pane and AnchorPane that rely on hard-coded sizes except in very rare circumstances.
(You may sometimes need to set the max size to Double.MAX_VALUE to allow a control to grow beyond its preferred size, but even that is not necessary in this example, as far as I can tell.)
Your FXML has an empty Pane and at least two redundant wrapper containers which only wrap one node (the other Pane and the AnchorPane). Remove all of these and the hard-coded values and it will work:
<?import javafx.scene.control.ListView?>
<?import javafx.scene.control.TextArea?>
<?import javafx.scene.layout.*?>
<BorderPane xmlns="http://javafx.com/javafx/18" xmlns:fx="http://javafx.com/fxml/1">
<center>
<HBox>
<children>
<VBox HBox.hgrow="ALWAYS">
<children>
<TextArea VBox.vgrow="ALWAYS" />
<ListView VBox.vgrow="ALWAYS" />
</children>
</VBox>
</children>
</HBox>
</center>
</BorderPane>
Depending on your real use-case, you may not need the HBox either:
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.ListView?>
<?import javafx.scene.control.TextArea?>
<?import javafx.scene.layout.*?>
<BorderPane xmlns="http://javafx.com/javafx/18" xmlns:fx="http://javafx.com/fxml/1">
<center>
<VBox>
<children>
<TextArea VBox.vgrow="ALWAYS" />
<ListView VBox.vgrow="ALWAYS" />
</children>
</VBox>
</center>
</BorderPane>

JavaFX Project not showing

Below I have the code to launch my JavaFX GUI for a project I am working on. However when I go to execute the classes, it gets stuck. All it prints is Starting MCPY GUI and just sits there any help?
Launcher class
public class MCPY {
public static void main(String args[]) {
System.out.println("Starting MCPY GUI...");
Main.main(args);
}
}
Main
package com.mcpy.gui;
import java.io.IOException;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
public class Main extends Application {
#Override
public void start(Stage primaryStage) throws Exception{
FXMLLoader loader = new FXMLLoader(getClass().getResource("styles/Main.fxml"));
Parent root;
try {
root = loader.load();
} catch (IOException ioe) {
// log exception
return;
}
//init the connection to the controller class
MainController MainController = loader.getController();
MainController.setMain(this);
//load the scene
primaryStage.setTitle("Minecraft Launcher Python");
primaryStage.setScene(new Scene(root, 800, 500));
primaryStage.show();
};
public static void main(String[] args) {
launch(args);
}
Main.FXML
<?import java.lang.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.image.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.control.TitledPane?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.control.Button?>
<TitledPane animated="false" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" text="Minecraft Launcher Python Login Screen" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.mcpy.gui.MainController">
<content>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0">
<children>
<ImageView fitHeight="135.0" fitWidth="119.0" layoutX="14.0" layoutY="14.0" pickOnBounds="true" preserveRatio="true">
<image>
</image>
</ImageView>
<Button id="play" layoutX="231.0" layoutY="176.0" mnemonicParsing="false" onAction="#playButtonActionEvent" text="Play" />
<Button id="login" layoutX="313.0" layoutY="176.0" mnemonicParsing="false" onAction="#loginButtonEvent" text="Login" />
<Button id="create_account" layoutX="77.0" layoutY="176.0" mnemonicParsing="false" onAction="#create_accountButtonEvent" text="Create Account" />
</children></AnchorPane>
</content>
</TitledPane>
MainController
package com.mcpy.gui;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import com.mcpy.gui.Play;
import com.mcpy.gui.Login;
import com.mcpy.gui.CreateAccount;
/* Logic for the main gui. DO NOT EDIT. */
public class MainController {
#SuppressWarnings("unused")
private Main main;
public void setMain(Main main) {
this.main = main;
}
#FXML
private static Button login;
#FXML
private static Button create_account;
#FXML
private static Button play;
#FXML
public void loginButtonEvent(ActionEvent lbe) {
String[] args = (null);
Login.main(args);
};
#FXML
public void create_accountButtonEvent(ActionEvent cabe) {
String[] args = (null);
CreateAccount.main(args);
};
#FXML
public void playButtonActionEvent(ActionEvent pbae) {
Play.play_mc();
}
}
All of the code is here. The Launcher (MCPY.java) the main gui and its respecitve controller and the stylesheet (Main.java, MainController.java and Main.FXML)
EDIT: I have applied the FXML changes suggested by #naimdjon, however upon clicking the button this error is produced: https://pastebin.com/8EV9wfnm
You have multiple namespace declaration in your xml and imports were missing. Change your fxml to this (removed image for testing), this shows a window:
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.TitledPane?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.control.Button?>
<TitledPane fx:controller="com.mcpy.gui.MainController" animated="false"
maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity"
minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0"
text="Minecraft Launcher Python Login Screen"
xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml">
<content>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0">
<children>
<ImageView fitHeight="135.0" fitWidth="119.0" layoutX="14.0" layoutY="14.0" pickOnBounds="true" preserveRatio="true">
<image>
</image>
</ImageView>
<Button id="play" layoutX="231.0" layoutY="176.0" mnemonicParsing="false" text="Play" />
<Button id="login" layoutX="313.0" layoutY="176.0" mnemonicParsing="false" text="Login" />
<Button id="create_account" layoutX="77.0" layoutY="176.0" mnemonicParsing="false" text="Create Account" />
</children></AnchorPane>
</content>
</TitledPane>
UPDATE
Upon clicking on the button, you seem to be calling the launch() method. You can't call launch() method more than once in a Java FX application.

JavaFX - Issue when including another fxml to a border pane center of a main fxml

I'm trying to include an additional fxml in a main fxml, border pane center. When I do this, the fxml gets included and shows in the center, but the fxml does not occupy the full width and height of the main fxml window.
In the SceneBuilder, if I add the TableView in the center of the borderpane, it acts as it should. Only when I include the fxml via code it does not.
Please help, what am I missing? Any help will be appreciated!
This is what I need:
This is what I get:
Main FXML:
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.effect.*?>
<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import java.lang.*?>
<?import javafx.scene.layout.*?>
<TabPane fx:id="TabPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="800.0" prefWidth="1300.0" tabClosingPolicy="UNAVAILABLE" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
<tabs>
<Tab fx:id="lecturersTab" closable="false" text="Lecturers">
<content>
<BorderPane prefHeight="200.0" prefWidth="200.0">
<center>
<TableView prefHeight="200.0" prefWidth="200.0" BorderPane.alignment="CENTER">
<columns>
<TableColumn prefWidth="75.0" text="C1" />
<TableColumn prefWidth="75.0" text="C2" />
</columns>
</TableView>
</center>
</BorderPane>
</content>
</Tab>
<Tab fx:id="membersTab" closable="false" text="Members">
<content>
<BorderPane prefHeight="200.0" prefWidth="200.0">
<center>
<fx:include fx:id="memberPage" source="GUImembers.fxml"/>
</center>
</BorderPane>
</content>
</Tab>
</tabs>
</TabPane>
FXML I want to add:
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.*?>
<?import java.lang.*?>
<?import javafx.scene.layout.*?>
<BorderPane fx:id="memberPage" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="700.0" prefWidth="1300.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="GUImembersController">
<center>
<TableView BorderPane.alignment="CENTER">
<columns>
<TableColumn prefWidth="75.0" text="C1" />
<TableColumn prefWidth="75.0" text="C2" />
</columns>
</TableView>
</center>
</BorderPane>
Main:
import java.io.IOException;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
public class MainClass extends Application
{
public FXMLLoader loader;
public static void main(String[] args)
{
launch(args);
}
public void start(Stage stage) throws Exception
{
loader = new FXMLLoader();
loader.setLocation(getClass().getResource("FXML/GUImain.fxml"));
loader.setController(new GUImainController());
Parent root = loader.load();
Scene scene = new Scene(root);
stage.setTitle("VIA - Event Management System");
stage.setScene(scene);
stage.show();
}
}
Finally, after long hours of fighting with java fx, I got the sollution, which was quite simple. Thanks to this question : JavaFX Borderpane without left and right children

Transparent stage/scene loses its transparency after loading another FXML file

When I start my application my transparent javafx.stage.Stage shows a half transparent image as expected. But after a second stage is loaded the first stage loses its transparency.
The weird thing is that if the second fxml file ("MainScreen.fxml") doesn't contains any components like buttons or text fields, the background stays transparent.
I'm using JavaFX with JavaSE-1.8 in eclipse neon.2 on macOS Sierra.
Main class
package customPackage.main;
import javafx.animation.FadeTransition;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.geometry.Rectangle2D;
import javafx.scene.Scene;
import javafx.scene.paint.Color;
import javafx.stage.Screen;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import javafx.util.Duration;
public class Main extends Application implements Runnable {
private Stage primaryStage;
private Stage stage;
private Controller launchController;
#Override
public void start(Stage primaryStage) {
this.primaryStage = primaryStage;
launchController = new Controller("LaunchScreen.fxml");
Scene launchScene = new Scene(launchController);
launchScene.setFill(Color.TRANSPARENT);
primaryStage.initStyle(StageStyle.TRANSPARENT);
primaryStage.setAlwaysOnTop(true);
primaryStage.setResizable(false);
primaryStage.setScene(launchScene);
primaryStage.show();
Thread thread = new Thread(this);
thread.start();
}
#Override
public void run() {
try {
Thread.sleep(3000);
// simulate work
} catch (InterruptedException e) {
e.printStackTrace();
}
Controller controller = new Controller("MainScreen.fxml");
Scene scene = new Scene(controller);
Platform.runLater(new Runnable() {
#Override
public void run() {
stage = new Stage();
stage.initStyle(StageStyle.UNDECORATED);
stage.setResizable(false);
stage.setScene(scene);
stage.show();
}
});
}
}
Controller class
package customPackage.main;
import java.io.IOException;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.control.ProgressBar;
import javafx.scene.layout.AnchorPane;
public class LaunchController extends AnchorPane {
#FXML
private ProgressBar bar;
public LaunchController(String filename) {
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource(filename));
fxmlLoader.setRoot(this);
fxmlLoader.setController(this);
try {
fxmlLoader.load();
} catch (IOException e) {
e.printStackTrace();
}
}
}
FXML File ("LaunchScreen.fxml")
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.effect.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.image.*?>
<?import java.lang.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.layout.AnchorPane?>
<fx:root fx:id="pane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="326.0" prefWidth="883.0" type="AnchorPane" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
<children>
<ImageView fitHeight="326.0" fitWidth="883.0" layoutX="7.0" layoutY="134.0" pickOnBounds="true" preserveRatio="true" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<image>
<Image url="#http://www.lunapic.com/editor/premade/transparent.gif" />
</image>
</ImageView>
</children>
<cursor>
<Cursor fx:constant="DEFAULT" />
</cursor>
</fx:root>
FXML File ("MainScreen.fxml")
<?xml version="1.0" encoding="UTF-8"?>
<?import java.net.*?>
<?import javafx.geometry.*?>
<?import javafx.scene.image.*?>
<?import javafx.scene.control.*?>
<?import java.lang.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.layout.AnchorPane?>
<fx:root fx:id="pane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="720.0" prefWidth="1280.0" type="AnchorPane" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
<children>
<ImageView fitHeight="720.0" fitWidth="1280.0" pickOnBounds="true" preserveRatio="true" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<image>
<Image url="#http://i.telegraph.co.uk/multimedia/archive/03589/Wellcome_Image_Awa_3589699k.jpg" />
</image>
</ImageView>
<HBox spacing="100.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0">
<children>
<Button fx:id="button1" mnemonicParsing="false" onAction="#button1Press" prefHeight="45.0" prefWidth="1000.0" text="Singleplayer" />
<Button fx:id="button2" mnemonicParsing="false" onAction="#button2Press" prefHeight="45.0" prefWidth="1000.0" text="Multiplayer" />
<Button fx:id="button3" mnemonicParsing="false" onAction="#button3Press" prefHeight="45.0" prefWidth="1000.0" text="Settings" />
<Button fx:id="button4" mnemonicParsing="false" onAction="#button4Press" prefHeight="45.0" prefWidth="1000.0" text="Quit" />
</children>
<padding>
<Insets bottom="30.0" left="100.0" right="100.0" top="20.0" />
</padding>
</HBox>
<Region fx:id="region" prefHeight="15.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
</children>
</fx:root>
Solution (solved by James_D)
I added
.root {
-fx-background-color: transparent;
}
to the external style sheet and added stylesheets="#application.css" to the root node in the FXML file.
The default CSS style sheet for JavaFX, modena, applies a non-transparent color to the background of the root node. That's the color you're seeing when you display your main view.
The reason you don't see this in your first screen, or if you remove the buttons from the main screen, is that the default style sheet is only loaded the first time the Control class (or one of its subclasses) is instantiated. This is done to avoid the overhead of CSS processing for applications not needing it.
To fix, either add style="-fx-background-color: transparent;" to the root node in the FXML file, or add the rule
.root {
-fx-background-color: transparent ;
}
to the external style sheet.

Custom Control in javafx

I create a custom AnchorPane (ItemCard) in JavaFX to use it in another FXML file.
ItemCard.fxml file
<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?>
<?import javafx.scene.image.*?>
<?import javafx.scene.layout.*?>
<fx:root type="AnchorPane" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
<children>
<AnchorPane fx:id="ItemCardPane" prefHeight="360.0" prefWidth="266.0" stylesheets="#ItemCard.css" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
<ImageView fx:id="ItemCardView" fitHeight="399.0" fitWidth="245.0" layoutX="11.0" layoutY="6.0" pickOnBounds="true" preserveRatio="true" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" BorderPane.alignment="CENTER" />
</children>
</AnchorPane>
</children>
</fx:root>
the controller of ItemCard is:
import java.io.IOException;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.AnchorPane;
/**
*
* #author ola
*/
public class ItemCard extends AnchorPane {
#FXML
ImageView ItemCardView;
#FXML
AnchorPane ItemCardPane;
public ItemCard() {
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("ItemCard.fxml"));
fxmlLoader.setRoot(this);
fxmlLoader.setController(this);
try {
fxmlLoader.load();
} catch (IOException exception) {
throw new RuntimeException(exception);
}
}
public void setImage(Image image) {
ItemCardView.setImage(image);
// getChildren().add(ItemCardView);
}
}
i want to use this itemCard Anchore Pane in another fxml.
home.fxml
<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?>
<?import com.syrianep.reader.ui.KidsTheme.resources.*?>
<?import javafx.scene.layout.*?>
<AnchorPane fx:id="home" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="1000.0" prefWidth="1250.0" style="-fx-border-radius: 5; -fx-background-color: tranparant;" stylesheets="#mainView.css" AnchorPane.bottomAnchor="0" AnchorPane.leftAnchor="0" AnchorPane.rightAnchor="0" AnchorPane.topAnchor="0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml" fx:controller="com.syrianep.reader.ui.KidsTheme.resources.HomeController" >
<children>
<ItemCard layoutX="50.0" layoutY="50.0"AnchorPane.bottomAnchor="0" AnchorPane.leftAnchor="0"/>
</children>
</AnchorPane>
but the problem that when i open home.fxml using scene builder the itemCard is not viewed.
error is;
at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2617)

Categories

Resources