Beginner needs some help [message #1805111] |
Sun, 07 April 2019 14:56  |
Eclipse User |
|
|
|
I am trying to learn using JavaFX. I am running a clean install of Eclipse Java 03-019 with Java JDK 11.02 from Oracle, ava JRE 11 from Oracle, javafx-sdk-11.0.2 from Gluon, SceneBuilder 11.0.1.0 from Gluon and e(fx)clipse 3.5.
I made it to create a JavaFX project and link with SceneBuilder. There I created two buttons and a TextField controls, and a MyController class. My Main program includes the following:
Parent root = FXMLLoader.load(getClass().getResource("sample1.fxml"));
When I run it I got errors, including
Exception in Application start method
java.lang.reflect.InvocationTargetException
at .....
Caused by: javafx.fxml.LoadException:
/C:/Users/msime/eclipse-workspace-2019/FXTest1/bin/application/sample1.fxml
....
Caused by: java.lang.ClassNotFoundException: com.gluonhq.charm.glisten.control.TextField
I do not know how to fix the TextField !!!
==================
below is a copy of the fxml file:
<?xml version="1.0" encoding="UTF-8"?>
<?import com.gluonhq.charm.glisten.control.TextField?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.text.Font?>
<AnchorPane prefHeight="400.0" prefWidth="500.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="application.MyController">
<children>
<Button id="HelloBtn" fx:id="helloBtn" contentDisplay="CENTER" layoutX="35.0" layoutY="35.0" mnemonicParsing="false" onAction="#sayHello" prefHeight="61.0" prefWidth="112.0" text="Hello" textAlignment="CENTER">
<font>
<Font size="20.0" />
</font>
</Button>
<Button id="ShowBtn" fx:id="showDTimeBtn" layoutX="355.0" layoutY="35.0" mnemonicParsing="false" onAction="#showDateTime" prefHeight="61.0" prefWidth="112.0" text="Sow Date Time">
<font>
<Font size="14.0" />
</font>
</Button>
<TextField fx:id="dateTimeTextField" layoutX="180.0" layoutY="180.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="35.0" prefWidth="140.0" />
</children>
</AnchorPane>
|
|
|
Re: Beginner needs some help [message #1805171 is a reply to message #1805111] |
Tue, 09 April 2019 08:36   |
Eclipse User |
|
|
|
You could change <?import com.gluonhq.charm.glisten.control.TextField?> to <?import javafx.scene.control.TextField?> using the default JavaFX textfield or you need to put the Gluon Charm library on the classpath (or module path).
|
|
|
|
Powered by
FUDForum. Page generated in 0.03073 seconds