0

我使用以下代码在我当前的项目中打开一个对话框,因为我已经阅读了 controlfx 及其很棒的对话框,所以我在我的项目中使用了它的代码,但它给出了错误,我不知道为什么?

 Dialogs.create()
        .owner(SchoolManagement2.stage1)
        .title("Information Dialog")
        .masthead("Look, an Information Dialog")
        .message("I have a great message for you!")
        .showInformation();

我添加了以下罐子

controlsfx-8.0.6_20.jar
controlsfx-samples-8.0.6_20.jar
fxsampler-1.0.6_20.jar

我收到以下错误:

java.lang.RuntimeException: ControlsFX Error: ControlsFX 8.0.6_20 requires at least Java 8u20
    at impl.org.controlsfx.version.VersionChecker.doVersionCheck(VersionChecker.java:83)
    at org.controlsfx.control.ControlsFXControl.<init>(ControlsFXControl.java:35)
    at org.controlsfx.control.ButtonBar.<init>(ButtonBar.java:366)
    at org.controlsfx.control.ButtonBar.<init>(ButtonBar.java:357)
    at org.controlsfx.dialog.Dialog.createButtonPanel(Dialog.java:1034)
    at org.controlsfx.dialog.Dialog.createCenterPanel(Dialog.java:1029)
    at org.controlsfx.dialog.Dialog.buildDialogContent(Dialog.java:950)
    at org.controlsfx.dialog.Dialog.show(Dialog.java:320)
    at org.controlsfx.dialog.Dialogs.showSimpleContentDialog(Dialogs.java:1106)
    at org.controlsfx.dialog.Dialogs.showInformation(Dialogs.java:531)
    at schoolmanagement2.FeesdepositeController.show(FeesdepositeController.java:633)
    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:483)
    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:483)
    at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:275)
    at javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1763)
    at javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1651)
    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.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:204)
    at javafx.scene.Node.fireEvent(Node.java:8175)
    at javafx.scene.control.Button.fire(Button.java:185)
    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.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:204)
    at javafx.scene.Scene$MouseHandler.process(Scene.java:3746)
    at javafx.scene.Scene$MouseHandler.access$1800(Scene.java:3471)
    at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1695)
    at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2486)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:314)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:243)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:345)
    at com.sun.glass.ui.View.handleMouseEvent(View.java:526)
    at com.sun.glass.ui.View.notifyMouse(View.java:898)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.access$300(WinApplication.java:39)
    at com.sun.glass.ui.win.WinApplication$4$1.run(WinApplication.java:112)

错误显示ControlsFX Error: ControlsFX 8.0.6_20 requires at least Java 8u20所以我已经安装jdk-8u20-ea-bin-b22-windows-x64-08_jul_2014.exe但错误仍然相同。

请帮我。

4

2 回答 2

1

嘿,伙计,我用了警告,我想要的作品

警报警报 = 新警报(AlertType.WARNING);

        alert.setTitle("Warning");
        alert.setHeaderText("Look, a Warning Dialog");
        alert.setContentText("your content text!");
        alert.showAndWait();

你不需要添加 controlfx.jar,javaFx 已经有了它只是导入

于 2019-09-05T16:48:31.253 回答
0

我正在使用 Netbeans 和 Mac OS ML。

我有同样的问题,我无法从 Netbeans 运行我的程序。但是,如果我从 Netbeans 中运行 .jar 文件,则可以正常工作:)

我看到在 Netbeans 中设置的 JRE 是 1.8.11,我无法设置安装到我的机器中的 JRE 1.8.20。

编辑:我在我的 cas 中解决了这个问题:编辑 Netbeans 配置文件

  • 在 Mac OS X 上:按住 Ctrl 键单击 Finder 中的 /Applications/NetBeans/NetBeans IDE 6.5.app 并选择“显示包内容”,然后浏览到 /Applications/NetBeans/NetBeans\ IDE\ 6.5.app/Contents/Resources/NetBeans /etc/netbeans.conf。
  • 在 Windows 上:C:\Program Files\Netbeans\etc\netbeans.conf
  • 在 Linux 上,安装程序允许用户选择要安装 NetBeans 的位置。您可以在 /home/yourname/netbeans/etc/netbeans.conf 或 /opt/netbeans/etc/netbeans.conf 下找到它。

见:http ://wiki.netbeans.org/FaqNetbeansConf

我们需要在这一行用jdk1.8.0_20替换当前的 jdk :netbeans_jdkhome="/Library/Java/JavaVirtualMachines/ jdk1.8.0_11 .jdk/Contents/Home"

为了安全起见,在此之后,复制一份 netbeans.conf 文件:)

于 2014-07-29T22:20:03.187 回答