下面列出了javafx.scene.control.TabPane#setSide ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Override
@SneakyThrows
public Tab getRoot(RequestContainer request) {
val script = request.getAspect(ScriptingAspect.class).get();
Tab preTab = getTab(script::getPreRequestScript, script::setPreRequestScript, "Before Request");
Tab postTab = getTab(script::getPostRequestScript, script::setPostRequestScript, "After Request");
TabPane tabs = new TabPane(preTab, postTab);
tabs.getSelectionModel().select(1); //default to show after request script
tabs.setSide(Side.LEFT);
tabs.getStyleClass().add("options-tabs");
tabs.tabMinWidthProperty().setValue(20);
tabs.tabMaxWidthProperty().setValue(20);
tabs.tabMinHeightProperty().setValue(150);
tabs.tabMaxHeightProperty().setValue(150);
tabs.setTabClosingPolicy(TabPane.TabClosingPolicy.UNAVAILABLE);
return new Tab("Scripting", tabs);
}
public TabSample() {
BorderPane borderPane = new BorderPane();
final TabPane tabPane = new TabPane();
tabPane.setPrefSize(400, 400);
tabPane.setSide(Side.TOP);
tabPane.setTabClosingPolicy(TabPane.TabClosingPolicy.UNAVAILABLE);
final Tab tab1 = new Tab();
tab1.setText("Tab 1");
final Tab tab2 = new Tab();
tab2.setText("Tab 2");
final Tab tab3 = new Tab();
tab3.setText("Tab 3");
final Tab tab4 = new Tab();
tab4.setText("Tab 4");
tabPane.getTabs().addAll(tab1, tab2, tab3, tab4);
borderPane.setCenter(tabPane);
getChildren().add(borderPane);
}
public TabSample() {
BorderPane borderPane = new BorderPane();
final TabPane tabPane = new TabPane();
tabPane.setPrefSize(400, 400);
tabPane.setSide(Side.TOP);
tabPane.setTabClosingPolicy(TabPane.TabClosingPolicy.UNAVAILABLE);
final Tab tab1 = new Tab();
tab1.setText("Tab 1");
final Tab tab2 = new Tab();
tab2.setText("Tab 2");
final Tab tab3 = new Tab();
tab3.setText("Tab 3");
final Tab tab4 = new Tab();
tab4.setText("Tab 4");
tabPane.getTabs().addAll(tab1, tab2, tab3, tab4);
borderPane.setCenter(tabPane);
getChildren().add(borderPane);
}
private DemoTab(String title, String sourceFile) throws Exception {
super(title);
setClosable(false);
TabPane content = new TabPane();
setContent(content);
content.setSide(Side.BOTTOM);
Tab widgets = new Tab("Widgets");
widgets.setClosable(false);
URL location = getClass().getResource(sourceFile);
FXMLLoader fxmlLoader = new FXMLLoader(location);
Node node = fxmlLoader.load();
widgets.setContent(node);
Tab source = new Tab("Source");
source.setClosable(false);
XMLEditor editor = new XMLEditor();
editor.setEditable(false);
String text = IOUtils.toString(getClass().getResourceAsStream(sourceFile));
editor.setText(text);
source.setContent(editor);
content.getTabs().addAll(widgets, source);
}
public ConfigurationPane(final ImportController importController) {
this.importController = importController;
setMaxHeight(Double.MAX_VALUE);
setMaxWidth(Double.MAX_VALUE);
setMinSize(0, 0);
// Add the tab pane that will hold a tab for each run
tabPane = new TabPane();
tabPane.setMaxHeight(Double.MAX_VALUE);
tabPane.setSide(Side.TOP);
AnchorPane.setTopAnchor(tabPane, 5.0);
AnchorPane.setLeftAnchor(tabPane, 5.0);
AnchorPane.setRightAnchor(tabPane, 5.0);
AnchorPane.setBottomAnchor(tabPane, 5.0);
getChildren().add(tabPane);
// Create a button to allow the user to add a new tab (RunPane).
Button newRunButton = new Button("", new ImageView(ADD_IMAGE));
newRunButton.setOnAction((ActionEvent event) -> {
importController.createNewRun();
});
AnchorPane.setTopAnchor(newRunButton, 10.0);
AnchorPane.setRightAnchor(newRunButton, 10.0);
getChildren().add(newRunButton);
// Add a single run to start with
createTab();
}
@SuppressWarnings("unchecked")
public RegexConfigFragment(PlainDictAppOptions _opt){
super();
tabPane = new TabPane();
statusBar = new Text();
tabPane.setPadding(new Insets(4,0,0,0));
opt=_opt;
bundle = ResourceBundle.getBundle("UIText", Locale.getDefault());
Tab tab1 = new Tab();
tab1.setText(bundle.getString(onegine));
tab1.setTooltip(new Tooltip("词条、全文检索时,可选用正则引擎,或快速 .* 通配"));
tab1.setClosable(false);
Text lable = new Text("");
lable.setStyle("-fx-fill: #ff0000;");
tab1.setGraphic(lable);
Tab tab2 = new Tab();
tab2.setText(bundle.getString(findpage));
tab2.setTooltip(new Tooltip("基于 Mark.js"));
tab2.setClosable(false);
Text lable1 = new Text("");
lable1.setStyle("-fx-fill: #ff0000;");
tab2.setGraphic(lable1);
tabPane.getSelectionModel().selectedIndexProperty().addListener((observable, oldValue, newValue) -> {
if(newValue.intValue()==1){
if(tab2.getContent()==null)
tab2.setContent(getSubpageContent());
}
});
tabPane.setRotateGraphic(false);
tabPane.setTabClosingPolicy(TabPane.TabClosingPolicy.SELECTED_TAB);
tabPane.setSide(Side.TOP);
tabPane.getTabs().addAll(tab1,tab2);
tabPane.getStyleClass().add(TabPane.STYLE_CLASS_FLOATING);
final String lvCss = HiddenSplitPaneApp.class.getResource("lvCss.css").toExternalForm();
tabPane.getStylesheets().add(lvCss);
tab1.setContent(getMainContent());
VBox.setVgrow(tabPane, Priority.ALWAYS);
getChildren().addAll(tabPane, statusBar);
}