I'm currentl试图进入的JavaFX 2.0,但我不能得到.css
样式表我的应用程序内工作。 从来就跟着在引导http://docs.oracle.com/javafx/2/get_started/css.htm#BABBGJBI但每当我试图导入.css
通过文件
scene.getStylesheets().add(Login.class.getResource("loginform.css").toExternalForm());
我收到以下错误:
Exception in Application start method
Exception in thread "main" java.lang.RuntimeException: Exception in Application start method
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:399)
at com.sun.javafx.application.LauncherImpl.access$000(LauncherImpl.java:47)
at com.sun.javafx.application.LauncherImpl$1.run(LauncherImpl.java:115)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at Login.start(Login.java:68)
at com.sun.javafx.application.LauncherImpl$5.run(LauncherImpl.java:315)
at com.sun.javafx.application.PlatformImpl$4.run(PlatformImpl.java:174)
at com.sun.javafx.application.PlatformImpl$3.run(PlatformImpl.java:141)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:29)
at com.sun.glass.ui.win.WinApplication$2$1.run(WinApplication.java:62)
... 1 more
CSS的路径位于我的Eclipse项目的路径: C:\Users\UserName\Dropbox\Documents\Eclipse\FirstExamples\loginform.css
我倒是得到任何帮助,我不能得到它的工作,不使用绝对路径,也没有相对的像本例中所示。