简体   繁体   English

为什么 .fxml 文件没有在 Scene Builder 中打开?

[英]Why .fxml file is not opening in Scene Builder?

I have an issue while I open the abc.fxml file in Scene builder is shows this dialog box:我在场景构建器中打开 abc.fxml 文件时遇到问题,显示此对话框:

在此处输入图片说明

This is a abc.fxml code:这是 abc.fxml 代码:

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

<?import com.jfoenix.controls.JFXButton?>
<?import javafx.scene.layout.AnchorPane?>


<fx:root fx:id="w" prefHeight="400.0" prefWidth="400.0" type="AnchorPane" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/8.0.65">
   <children>
      <JFXButton fx:id="w1" layoutX="138.0" layoutY="243.0" />
      <JFXButton fx:id="w2" layoutX="256.0" layoutY="230.0" />
   </children>
</fx:root>`

These are the details that mentions in Show Details:这些是显示详细信息中提到的详细信息:

Show Details 显示详情

I was having the same problem.我遇到了同样的问题。 I did so many things but none work for me, So I checked my FXML file code using Notepad++ and then I realised, I have used JFonix components in FXML file.我做了很多事情,但没有一个对我有用,所以我使用 Notepad++ 检查了我的 FXML 文件代码,然后我意识到,我在 FXML 文件中使用了 JFonix 组件。 (for some reason I removed that jar from scene builder and forgot to add it again) So I added JFonix jar to scene builder and it worked for me. (出于某种原因,我从场景构建器中删除了那个 jar 并忘记再次添加它)所以我将 JFonix jar 添加到场景构建器中,它对我有用。

Rather that double cliking on .fxml in project view, drag the .fxml file to scene builder interface.而不是在项目视图中双击 .fxml,将 .fxml 文件拖到场景构建器界面。 this should work.这应该有效。

If you facing this problem then please check your FXML tags are correct as what I have above wrong that was this line如果您遇到此问题,请检查您的 FXML 标签是否正确,因为我上面的错误是这一行

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

remove fire "`" from first line.从第一行删除火“`”。 Right click on fxml file and Open with Scene Builder.右键单击 fxml 文件并使用 Scene Builder 打开。 If you will get a pop again right click again and open again it will sure opened.如果您再次弹出,再次右键单击并再次打开它肯定会打开。 But these days Scene Builder can be install separately and you can drag drop fxml in it.但是现在Scene Builder可以单独安装,您可以将fxml拖放到其中。

Yes i was facing the same problem.是的,我面临着同样的问题。 After some time i realize that i have used some outside scenebuilder tools like jfoenix, fontawsome etc. So we must include it in scene builder also.一段时间后,我意识到我使用了一些外部场景构建器工具,如 jfoenix、fontawsome 等。所以我们也必须将它包含在场景构建器中。

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

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