0

I use using following codes to open a dialog box in my current project as i have read about controlfx and its awesome dialogbox so i have used its code in my project but it gives error and i don't know why?

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

I have added following jar

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

I am getting following error:

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)

the error shows ControlsFX Error: ControlsFX 8.0.6_20 requires at least Java 8u20 so i have installed jdk-8u20-ea-bin-b22-windows-x64-08_jul_2014.exe but error remains same.

Please help me.

ItachiUchiha
  • 36,135
  • 10
  • 122
  • 176
user3829658
  • 159
  • 2
  • 7
  • 18
  • Have you changed the project settings so it is using the new installed java version? – Lars Jul 15 '14 at 17:10
  • no how should i do that – user3829658 Jul 15 '14 at 17:20
  • Hard to tell. I don't know which IDE you are using. In most cases right click on your project in the project tree and go to properties. Somewhere you will find the used java version. That depends on your IDE. – Lars Jul 15 '14 at 17:23
  • Then go to properties via right click on a project. After that go into libraries. There you'll find the java platform. Select the new one or go to manage platforms o add it into the list if it is not alredy in it. Now you want to change the source/binary format to Java 8 to be able to use all the features of java 8 e.g. lambdas. – Lars Jul 15 '14 at 17:32
  • Is there any other website that provide dialog box – user3829658 Jul 15 '14 at 17:40
  • no it is not working i have tried i more thing i.e., i have created a new project and copied all files into it but error remains same – user3829658 Jul 15 '14 at 17:44
  • I only know controlsfx, which you are using. I have used them in some projects and they work really great. – Lars Jul 15 '14 at 17:44
  • so what problem is in mine project – user3829658 Jul 15 '14 at 17:46
  • I guess you are using the wrong java version. You might need to add it by clicking on manage platforms. After this add a new platform. Now select the java folder of java 8u20. – Lars Jul 15 '14 at 17:50
  • ok is there any idea for opening a dialog box in FXML – user3829658 Jul 15 '14 at 17:50
  • but when i add a new platform its name i get is `jdk1.8.0_05` not `java 8u20`. Is there any problem as i have prev. installed java 8u5 and i haven't uninstalled that version and directly installed java8u20 – user3829658 Jul 15 '14 at 17:54
  • Yes you can create your own. have a look at this: http://stackoverflow.com/a/8310446/3579095 use FXML loader to load your fxml and add it to a scene. Please google for it there are many people that want to create dialogs in javafx and many blogpost exist. Try it on your own and when you have specific question ask again on stackoverflow. Good Luck :) – Lars Jul 15 '14 at 17:56
  • No there should not be a problem. you will have many folder. yours should be somwhere there: C:\Program Files\Java\jdk1.8.0_22 if you are on windows. – Lars Jul 15 '14 at 18:00

2 Answers2

1

Hey man i used an warning, and works i wanted

Alert alert = new Alert(AlertType.WARNING);

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

you don't nedd add controlfx.jar, javaFx allready has it just import

Algorithm
  • 21
  • 3
0

i'm working with Netbeans and Mac OS ML.

I have the same problem, i can't run my program from Netbeans. But if i run the .jar file out of Netbeans, this works fine :)

I see that in Netbeans the JRE setted is 1.8.11, i can't set the JRE 1.8.20 installed into my machine.

Edit: I solved the issue, in my cas: editing the Netbeans config file

  • On Mac OS X: Ctrl-click /Applications/NetBeans/NetBeans IDE 6.5.app in the Finder and choose 'show package contents', then browse to /Applications/NetBeans/NetBeans\ IDE\ 6.5.app/Contents/Resources/NetBeans/etc/netbeans.conf.
  • On Windows: C:\Program Files\Netbeans\etc\netbeans.conf
  • On Linux the installer lets the user choose where you want to install NetBeans. You may find it under /home/yourname/netbeans/etc/netbeans.conf or /opt/netbeans/etc/netbeans.conf.

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

We need replace the current jdk by jdk1.8.0_20 in this line: netbeans_jdkhome="/Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk/Contents/Home"

For security, after do that, do a copy of netbeans.conf file :)