【发布时间】:2016-10-07 09:32:49
【问题描述】:
如您所见,目前关闭按钮位于顶部。
我怎样才能把它放在右手边?
public class TabbedPaneTest extends Application
{
@Override
public void start(Stage primaryStage)
{
primaryStage.setTitle("TabPane Test");
TabPane tabPane = new TabPane();
tabPane.setStyle("-fx-tab-min-height: 100");
tabPane.setRotateGraphic(true);
tabPane.setTabClosingPolicy(TabClosingPolicy.ALL_TABS);
tabPane.getTabs().addAll(tab("Tab 1"), tab("Tab 2"));
tabPane.setSide(Side.LEFT);
primaryStage.setScene(new Scene(tabPane, 400, 200));
primaryStage.show();
}
static Tab tab(String labelText)
{
Tab tab = new Tab();
Label label = new Label(labelText);
label.setRotate(90);
tab.setGraphic(new StackPane(label));
tab.setContent(new Label(" " + labelText + " content"));
return tab;
}
public static void main(String[] args)
{
launch(args);
}
}
【问题讨论】: