static Node createTabPane(int numOfTabs, int prefWidth, int prefHeight, String firstTabText, boolean floating, boolean disableFirst, Side side) { TabPane tabPane = new TabPane(); tabPane.setSide(side); if (floating) tabPane.getStyleClass().add("floating"); for (int i=1; i<=numOfTabs; i++) { tabPane.getTabs().add( TabBuilder.create() .text("Tab "+i) .disable(i==0 && disableFirst) .content(new Label((i==1 && firstTabText!=null)? firstTabText :"Tab "+i+" Content")) .build() ); } if (disableFirst) tabPane.getSelectionModel().select(1); tabPane.setPrefWidth(prefWidth); tabPane.setPrefHeight(prefHeight); return tabPane; }
/** * create an XYTab Pane with the given iconSize * * @param iconSize * - e.g. 48 */ public XYTabPane(int iconSize) { super(); this.iconSize = iconSize; this.currentTab = TabSelection.getInstance(); setvTabPane(this.addTabPane("vTabPane")); getvTabPane().setSide(Side.LEFT); Tab filler = new Tab(); topLeftButton = new Button(); int tabSize = getTabSize(); topLeftButton.setMinSize(tabSize, tabSize); topLeftButton.setMaxSize(tabSize, tabSize); topLeftButton.setDisable(true); filler.setGraphic(topLeftButton); filler.setDisable(true); getvTabPane().getTabs().add(filler); this.addToMaps(filler, vTabPane); fontAwesome = GlyphFontRegistry.font("FontAwesome"); super.getChildren().add(getvTabPane()); }
tabPane.setSide(Side.TOP); tabPane.setPadding(new Insets(15));