2012-03-15 16 views
0

在javafx2我試圖在fxml中創建一個對象。我想然後能夠從控制器中引用它?如何在FXML中創建路徑對象?

<BorderPane> 
      <center> 
       <Path id="ad"/> 
      </center> 
</BorderPane> 

不工作?有任何想法嗎?

回答

1

哎呀需要在fxml文件中導入Path。

<?import javafx.scene.shape.Path?> 
+0

由於您自己解決了一個問題,請接受您自己的答案,以遵循網站指南。有關詳細信息,請參閱http://meta.stackexchange.com/questions/16930/is-it-ok-to-answer-your-own-question-and-accept-it。 – 2012-03-15 18:05:13

1

還需要在開始標記中添加一個fx:id。

<BorderPane> 
      <center> 
       <Path id="ad" fx:id="ad1"/> 
      </center> 
</BorderPane> 
相關問題