Java ControlsFXX边框FXML包装器不工作
我正在尝试为ControlsFX的Borders API创建一个包装器,该API将与FXML一起使用。当我运行应用程序时,我看不到任何内容。当我将Java ControlsFXX边框FXML包装器不工作,java,javafx,border,fxml,controlsfx,Java,Javafx,Border,Fxml,Controlsfx,我正在尝试为ControlsFX的Borders API创建一个包装器,该API将与FXML一起使用。当我运行应用程序时,我看不到任何内容。当我将标题边框更改为其他内容时,如标签,它按预期工作 标题边界类: package com.neonorb.commons.ui.gui.javafx; import javafx.beans.NamedArg; import javafx.collections.ObservableList; import javafx.scene.Node; impo
标题边框
更改为其他内容时,如标签
,它按预期工作
标题边界类:
package com.neonorb.commons.ui.gui.javafx;
import javafx.beans.NamedArg;
import javafx.collections.ObservableList;
import javafx.scene.Node;
import javafx.scene.layout.StackPane;
import javafx.scene.paint.Color;
import org.controlsfx.tools.Borders;
/**
* Created by chris on 8/21/15.
*/
public class TitledBorder extends StackPane {
private StackPane contentStackPane = new StackPane();
private ObservableList<Node> children = contentStackPane.getChildren();
public TitledBorder(@NamedArg("text") String text) {
super.getChildren().add(Borders.wrap(contentStackPane).lineBorder().color(Color.BLACK).title(text).buildAll());
}
public ObservableList<Node> getChildren() {
return children;
}
}
<?import javafx.scene.layout.BorderPane?>
<?import com.neonorb.commons.ui.gui.javafx.TitledBorder?>
<?import javafx.scene.control.Label?>
<BorderPane xmlns:fx="http://javafx.com/fxml">
<center>
<TitledBorder text="hi">
<children>
<Label text="hello"/>
</children>
</TitledBorder>
</center>
</BorderPane>
import com.neonorb.commons.Commons;
import com.neonorb.commons.MainClass;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
/**
* Created by chris on 7/7/15.
*/
@MainClass
public class Main extends Application {
public static void main(String[] args) {
launch();
}
@Override
public void start(Stage stage) throws Exception {
Commons.init("");
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("Main.fxml"));
Parent parent = fxmlLoader.load();
stage.setScene(new Scene(parent));
stage.sizeToScene();
stage.show();
}
}