简体   繁体   English

如何将 Gluon Charms 与 JavaFX 一起使用?

[英]How can I use Gluon Charms with JavaFX?

I am new at Java or JavaFX, but I am making a JavaFX desktop application.我是 Java 或 JavaFX 的新手,但我正在制作 JavaFX 桌面应用程序。 In Intellij, I created the project under JavaFX category.在 Intellij 中,我在 JavaFX 类别下创建了项目。 I am using JDK-15.我正在使用 JDK-15。

https://i.stack.imgur.com/jFZK7.png https://i.stack.imgur.com/jFZK7.png

Then, with FXML, using scenebuilder as editor for the FXML file, I am making the project.然后,使用 FXML,使用 scenebuilder 作为 FXML 文件的编辑器,我正在制作项目。 I am already using jfoenix library with JavaFX.我已经在使用带有 JavaFX 的 jfoenix 库。 Now, I want to implement feature like CARDPANE that is in gluon library in my project.现在,我想在我的项目中实现gluon库中的 CARDPANE 之类的功能。 I tried to add gluon charms glisten - 4.4.1 from dependencies.我尝试从依赖项中添加 gluon charms glisten - 4.4.1。

https://i.stack.imgur.com/MWzpR.png https://i.stack.imgur.com/MWzpR.png

I guess what's left is to add something in VM options in configuration of RUN, I really don't know what to add in VM options.我想剩下的就是在 RUN 配置中的 VM 选项中添加一些东西,我真的不知道在 VM 选项中添加什么。 When I try to run the project there is an error, I cannot find any solution to this.当我尝试运行项目时出现错误,我找不到任何解决方案。

My FXML Code:我的 FXML 代码:

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

<?import com.gluonhq.charm.glisten.control.CardPane?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.layout.AnchorPane?>

<AnchorPane prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="Practice.Practice_Controller">
   <children>
      <CardPane fx:id="cardPane" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="0.0">
         <items>
            <Button fx:id="addButton" mnemonicParsing="false" onAction="#handle" prefHeight="32.0" prefWidth="239.0" text="Button" />
         </items>
      </CardPane>
   </children>
</AnchorPane>

The error that is shown:显示的错误:

"C:\Program Files\Java\jdk-15.0.1\bin\java.exe" --module-path "C:\Program Files\Java\javafx-sdk-15.0.1\lib" --add-modules=javafx.base --add-modules=javafx.controls --add-modules=javafx.fxml --add-modules=javafx.graphics --add-modules=javafx.media --add-modules=javafx.swing --add-modules=javafx.web --add-opens javafx.base/com.sun.javafx.runtime=ALL-UNNAMED --add-opens javafx.controls/com.sun.javafx.scene.control.behavior=ALL-UNNAMED --add-opens javafx.controls/com.sun.javafx.scene.control=ALL-UNNAMED --add-opens javafx.base/com.sun.javafx.binding=ALL-UNNAMED --add-opens javafx.base/com.sun.javafx.event=ALL-UNNAMED --add-opens javafx.graphics/com.sun.javafx.stage=ALL-UNNAMED "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA Ultimate Edition 2020.3\lib\idea_rt.jar=56278:C:\Program Files\JetBrains\IntelliJ IDEA Ultimate Edition 2020.3\bin" -Dfile.encoding=UTF-8 -classpath "E:\Documents\Arnob\Assignment\CSE 4402\JAVAFX\out\production\JAVAFX;C:\Program Files\Java\javafx-sdk-15.0.1\lib\src.zip;C:\Program Files\Java\javafx-sdk-15.0.1\lib\javafx-swt.jar;C:\Program Files\Java\javafx-sdk-15.0.1\lib\javafx.web.jar;C:\Program Files\Java\javafx-sdk-15.0.1\lib\javafx.base.jar;C:\Program Files\Java\javafx-sdk-15.0.1\lib\javafx.fxml.jar;C:\Program Files\Java\javafx-sdk-15.0.1\lib\javafx.media.jar;C:\Program Files\Java\javafx-sdk-15.0.1\lib\javafx.swing.jar;C:\Program Files\Java\javafx-sdk-15.0.1\lib\javafx.controls.jar;C:\Program Files\Java\javafx-sdk-15.0.1\lib\javafx.graphics.jar;E:\Documents\Arnob\Assignment\CSE 4402\JAVAFX\src\Lab06_1B\jfoenix-9.0.10.jar;E:\Documents\Arnob\Project\CSE 4402\MEDI-COLLAB\src\Resources\charm-glisten-4.4.1.jar" Practice.Main
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(NativeMethodAccessorImpl.java:64)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:464)
    at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:363)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1071)
Caused by: java.lang.RuntimeException: Exception in Application start method
    at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:900)
    at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
    at java.base/java.lang.Thread.run(Thread.java:832)
Caused by: java.lang.IllegalAccessError: class com.gluonhq.impl.charm.a.b.b.c.b (in unnamed module @0x28bbe400) cannot access class com.sun.javafx.collections.SourceAdapterChange (in module javafx.base) because module javafx.base does not export com.sun.javafx.collections to unnamed module @0x28bbe400
    at com.gluonhq.impl.charm.a.b.b.c.b.sourceChanged(SourceFile:106)
    at javafx.base/javafx.collections.transformation.TransformationList.lambda$getListener$0(TransformationList.java:106)
    at javafx.base/javafx.collections.WeakListChangeListener.onChanged(WeakListChangeListener.java:88)
    at javafx.base/com.sun.javafx.collections.ListListenerHelper$SingleChange.fireValueChangedEvent(ListListenerHelper.java:164)
    at javafx.base/com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(ListListenerHelper.java:73)
    at javafx.base/javafx.collections.ObservableListBase.fireChange(ObservableListBase.java:233)
    at javafx.base/javafx.collections.transformation.SortedList.sourceChanged(SortedList.java:114)
    at javafx.base/javafx.collections.transformation.TransformationList.lambda$getListener$0(TransformationList.java:106)
    at javafx.base/javafx.collections.WeakListChangeListener.onChanged(WeakListChangeListener.java:88)
    at javafx.base/com.sun.javafx.collections.ListListenerHelper$Generic.fireValueChangedEvent(ListListenerHelper.java:329)
    at javafx.base/com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(ListListenerHelper.java:73)
    at javafx.base/javafx.collections.ObservableListBase.fireChange(ObservableListBase.java:233)
    at javafx.base/javafx.collections.ListChangeBuilder.commit(ListChangeBuilder.java:482)
    at javafx.base/javafx.collections.ListChangeBuilder.endChange(ListChangeBuilder.java:541)
    at javafx.base/javafx.collections.ObservableListBase.endChange(ObservableListBase.java:205)
    at javafx.base/javafx.collections.ModifiableObservableListBase.setAll(ModifiableObservableListBase.java:90)
    at javafx.base/javafx.beans.binding.ListExpression.setAll(ListExpression.java:378)
    at javafx.base/com.sun.javafx.binding.ContentBinding.bind(ContentBinding.java:53)
    at javafx.base/javafx.beans.binding.Bindings.bindContent(Bindings.java:1132)
    at com.gluonhq.impl.charm.a.b.b.g.<init>(SourceFile:41)
    at com.gluonhq.charm.glisten.control.CardPane.createDefaultSkin(SourceFile:95)
    at javafx.controls/javafx.scene.control.Control.doProcessCSS(Control.java:897)
    at javafx.controls/javafx.scene.control.Control$1.doProcessCSS(Control.java:89)
    at javafx.controls/com.sun.javafx.scene.control.ControlHelper.processCSSImpl(ControlHelper.java:67)
    at javafx.graphics/com.sun.javafx.scene.NodeHelper.processCSS(NodeHelper.java:145)
    at javafx.graphics/javafx.scene.Parent.doProcessCSS(Parent.java:1400)
    at javafx.graphics/javafx.scene.Parent$1.doProcessCSS(Parent.java:125)
    at javafx.graphics/com.sun.javafx.scene.ParentHelper.processCSSImpl(ParentHelper.java:98)
    at javafx.graphics/com.sun.javafx.scene.NodeHelper.processCSS(NodeHelper.java:145)
    at javafx.graphics/javafx.scene.Node.processCSS(Node.java:9544)
    at javafx.graphics/javafx.scene.Scene.doCSSPass(Scene.java:569)
    at javafx.graphics/javafx.scene.Scene.preferredSize(Scene.java:1747)
    at javafx.graphics/javafx.scene.Scene$2.preferredSize(Scene.java:393)
    at javafx.graphics/com.sun.javafx.scene.SceneHelper.preferredSize(SceneHelper.java:66)
    at javafx.graphics/javafx.stage.Window$12.invalidated(Window.java:1086)
    at javafx.base/javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:110)
    at javafx.base/javafx.beans.property.BooleanPropertyBase.set(BooleanPropertyBase.java:145)
    at javafx.graphics/javafx.stage.Window.setShowing(Window.java:1174)
    at javafx.graphics/javafx.stage.Window.show(Window.java:1189)
    at javafx.graphics/javafx.stage.Stage.show(Stage.java:273)
    at Practice.Main.start(Main.java:32)
    at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
    at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
    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)
    ... 1 more
Exception running application Practice.Main

Process finished with exit code 1

Now, my question is that is there something I should add in the VM options?现在,我的问题是我应该在 VM 选项中添加一些东西吗? Or, can I not use gluon with JavaFX like this?或者,我不能像这样将胶子与 JavaFX 一起使用吗? Or, is there any way to run the JavaFX project with gluon charms tools?或者,有什么方法可以使用胶子魅力工具运行 JavaFX 项目?

Donwload the jar file from here: https://nexus.gluonhq.com/nexus/content/repositories/releases/com/gluonhq/charm-glisten/6.1.0/从这里下载 jar 文件: https://nexus.gluonhq.com/nexus/content/repositories/releases/com/gluonhq/charm-glisten/6.1.0/

and add it as a dependency to your project并将其作为依赖项添加到您的项目中

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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