Progressbar Scene Builder - nullpointerexception

I found similar problem here but the solution for that didn't resolve my problem.
The link for the similar problem is here enter link description here.
Well about my problem, progressbar won't update when I click on the radio button.
my fxml file for that scene is here
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ProgressBar?>
<?import javafx.scene.control.RadioButton?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.text.Font?>
<?import javafx.scene.text.Text?>
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity"
minWidth="-Infinity" prefHeight="468.0" prefWidth="972.0" style="-fx-
background-color: #02b496;" xmlns="http://javafx.com/javafx/9.0.1"
xmlns:fx="http://javafx.com/fxml/1"
fx:controller="Controllers.RegisterController">
<children>
<ImageView fitHeight="497.0" fitWidth="972.0" opacity="0.68" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="#LogInPic.jpg" />
</image>
</ImageView>
<AnchorPane id="registration" fx:id="registration" layoutX="544.0" layoutY="49.0" opacity="0.91" prefHeight="357.0" prefWidth="359.0" style="-fx-background-color: orange;">
<children>
<Text layoutX="94.0" layoutY="44.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Sign Up" textAlignment="CENTER" wrappingWidth="133.5869140625">
<font>
<Font size="18.0" />
</font>
</Text>
<Text layoutX="30.0" layoutY="107.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Welcome to register pane " wrappingWidth="189.13671875">
<font>
<Font size="14.0" />
</font>
</Text>
<RadioButton fx:id="menadzer" layoutX="30.0" layoutY="195.0" mnemonicParsing="false" onAction="#handleMenadzerBtn" text="Manager" />
<RadioButton fx:id="kupac" layoutX="161.0" layoutY="195.0" mnemonicParsing="false" onAction="#handleKupacBtn" text="Customer" />
<Text layoutX="30.0" layoutY="146.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Before you start registration choose one of the following" wrappingWidth="226.283203125">
<font>
<Font size="14.0" />
</font>
</Text>
<Text layoutX="30.0" layoutY="257.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Registartion procces completion">
<font>
<Font size="14.0" />
</font>
</Text>
<Button layoutX="246.0" layoutY="270.0" mnemonicParsing="false" onAction="#handleBackBtn" prefHeight="17.0" prefWidth="92.0" style="-fx-background-color: #df8020;" text="Back">
<font>
<Font size="15.0" />
</font>
</Button>
<ProgressBar fx:id="pb" layoutX="30.0" layoutY="273.0"
opacity="0.57" prefHeight="24.0" prefWidth="200.0" progress="0.0" />
</children>
</AnchorPane>
</children>
</AnchorPane>
My controller class
In this class i am setting progress to my bar and its trowing me null pointer exception, i really cant find where the problem is so i need you help.
public class RegisterController implements Initializable {
#FXML
private ProgressBar pb;
#FXML
private void handleMenadzerBtn(ActionEvent event) throws IOException {
pb.setProgress(0.1);
long mTime = System.currentTimeMillis();
long end = mTime + 2000;
while (mTime < end) {
mTime = System.currentTimeMillis();
}
Parent root = FXMLLoader.load(getClass().getResource("/View/Home.fxml"));
Scene scene = new Scene(root);
Stage window = (Stage) ((Node) event.getSource()).getScene().getWindow();
window.setTitle("JavaFX and Maven");
window.setScene(scene);
window.show();
}
/**
* Initializes the controller class.
* #param url
* #param rb
*/
#Override
public void initialize(URL url, ResourceBundle rb) {
}
}
The error code i am gettig is here :
Exception in thread "JavaFX Application Thread" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1774)
at javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1657)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
at javafx.event.Event.fireEvent(Event.java:198)
at javafx.scene.Node.fireEvent(Node.java:8411)
at javafx.scene.control.ToggleButton.fire(ToggleButton.java:256)
at javafx.scene.control.RadioButton.fire(RadioButton.java:113)
at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:182)
at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:96)
at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:89)
at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
at javafx.event.Event.fireEvent(Event.java:198)
at javafx.scene.Scene$MouseHandler.process(Scene.java:3757)
at javafx.scene.Scene$MouseHandler.access$1500(Scene.java:3485)
at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1762)
at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2494)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:380)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:294)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$354(GlassViewEventHandler.java:416)
at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:415)
at com.sun.glass.ui.View.handleMouseEvent(View.java:555)
at com.sun.glass.ui.View.notifyMouse(View.java:937)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:71)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:275)
at javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1769)
... 49 more
Caused by: java.lang.NullPointerException
at Controllers.RegisterController.handleMenadzerBtn(RegisterController.java:41)
... 59 more
Feb 13, 2018 4:19:42 PM javafx.fxml.FXMLLoader$ValueElement processValue
WARNING: Loading FXML document with JavaFX API of version 9.0.1 by JavaFX
runtime of version 8.0.101
So if someone could help, i would be thankful, if you need some more material just ask.

You are facing the error at this line
pb.setProgress(0.1);
Because your ProgressBar is null. You have to initialize ProgressBar before using the object of ProgressBar.

Related

hello guys i'm trying to load an image viewer in javafx using intellij and scene builder the image shows in scene bulder it desnt show after running

this is the preview in scene builder
below is the fxml code
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.BorderPane?>
<BorderPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="452.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/18" xmlns:fx="http://javafx.com/fxml/1">
<center>
<ImageView fitHeight="187.0" fitWidth="372.0" pickOnBounds="true" preserveRatio="true" BorderPane.alignment="CENTER">
<image>
<Image url="#../../../../java/testImages/testImage.jpeg" />
</image>
</ImageView>
</center>
<bottom>
<Button mnemonicParsing="false" text="Button" BorderPane.alignment="CENTER" />
</bottom>
</BorderPane>
the image below is the executed code result where the image should appear
below is the java code
package com.ultijavafx.ultijavafx;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.stage.Stage;
import java.io.IOException;
public class jfx extends Application {
#Override
public void start(Stage stage) throws IOException {
FXMLLoader fxmlLoader = new FXMLLoader(jfx.class.getResource("javafxVeiw.fxml"));
Scene scene = new Scene(fxmlLoader.load(), 1500, 1000);
stage.setTitle("Hello!");
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
launch();
}
}
the image below is the resource structure

Errors when trying to extract jar file with java 8 from intellij

I am trying to extract a jar file with java 8 from IntelliJ using libraries of fontawesomefx-8.92, jfoenix and SQLite-JDBC-3.27.2.12, with this method :
File > Project Structure > artifacts > Add; and if I run the jar file from
out > artifacts > DemoCreditApp_jar > DemoCreditApp.jar , I encountered these errors :
Exception in Application start method java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown
Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(Unknown
Source)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(Unknown
Source)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown
Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at java.base/sun.launcher.LauncherHelper$FXHelper.main(Unknown Source) Caused by: java.lang.RuntimeException: Exception in
Application start method
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(Unknown
Source)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(Unknown
Source)
at java.base/java.lang.Thread.run(Unknown Source) Caused by: java.lang.NoClassDefFoundError:
com/sun/javafx/css/converters/PaintConverter
at com.jfoenix.controls.JFXTextField$StyleableProperties.<clinit>(JFXTextField.java:212)
at com.jfoenix.controls.JFXTextField.<init>(JFXTextField.java:163)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(Unknown
Source)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown
Source)
at java.base/java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.base/java.lang.Class.newInstance(Unknown Source)
at javafx.fxml/javafx.fxml.FXMLLoader$InstanceDeclarationElement.constructValue(Unknown
Source)
at javafx.fxml/javafx.fxml.FXMLLoader$ValueElement.processStartElement(Unknown
Source)
at javafx.fxml/javafx.fxml.FXMLLoader.processStartElement(Unknown Source)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml/javafx.fxml.FXMLLoader.load(Unknown Source)
at Views.Main.start(Main.java:27)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(Unknown
Source)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$11(Unknown
Source)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$9(Unknown
Source)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(Unknown
Source)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown
Source)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native
Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(Unknown
Source)
... 1 more Caused by: java.lang.ClassNotFoundException: com.sun.javafx.css.converters.PaintConverter
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown
Source)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown
Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
...23 more Exception running application Views.Main
I didn't understand what is meant by the error of the path, here is my code source of Main :
package Views;
import Controllers.PagePrincipaleController;
import Controllers.SqliteConnection;
import Controllers.Values;
import Models.Patient;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.control.TableView;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;
/**
* Created by Amine Daikha
*/
public class Main extends Application {
#Override
public void start(Stage primaryStage) throws Exception {
Values.sqliteConnection = new SqliteConnection();
Values.courentPatient = new Patient();
Values.tableInfo = new TableView<Patient>();
FXMLLoader fxmlLoader = new FXMLLoader(Main.class.getResource("PagePrincipaleView.fxml"));
AnchorPane pane = fxmlLoader.load();
PagePrincipaleController pagePrincipaleController = fxmlLoader.getController();
pagePrincipaleController.setMain(this);
//fxmlLoader = new FXMLLoader(new File("src/Views/PagePrincipaleView.fxml").toURI().toURL());
//Parent root = null;
//root = fxmlLoader.load(getClass().getResource("..\\Views\\PagePrincipaleView.fxml").openStream());
//Parent root = FXMLLoader.load(getClass().getResource("PagePrincipaleView.fxml"));
//Parent root = FXMLLoader.load(getClass().getResource("Views\\ScrollesPaneView.fxml"));
primaryStage.setTitle("Transactions Commerciales");
primaryStage.setScene(new Scene(pane, 1050, 570));
primaryStage.setMaxWidth(1065);
primaryStage.setMaxHeight(600);
primaryStage.show();
Values.pagePrincipaleSage = primaryStage;
}
public static void main(String[] args) {
launch(Main.class,args);
}
}
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.text.*?>
<?import com.jfoenix.controls.JFXTextField?>
<?import com.jfoenix.controls.JFXButton?>
<?import de.jensd.fx.glyphs.fontawesome.FontAwesomeIconView?>
<?import com.jfoenix.controls.JFXComboBox?>
<AnchorPane fx:id="pagePrincipale" prefHeight="550.0" prefWidth="1050.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="Controllers.PagePrincipaleController">
<children>
<TabPane prefHeight="570.0" prefWidth="1050.0" tabClosingPolicy="UNAVAILABLE">
<tabs>
<Tab text="CLIENTS">
<content>
<AnchorPane layoutX="-1.0" minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0">
<children>
<HBox layoutX="210.0" prefHeight="430.0" prefWidth="841.0">
<children>
<TableView fx:id="tableInfo" prefHeight="430.0" prefWidth="841.0">
<columns>
<TableColumn fx:id="idCol" prefWidth="150.0" text="Numéro de téléphone" />
<TableColumn fx:id="nomCol" prefWidth="158.0" text="Nom" />
<TableColumn fx:id="prenomCol" prefWidth="211.0" text="Prénom" />
<TableColumn fx:id="dateCol" prefWidth="163.0" text="Date de dernier opération" />
<TableColumn fx:id="prixColA" minWidth="4.0" prefWidth="157.0" text="Endettement actuel (DA)" />
</columns>
</TableView>
</children>
</HBox>
<VBox prefHeight="437.0" prefWidth="210.0">
<children>
<JFXTextField fx:id="rechercherClient" onAction="#rechercherClientAction" promptText="Rechercher un client">
<VBox.margin>
<Insets bottom="20.0" left="4.0" right="4.0" top="20.0" />
</VBox.margin>
</JFXTextField>
<Label prefHeight="35.0" prefWidth="210.0" text="Ajouter nouveau Client">
<VBox.margin>
<Insets bottom="25.0" top="20.0" />
</VBox.margin>
<font>
<Font size="18.0" />
</font>
<padding>
<Insets left="12.0" right="10.0" />
</padding>
</Label>
<JFXTextField fx:id="numTel" promptText="Numéro de téléphone">
<VBox.margin>
<Insets bottom="7.0" left="4.0" right="4.0" />
</VBox.margin>
</JFXTextField>
<Label fx:id="errLabelNumTel" textFill="#ee0a0a">
<VBox.margin>
<Insets bottom="15.0" left="13.0" right="4.0" />
</VBox.margin>
</Label>
<JFXTextField fx:id="nomClient" promptText="Nom">
<VBox.margin>
<Insets bottom="7.0" left="4.0" right="4.0" />
</VBox.margin>
</JFXTextField>
<Label fx:id="errLabelNom" textFill="#ee0a0a">
<VBox.margin>
<Insets bottom="15.0" left="13.0" right="4.0" />
</VBox.margin>
</Label>
<JFXTextField fx:id="prenomClient" layoutX="10.0" layoutY="90.0" promptText="Prénom">
<VBox.margin>
<Insets bottom="7.0" left="4.0" right="4.0" />
</VBox.margin>
</JFXTextField>
<Label fx:id="errLabelPrenom" textFill="#ee0a0a">
<VBox.margin>
<Insets bottom="15.0" left="13.0" right="4.0" />
</VBox.margin>
</Label>
<JFXTextField fx:id="prixInitialClient" promptText="Valeur de Credit">
<VBox.margin>
<Insets bottom="7.0" left="4.0" right="4.0" />
</VBox.margin>
</JFXTextField>
<Label fx:id="errLabelPrix" textFill="#ee0a0a">
<VBox.margin>
<Insets bottom="20.0" left="13.0" right="4.0" />
</VBox.margin>
</Label>
</children>
</VBox>
<JFXButton fx:id="effacerBtn" layoutX="830.0" layoutY="448.0" onAction="#effacer" prefHeight="40.0" prefWidth="190.0" style="-fx-background-color: #0fc4e4;" text="Effacer endettements" textFill="WHITE">
<font>
<Font name="System Bold" size="15.0" />
</font>
</JFXButton>
<JFXButton fx:id="modifierBtn" layoutX="530.0" layoutY="448.0" onAction="#modifier" prefHeight="40.0" prefWidth="190.0" style="-fx-background-color: #0fc4e4;" text="Modifier" textFill="WHITE">
<font>
<Font name="System Bold" size="15.0" />
</font>
</JFXButton>
<Label fx:id="errLabelClick" layoutX="526.0" layoutY="488.0" prefHeight="40.0" textFill="#bc0606">
<font>
<Font size="14.0" />
</font>
</Label>
<JFXButton fx:id="infoDetailleBtn" layoutX="226.0" layoutY="448.0" onAction="#infoDetaille" prefHeight="40.0" prefWidth="190.0" style="-fx-background-color: #0fc4e4;" text="Transactions" textFill="WHITE">
<font>
<Font name="System Bold" size="15.0" />
</font></JFXButton>
<JFXButton fx:id="ajouterClientBtn" layoutX="5.0" layoutY="424.0" onAction="#ajouterClient" prefHeight="38.0" prefWidth="195.0" style="-fx-background-color: #0e9615;" text="Ajouter" textFill="WHITE">
<font>
<Font name="System Bold" size="15.0" />
</font>
</JFXButton>
<FontAwesomeIconView glyphName="EDIT" layoutX="685.0" layoutY="475.0" size="18.0" text="" />
<FontAwesomeIconView fill="#dd0d0d" glyphName="REMOVE" layoutX="1003.0" layoutY="475.0" size="18.0" text="" />
<FontAwesomeIconView fill="WHITE" glyphName="PLUS" layoutX="154.0" layoutY="451.0" size="18.0" text="" wrappingWidth="23.142857551574707" />
<FontAwesomeIconView fill="#14860c" glyphName="ARROW_UP" layoutX="387.0" layoutY="470.0" />
<FontAwesomeIconView fill="#dd0d0d" glyphName="ARROW_DOWN" layoutX="376.0" layoutY="479.0" />
<FontAwesomeIconView fill="#dd0d0d" glyphName="POWER_OFF" layoutX="84.0" layoutY="518.0" onMousePressed="#ett" size="30.0" text="" wrappingWidth="20.714284896850586" />
<Label layoutX="906.0" layoutY="514.0" text="Amine DAIKHA © 2019" underline="true" />
</children>
</AnchorPane>
</content>
</Tab>
<Tab text="STATISTIQUES">
<content>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0">
<children>
<FontAwesomeIconView fill="#dd0d0d" glyphName="POWER_OFF" layoutX="84.0" layoutY="518.0" onKeyPressed="#ett" onMousePressed="#ett" size="30.0" text="" wrappingWidth="32.714284896850586" />
<Label layoutX="105.0" layoutY="25.0" text="Totale d'endettements: ">
<font>
<Font size="18.0" />
</font>
</Label>
<Label fx:id="totalEndettments" layoutX="310.0" layoutY="25.0" text="DA">
<font>
<Font size="18.0" />
</font>
</Label>
<Label layoutX="105.0" layoutY="93.0" text="les clients qui n'ont pas payé leurs endettements il y a : ">
<font>
<Font size="16.0" />
</font>
</Label>
<TableView fx:id="tableInfo1" layoutX="105.0" layoutY="130.0" prefHeight="113.0" prefWidth="841.0">
<columns>
<TableColumn fx:id="idCol1" prefWidth="150.0" text="Numéro de téléphone" />
<TableColumn fx:id="nomCol1" prefWidth="158.0" text="Nom" />
<TableColumn fx:id="prenomCol1" prefWidth="211.0" text="Prénom" />
<TableColumn fx:id="dateCol1" prefWidth="163.0" text="Date de dernier opération" />
<TableColumn fx:id="prixColA1" minWidth="4.0" prefWidth="157.0" text="Endettement actuel (DA)" />
</columns>
</TableView>
<TableView fx:id="tableInfo2" layoutX="105.0" layoutY="326.0" prefHeight="113.0" prefWidth="841.0">
<columns>
<TableColumn fx:id="idCol2" prefWidth="150.0" text="Numéro de téléphone" />
<TableColumn fx:id="nomCol2" prefWidth="158.0" text="Nom" />
<TableColumn fx:id="prenomCol2" prefWidth="211.0" text="Prénom" />
<TableColumn fx:id="dateCol2" prefWidth="163.0" text="Date de dernier opération" />
<TableColumn fx:id="prixColA2" minWidth="4.0" prefWidth="157.0" text="Endettement actuel (DA)" />
</columns>
</TableView>
<Label layoutX="105.0" layoutY="289.0" text="les clients qui leurs endettements passent : ">
<font>
<Font size="16.0" />
</font>
</Label>
<JFXComboBox fx:id="temps" layoutX="518.0" layoutY="93.0" />
<JFXComboBox fx:id="largent" layoutX="421.0" layoutY="289.0" />
<Label layoutX="906.0" layoutY="514.0" text="Amine DAIKHA © 2019" underline="true" />
</children></AnchorPane>
</content>
</Tab>
</tabs>
</TabPane>
</children>
</AnchorPane>
I have spent the whole day please guide me.

LoadException when trying to load new window fxml

I have javafx menu, I want to switch to another window. When I was using Java-8 everything worked, but now I switched to javafx-11 and java-11 and I cannot switch.
Switching code
AnchorPane pane = FXMLLoader.load(getClass().getResource("/main/main.fxml"), resources);
I was searching internet and stackoverflow and I tried following
1. In Inteliij idea I added all modules and libraries and applied the changes in Project Structure.
2. I added to src package module-info.java
3. I checked if fxml I am trying to load doesn´t contain any errors or unsed ids.
4. I checked names of controllers and fxmls I am trying to load
Code of the module-info.java
module duno {
requires javafx.fxml;
requires javafx.controls;
requires java.logging;
requires javafx.web;
opens main;
}
Code of the method from Controller which I am calling to get the Settings window
#FXML
void goto_settings(ActionEvent event) {
try {
ResourceBundle resources;
switch(settings.getLanguage().get(settings.getSelectedLanguage())) {
case "Czech":
resources = ResourceBundle.getBundle("/bundles/LangBundle_cz");
break;
default:
resources = ResourceBundle.getBundle("/bundles/LangBundle_en");
}
AnchorPane pane = load(getClass().getResource("/settings/settings.fxml"), resources);
rootpane.getChildren().setAll(pane);
} catch (IOException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
}
Settings Controller
package settings;
import duno.Serialization;
import duno.Settings;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.control.Alert;
import javafx.scene.control.CheckBox;
import javafx.scene.control.ComboBox;
import javafx.scene.layout.AnchorPane;
import javafx.stage.DirectoryChooser;
import main.Main;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.ResourceBundle;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* FXML Controller class
*
* #author Filip
*/
public class SettingsController implements Initializable {
#FXML
private AnchorPane rootpane;
#FXML
private ComboBox<String> adf_combobox;
#FXML
private ComboBox<String> pf_combobox;
#FXML
private CheckBox del_checkbox;
#FXML
private ComboBox<String> language_combobox;
private Settings settings;
/**
* Initializes the controller class.
*/
#Override
public void initialize(URL url, ResourceBundle rb) {
/*
Load old settings or create new if settings file doesnt exist
*/
Serialization ser = new Serialization();
String fileName = ser.getFolder() + "settings" + ser.getExt();
File f = new File(fileName);
if(f.exists() && !f.isDirectory()) {
try {
Settings oldSettings = (Settings) ser.deserialize("settings");
settings = oldSettings;
} catch (IOException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
} else {
settings = new Settings();
}
/*
Setup the GUI
*/
adf_combobox.getItems().addAll(settings.getActiveDownloadFolder());
adf_combobox.getSelectionModel().select(settings.getSelectedActiveDownloadFolder());
pf_combobox.getItems().addAll(settings.getPreferredFormat());
pf_combobox.getSelectionModel().select(settings.getSelectedPreferredFormat());
del_checkbox.setSelected(settings.isDownloadEntireList());
language_combobox.getItems().addAll(settings.getLanguage());
language_combobox.getSelectionModel().select(settings.getSelectedLanguage());
}
#FXML
void addNewDownloadFolder(ActionEvent event) {
DirectoryChooser directoryChooser = new DirectoryChooser();
File selectedDirectory = directoryChooser.showDialog(rootpane.getScene().getWindow());
if(selectedDirectory == null){
// Nothing was selected
} else{
settings.addActiveDownloadFolder(selectedDirectory.getAbsolutePath());
System.out.println(settings.getActiveDownloadFolder().toString());
adf_combobox.getItems().setAll(settings.getActiveDownloadFolder());
}
}
#FXML
void removeSelectedDownloadFolder(ActionEvent event) {
if(adf_combobox.getItems().size() <= 1) {
Alert alert = new Alert(Alert.AlertType.WARNING);
alert.setTitle("Warning Dialog");
alert.setHeaderText("You can´t remove this download folder");
alert.setContentText("You can´t remove all download folders");
alert.showAndWait();
} else {
int item = adf_combobox.getSelectionModel().getSelectedIndex();
settings.removeActiveDownloadFolder(item);
adf_combobox.getItems().setAll(settings.getActiveDownloadFolder());
adf_combobox.getSelectionModel().selectFirst();
}
}
#FXML
void saveSettings(ActionEvent event) {
settings.setSelectedActiveDownloadFolder(adf_combobox.getSelectionModel().getSelectedIndex());
settings.setSelectedPreferredFormat(pf_combobox.getSelectionModel().getSelectedIndex());
settings.setDownloadEntireList(del_checkbox.isSelected());
settings.setSelectedLanguage(language_combobox.getSelectionModel().getSelectedIndex());
System.out.println(settings.getLanguage().get(settings.getSelectedLanguage()));
Serialization ser = new Serialization();
String fileName = ser.getFolder() + "settings" + ser.getExt();
File f = new File(fileName);
if(f.delete()) {
System.out.println("File deleted");
ser.serialize(settings, "settings");
} else {
System.out.println("Settings file not deleted");
}
}
#FXML
void gotoDownloads(ActionEvent event) {
try {
ResourceBundle resources;
switch(settings.getLanguage().get(settings.getSelectedLanguage())) {
case "Czech":
resources = ResourceBundle.getBundle("bundles/LangBundle_cz");
break;
default:
resources = ResourceBundle.getBundle("bundles/LangBundle_en");
}
AnchorPane pane = FXMLLoader.load(getClass().getResource("/main/main.fxml"), resources);
rootpane.getChildren().setAll(pane);
} catch (IOException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
Settings fxml
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.CheckBox?>
<?import javafx.scene.control.ComboBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.Menu?>
<?import javafx.scene.control.MenuBar?>
<?import javafx.scene.control.MenuItem?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.RowConstraints?>
<AnchorPane id="AnchorPane" fx:id="rootpane" minHeight="800.0" minWidth="1000.0" prefHeight="800.0" prefWidth="1000.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="settings.SettingsController">
<children>
<GridPane AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<MenuBar>
<menus>
<Menu mnemonicParsing="false" onAction="#gotoDownloads" text="Download">
<items>
<MenuItem mnemonicParsing="false" onAction="#gotoDownloads" text="Download" />
</items>
</Menu>
<Menu mnemonicParsing="false" text="Settings">
<items>
<MenuItem mnemonicParsing="false" text="Settings" />
</items>
</Menu>
</menus>
</MenuBar>
<GridPane GridPane.rowIndex="1">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="443.79998779296875" minWidth="10.0" prefWidth="272.8000244140625" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="561.4000396728516" minWidth="10.0" prefWidth="303.1999755859375" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="737.199951171875" minWidth="10.0" prefWidth="289.60002441406255" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="575.4000244140625" minWidth="10.0" prefWidth="121.20002441406245" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" />
<RowConstraints minHeight="10.0" prefHeight="30.0" />
<RowConstraints minHeight="10.0" prefHeight="30.0" />
<RowConstraints minHeight="10.0" prefHeight="30.0" />
<RowConstraints minHeight="10.0" prefHeight="30.0" />
</rowConstraints>
<children>
<Label text="%active_download_folder_text" />
<ComboBox fx:id="adf_combobox" prefHeight="26.0" prefWidth="294.0" GridPane.columnIndex="1" />
<HBox prefHeight="100.0" prefWidth="200.0" GridPane.columnIndex="2">
<children>
<Button mnemonicParsing="false" onAction="#addNewDownloadFolder" text="%add_new_active_download_folder_button_text" />
<Button mnemonicParsing="false" onAction="#removeSelectedDownloadFolder" text="%remove_selected_active_download_folder_button_text" />
</children>
<padding>
<Insets top="5.0" />
</padding>
</HBox>
<Label text="%preferred_format_text" GridPane.rowIndex="1" />
<ComboBox fx:id="pf_combobox" prefHeight="26.0" prefWidth="114.0" GridPane.columnIndex="1" GridPane.rowIndex="1" />
<HBox prefHeight="100.0" prefWidth="200.0" GridPane.columnIndex="2" GridPane.rowIndex="1">
<opaqueInsets>
<Insets top="5.0" />
</opaqueInsets>
<padding>
<Insets top="5.0" />
</padding>
</HBox>
<Label text="%always_download_entire_list_text" GridPane.rowIndex="2" />
<CheckBox fx:id="del_checkbox" mnemonicParsing="false" GridPane.columnIndex="1" GridPane.rowIndex="2" />
<Label text="%language_text" GridPane.rowIndex="3" />
<ComboBox fx:id="language_combobox" prefHeight="26.0" prefWidth="162.0" GridPane.columnIndex="1" GridPane.rowIndex="3" />
<HBox prefHeight="100.0" prefWidth="200.0" GridPane.columnIndex="2" GridPane.rowIndex="3">
<padding>
<Insets top="5.0" />
</padding>
</HBox>
<Button mnemonicParsing="false" onAction="#saveSettings" text="%save_button_text" GridPane.columnIndex="3" GridPane.rowIndex="4" />
</children>
<padding>
<Insets left="20.0" top="10.0" />
</padding>
</GridPane>
</children>
</GridPane>
</children>
</AnchorPane>
It should load settings window as it did in java-8 but now I got and error
Run log
"C:\Program Files\Java\jdk-11.0.3\bin\java.exe" --add-modules javafx.base,javafx.graphics --add-reads javafx.base=ALL-UNNAMED --add-reads javafx.graphics=ALL-UNNAMED "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2019.1.1\lib\idea_rt.jar=50856:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2019.1.1\bin" -Dfile.encoding=UTF-8 -p C:\Users\Filip\Documents\javafx-sdk-11.0.2\lib\javafx.base.jar;C:\Users\Filip\Documents\javafx-sdk-11.0.2\lib\javafx.graphics.jar;E:\duno\out\production\duno;C:\Users\Filip\Documents\javafx-sdk-11.0.2\lib\javafx-swt.jar;C:\Users\Filip\Documents\javafx-sdk-11.0.2\lib\javafx.controls.jar;C:\Users\Filip\Documents\javafx-sdk-11.0.2\lib\javafx.fxml.jar;C:\Users\Filip\Documents\javafx-sdk-11.0.2\lib\javafx.media.jar;C:\Users\Filip\Documents\javafx-sdk-11.0.2\lib\javafx.swing.jar;C:\Users\Filip\Documents\javafx-sdk-11.0.2\lib\javafx.web.jar -m duno/main.Main
English
kvě 10, 2019 10:57:10 DOP. main.Controller goto_settings
SEVERE: null
javafx.fxml.LoadException:
/E:/duno/out/production/duno/settings/settings.fxml:17
at javafx.fxml/javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2625)
at javafx.fxml/javafx.fxml.FXMLLoader.access$700(FXMLLoader.java:105)
at javafx.fxml/javafx.fxml.FXMLLoader$ValueElement.processAttribute(FXMLLoader.java:943)
at javafx.fxml/javafx.fxml.FXMLLoader$InstanceDeclarationElement.processAttribute(FXMLLoader.java:980)
at javafx.fxml/javafx.fxml.FXMLLoader$Element.processStartElement(FXMLLoader.java:227)
at javafx.fxml/javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:752)
at javafx.fxml/javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2722)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2552)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2466)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3237)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3194)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3163)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3136)
at javafx.fxml/javafx.fxml.FXMLLoader.load(FXMLLoader.java:3128)
at duno/main.Controller.goto_settings(Controller.java:184)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at com.sun.javafx.reflect.Trampoline.invoke(MethodUtil.java:76)
at jdk.internal.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at javafx.base/com.sun.javafx.reflect.MethodUtil.invoke(MethodUtil.java:273)
at javafx.fxml/com.sun.javafx.fxml.MethodHelper.invoke(MethodHelper.java:83)
at javafx.fxml/javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1782)
at javafx.fxml/javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1670)
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.ContextMenuContent$MenuItemContainer.doSelect(ContextMenuContent.java:1380)
at javafx.controls/com.sun.javafx.scene.control.ContextMenuContent$MenuItemContainer.lambda$createChildren$12(ContextMenuContent.java:1333)
at javafx.base/com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)
at javafx.base/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
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.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
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.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
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.graphics/javafx.scene.Scene$MouseHandler.process(Scene.java:3851)
at javafx.graphics/javafx.scene.Scene$MouseHandler.access$1200(Scene.java:3579)
at javafx.graphics/javafx.scene.Scene.processMouseEvent(Scene.java:1849)
at javafx.graphics/javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2588)
at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:397)
at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:295)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$2(GlassViewEventHandler.java:434)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:390)
at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:433)
at javafx.graphics/com.sun.glass.ui.View.handleMouseEvent(View.java:556)
at javafx.graphics/com.sun.glass.ui.View.notifyMouse(View.java:942)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.IllegalAccessException: class javafx.fxml.FXMLLoader$ValueElement (in module javafx.fxml) cannot access class settings.SettingsController (in module duno) because module duno does not export settings to module javafx.fxml
at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:361)
at java.base/jdk.internal.reflect.Reflection.ensureMemberAccess(Reflection.java:99)
at java.base/java.lang.Class.newInstance(Class.java:579)
at javafx.fxml/javafx.fxml.FXMLLoader$ValueElement.processAttribute(FXMLLoader.java:936)
... 66 more
Don´t mind the English in the output it´s just the language used in app
I figured it out on my own.
Here is how I proceeded.
I read the error several times, and then I though it need to export something. So I found that module info have exports something to something. So I added exports settings to javafx.fxml.
Another problem that I could not access settings because rootpane was private and settings were not opened. So I tried open settings; and it works :)
So here is final version
module duno {
requires javafx.fxml;
requires javafx.controls;
requires java.logging;
requires javafx.web;
exports settings to javafx.fxml;
opens main;
opens settings;
}
I hope it helps someone in future with same error

Is it possible to bind the size of an accordion dynamically to the size of the expanded titled pane in JavaFX-8?

Such as the title suggests, i'm trying to bind the size of an Accordion dynamically to the size of the expanded TitledPane.
I tried to add an ChangeListener to the expandedPaneProperty of the accordion in the initialize method of the controller for the UI which contains the Accordion using following code:
private double prefHeight, prefWidth;
#Override
public void initialize(URL location, ResourceBundle resources) {
prefHeight = acc.getPrefHeight(); //double variables of controller
prefWidth = acc.getPrefWidth();
acc.expandedPaneProperty().addListener(new ChangeListener<Object>(){
#Override
public void changed(ObservableValue<? extends Object> observable, Object oldValue, Object newValue) {
TitledPane pane = acc.getExpandedPane();
if(pane != null){
acc.setPrefHeight(prefHeight + pane.getPrefHeight());
acc.setPrefWidth(prefWidth + pane.getPrefWidth());
}
}
});
}
The Problem is, that this code leads to a NullPointerException at line 3, which might indicate that the property might not be instatiated at this moment.
Update: Problem concerning NullPointerException was solved, i didn't initialized the Accordion properly.
The code is still not working, though.
The corresponding FXML:
<Accordion fx:id="acc" xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1" fx:controller="application.SettingsController">
<panes>
<TitledPane alignment="TOP_LEFT" animated="false" text="Alarm sound">
<tooltip>
<Tooltip text="Enables to choose an alarm sound." />
</tooltip>
<content>
<VBox alignment="TOP_CENTER" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" styleClass="box">
<children>
<HBox alignment="TOP_CENTER" styleClass="hbox">
<children>
<Button mnemonicParsing="false" text="Reset to default" />
<Button mnemonicParsing="false" onAction="#saveAndExitOnClick" text="Save and exit" />
</children>
</HBox>
<ListView maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" VBox.vgrow="ALWAYS" />
</children>
</VBox>
</content></TitledPane>
<TitledPane animated="false" text="Style">
<tooltip>
<Tooltip text="Enables to choose a style for the program." />
</tooltip>
<content>
<VBox maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" styleClass="box">
<children>
<HBox alignment="TOP_CENTER" styleClass="h-box">
<children>
<Button mnemonicParsing="false" text="Reset to default" />
<Button mnemonicParsing="false" onAction="#saveAndExitOnClick" text="Save and exit" />
</children>
</HBox>
<ListView maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" />
</children>
</VBox>
</content></TitledPane>
<TitledPane animated="false" text="Language">
<tooltip>
<Tooltip text="Enables to choose a style for the program." />
</tooltip>
<content>
<VBox maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" styleClass="box">
<children>
<HBox alignment="TOP_CENTER">
<children>
<Button mnemonicParsing="false" text="Reset to default" />
<Button mnemonicParsing="false" onAction="#saveAndExitOnClick" text="Save and exit" />
</children>
</HBox>
<ListView maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" />
</children>
</VBox>
</content>
</TitledPane>
<TitledPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" styleClass="box" text="Other settings">
<content>
<ToolBar maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" orientation="VERTICAL" styleClass="box">
<items>
<Button contentDisplay="CENTER" maxWidth="1.7976931348623157E308" mnemonicParsing="false" text="Recenter Window" />
<Button maxWidth="1.7976931348623157E308" mnemonicParsing="false" text="Reset program to default settings" />
<Button maxWidth="1.7976931348623157E308" mnemonicParsing="false" text="Load custom alarm sound" />
<Button maxWidth="1.7976931348623157E308" mnemonicParsing="false" text="Apply custom style" />
</items>
</ToolBar>
</content>
</TitledPane>
<TitledPane maxHeight="1.7976931348623157E308" prefWidth="200.0" text="About">
<content>
<TextArea editable="false" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" text="Timer Program, written by QBW.
Version:
Fonts:
Font Awesome, License:
Alarm sounds:
Acknowledgement:
·Hans-Peter Habelitz for "Programmieren lernen mit Java"
·Christian Ullenboom for "Java ist auch eine Insel" and "Java SE8 Standardbibliothek"
·Anton Epple for "JavaFX 8 - Grundlagen und fortgeschrittene Techniken"
·The stackoverflow.com community
· Creators of alarm sound files:
·
·
·
·
·
· Creators of Font awesome
" wrapText="true" />
</content>
<tooltip>
<Tooltip text="Contains information about the program, its creator and license information" />
</tooltip>
</TitledPane>
</panes>
</Accordion>
How is it possible to solve that problem?

Parallel Fade State Transition Not Playing

This is an old issue, but it's recently come up again; and this time it refuses to work itself out. The problem: When I click on "Forgot Password" the program instantly changes states, without playing the transition.
Transition Code:
<s:Transition toState="LoginForgotPassword" fromState="*" autoReverse="true">
<s:Parallel targets="{[loginExisting, passwordGroup, loginNew, whyTextLink, loginForgot]}">
<s:Fade duration="500" hideFocusRing="true"/>
</s:Parallel>
</s:Transition>
Effected Targets:
<s:states>
<s:State name="LoginMain"/>
<s:State name="LoginForgotPassword"/>
<s:State name="LoginRegister"/>
</s:states>
<s:Panel id="loginWizard" width="546" height="308" horizontalCenter="0" verticalCenter="0"
title.LoginMain="Log-in or create account" title.LoginForgotPassword="Forgot Password"
title.LoginRegister="New user registration">
<s:VGroup width="100%" height="80%" horizontalAlign="center" verticalAlign="middle">
<s:VGroup width="90%" height="85%">
<s:RadioButton id="loginExisting"
label="I'm already a member and I want to login with my Tarrigato account."
groupName="loginMethod" alpha.LoginForgotPassword="0.0"
visible.LoginRegister="false"/>
<s:HGroup width="100%" height="40" horizontalAlign="center">
<s:HGroup width="80%" height="40">
<s:Label height="40" fontSize="15" width="100" text="Username: " verticalAlign="middle"/>
<s:TextInput id="loginUsername" width="300" height="40" focusIn="loginFocusInHandler(event)"/>
</s:HGroup>
</s:HGroup>
<s:HGroup width="100%" height="40" horizontalAlign="center" id="passwordGroup" alpha.LoginForgotPassword="0.0">
<s:HGroup width="80%" height="40">
<s:Label height="40" fontSize="15" width="100" text="Password:" verticalAlign="middle"/>
<s:TextInput id="loginPassword" displayAsPassword="true" width="300"
focusIn="loginFocusInHandler(event)" height="40"/>
</s:HGroup>
</s:HGroup>
<s:HGroup includeIn="LoginRegister" width="100%" height="40" horizontalAlign="center">
<s:HGroup width="80%" height="40">
<s:Label height="40" fontSize="15" width="100" text="Email:" verticalAlign="middle"/>
<s:TextInput id="loginEmail" width="300" height="40"/>
</s:HGroup>
</s:HGroup>
<s:HGroup includeIn="LoginRegister" width="100%" height="20" horizontalAlign="center">
<s:HGroup width="80%" height="20">
<s:CheckBox id="acceptedRules" label="I accept the Tarrigato Rules & Regulations"/>
</s:HGroup>
</s:HGroup>
<s:Spacer height="15"/>
<s:RadioButton id="loginNew"
label="I'm a new member and I want to create a new Tarrigato account now."
groupName="loginMethod" selected="true" alpha.LoginForgotPassword="0.0"
visible.LoginRegister="false" includeInLayout.LoginRegister="false"/>
<mx:LinkButton id="whyTextLink"
label="Want to know why you need a Kommunicate account?"
click="whyPanel.visible = true;" color="#B8B8B8"
textDecoration="underline" alpha.LoginForgotPassword="0.0"
visible.LoginRegister="false" includeInLayout.LoginRegister="false"/>
</s:VGroup>
</s:VGroup>
<mx:HRule y="218" width="100%"/>
<s:Button id="loginForgot" left="7" bottom="7" label="Forgot Password?"
click="currentState = "LoginForgotPassword";"
alpha.LoginForgotPassword="0.0"
visible.LoginRegister="false"/>
<s:Button id="loginCancel" right="126" bottom="7" label="Cancel"
click="currentState = "LoginMain";"
enabled.LoginMain="false"/>
<s:Button id="loginContinue" right="7" width="115" bottom="7" label="Continue"
click="loginContinue_clickHandler(event)"/>
</s:Panel>
You have placed the <s:transition> in <fx:Declarations> - it should be within <s:transitions>.
You have:
<fx:Declarations>
<s:Transition toState="LoginForgotPassword" fromState="*" autoReverse="true">
<s:Parallel targets="{[loginExisting, passwordGroup, loginNew, whyTextLink, loginForgot]}">
<s:Fade duration="500" hideFocusRing="true"/>
</s:Parallel>
</s:Transition>
</fx:Declarations>
This should be implemented as:
<s:transitions>
<s:Transition toState="LoginForgotPassword" fromState="*" autoReverse="true">
<s:Parallel targets="{[loginExisting, passwordGroup, loginNew, whyTextLink, loginForgot]}">
<s:Fade duration="500" hideFocusRing="true"/>
</s:Parallel>
</s:Transition>
</s:transitions>
Use the transitions array outside of declarations.
Beyond that, the only change I made was placing the id of "passwordGroup" in the HGroup that contains the password Label and TextInput. You only had the password TextInput in the targets of the transition and did not include an alpha state for the TextInput.
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
minWidth="955"
minHeight="600"
currentState="LoginMain">
<s:states>
<s:State name="LoginForgotPassword" />
<s:State name="LoginMain" />
</s:states>
<s:transitions>
<s:Transition toState="*"
fromState="*"
autoReverse="true">
<s:Parallel targets="{[loginExisting, passwordGroup, loginNew, whyTextLink, loginForgot]}">
<s:Fade duration="500" />
</s:Parallel>
</s:Transition>
</s:transitions>
<s:Panel id="loginWizard"
width="546"
height="308"
horizontalCenter="0"
title="Log-in or create account"
title.LoginForgotPassword="Forgot Password"
verticalCenter="-0">
<s:VGroup width="100%"
height="80%"
horizontalAlign="center"
verticalAlign="middle">
<s:VGroup width="90%"
height="75%">
<s:RadioButton id="loginExisting"
label="I'm already a member and I want to login with my Tarrigato account."
groupName="loginMethod"
alpha.LoginForgotPassword="0.0" />
<s:HGroup width="100%"
height="40"
horizontalAlign="center">
<s:HGroup width="80%"
height="40">
<s:Label height="40"
fontSize="15"
width="100"
text="Username: "
verticalAlign="middle" />
<!-- unknown reference: focusIn="loginFocusInHandler(event)" -->
<s:TextInput id="loginUsername"
width="300"
height="40" />
</s:HGroup>
</s:HGroup>
<s:HGroup id="passwordGroup"
alpha.LoginForgotPassword="0.0"
width="100%"
height="40"
horizontalAlign="center">
<s:HGroup width="80%"
height="40">
<s:Label height="40"
fontSize="15"
width="100"
text="Password:"
verticalAlign="middle" />
<!-- unknown reference: focusIn="loginFocusInHandler(event)" -->
<s:TextInput id="loginPassword"
displayAsPassword="true"
width="300"
height="40"
left="4" />
</s:HGroup>
</s:HGroup>
<s:Spacer height="15" />
<s:RadioButton id="loginNew"
label="I'm a new member and I want to create a new Tarrigato account now."
groupName="loginMethod"
selected="true"
alpha.LoginForgotPassword="0.0" />
<!-- unknown reference: click="whyPanel.visible = true;" -->
<mx:LinkButton id="whyTextLink"
label="Want to know why you need a Kommunicate account?"
color="#B8B8B8"
textDecoration="underline"
alpha.LoginForgotPassword="0.0" />
</s:VGroup>
</s:VGroup>
<mx:HRule y="218"
width="100%" />
<s:Button id="loginForgot"
left="7"
bottom="7"
label="Forgot Password?"
alpha.LoginForgotPassword="0.0"
click="currentState = 'LoginForgotPassword';" />
<s:Button id="loginCancel"
right="127"
bottom="7"
label="Cancel"
click="currentState = 'LoginMain';"
enabled.LoginMain="false" />
<s:Button id="loginContinue"
right="7"
bottom="7"
label="Continue" />
</s:Panel>
</s:Application>