2017-08-11 33 views
0

創建LEGEND(圖中邊境文本)如何在窗格邊緣用JavaFX這樣添加文字:如何在JavaFX的

enter image description here

+0

你提的問題不夠明確回答。你的意思是哪個圖表邊界?普通JFX 8圖表?他們創造了自己的傳奇。或者你想要一個樣式化的TextField? – SilverMonkey

+0

我使用JavaFX8 .. –

+1

我不認爲這個問題是關於傳說的。更多關於邊界面板和這樣一個問題之前已經被問到:https://stackoverflow.com/questions/17288995/how-to-add-border-to-panel-of-javafx – notmyf4ulty

回答

1

這與他們c#有一個節點。我不知道JavaFX是否有這種類型的節點。在SceneBuilder我在邊界頂部添加了一個圍繞PaneLabel的邊框。然後我將根目錄AnchorPane的背景設置爲白色,將背景設置爲白色。我沒有嘗試Group,但我猜這可能是一個好主意。

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

<?import javafx.scene.control.Label?> 
<?import javafx.scene.layout.AnchorPane?> 
<?import javafx.scene.layout.Pane?> 


<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" style="-fx-background-color: White;" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1"> 
    <children> 
     <Pane fx:id="pane" layoutX="200.0" layoutY="100.0" prefHeight="200.0" prefWidth="200.0" style="-fx-border-color: BLACK;" /> 
     <Label layoutX="218.0" layoutY="92.0" style="-fx-background-color: WHITE;" text="Label" /> 
    </children> 
</AnchorPane> 

enter image description here