如何向 vBox 添加标签?

How do I add a label to a vBox?

我在向 fxml 文件静态添加标签时遇到了一些问题。这是我尝试过的方法,但它不起作用,placeholder 以红色突出显示。我基本上想要一个 header/title 作为我的列表视图。

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

<?import javafx.scene.control.ListView?>
<?import javafx.scene.layout.VBox?>
<?import java.awt.Label?>
<VBox xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
    <placeholder>
        <Label text="some text"/>
    </placeholder>
    <ListView fx:id="groupListView" VBox.vgrow="ALWAYS" />
</VBox>

I had the wrong import, and there was no need for placeholder

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

<?import javafx.scene.control.ListView?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.control.Label?>
<VBox xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
        <Label text="some text"/>
    <ListView fx:id="groupListView" VBox.vgrow="ALWAYS" />
</VBox>