[英]From JavaFX 2.2 to JavaFX8
I have made an application using JavaFX 2.2 and want to switch to JavaFX 8. Using JavaFX2.2 my application looks like this: 我已经使用JavaFX 2.2创建了一个应用程序,并希望切换到JavaFX8。使用JavaFX2.2,我的应用程序如下所示:
When using JavaFX 8 without changing any source code it looks like this: 当使用JavaFX 8而不更改任何源代码时,它看起来像这样:
With JavaFX8 some nodes are not shown at all (eg Criterion 1) and sometimes appear after clicking randomly on the scrollpane. 使用JavaFX8,某些节点根本不会显示(例如,标准1),有时会在随机单击滚动窗格后出现。 In addition the nodes have an incorrect size (compare Step 1 and the small little dot). 另外,节点的大小不正确(比较步骤1和小的小点)。 Another problem is that when performing actions such as adding nodes the application lags heavily in JavaFX8. 另一个问题是,当执行诸如添加节点之类的操作时,应用程序在JavaFX8中严重滞后。
Unfortunately I do not get any error messages at all and I have almost no clue what I have to fix in order to get the application working in JavaFX8. 不幸的是,我根本没有收到任何错误消息,而且我几乎不知道要使该应用程序在JavaFX8中运行必须修复的内容。 Any help/ideas/hints would be greatly appreciated. 任何帮助/想法/提示将不胜感激。
Possible issues (?): 可能的问题(?):
EDIT: The "bug" is connected with css styling. 编辑:“错误”与CSS样式相关。 If I remove the stylesheets that are added to the nodes everything works fine (except the styling of the nodes of course). 如果我删除添加到节点的样式表,则一切正常(当然,除了节点的样式外)。 In particular the commands I have to remove are of the following form: 特别是我必须删除的命令具有以下形式:
getStylesheets().add(ClassName.class.getResource("CSSFile.css").toExternalForm()); 。getStylesheets()添加(ClassName.class.getResource( “CSSFile.css”)toExternalForm());
I have identified the error: I had one negative value within my css stylesheet (which was used for the nodes). 我发现了错误:在CSS样式表(用于节点)中有一个负值。 Removing that value made it work like in JavaFX 2.2. 删除该值使它像在JavaFX 2.2中一样工作。 To be precise I had to change the following: 确切地说,我必须更改以下内容:
-fx-border-width: 5 -1 0 5 ;
to 至
-fx-border-width: 5 0 0 5 ;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.