List of usage examples for javafx.scene.control Tab setText
public final void setText(String value)
Sets the text to show in the tab to allow the user to differentiate between the function of each tab.
From source file:Main.java
@Override public void start(Stage stage) { final Group group = new Group(); Scene scene = new Scene(group, 300, 150); stage.setScene(scene);/*from www. j a va 2s .com*/ stage.setTitle("Sample"); TabPane tabPane = new TabPane(); Tab tab = new Tab(); tab.setText("new tab"); tab.setContent(new Rectangle(200, 200, Color.LIGHTSTEELBLUE)); tabPane.getTabs().add(tab); tabPane.getTabs().add(new Tab()); group.getChildren().add(tabPane); stage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle("Tabs"); Group root = new Group(); Scene scene = new Scene(root, 400, 250, Color.WHITE); TabPane tabPane = new TabPane(); BorderPane borderPane = new BorderPane(); for (int i = 0; i < 5; i++) { Tab tab = new Tab(); tab.setText("Tab" + i); HBox hbox = new HBox(); hbox.getChildren().add(new Label("Tab" + i)); hbox.setAlignment(Pos.CENTER);//from ww w . j ava 2s . c o m tab.setContent(hbox); tabPane.getTabs().add(tab); } // bind to take available space borderPane.prefHeightProperty().bind(scene.heightProperty()); borderPane.prefWidthProperty().bind(scene.widthProperty()); borderPane.setCenter(tabPane); root.getChildren().add(borderPane); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle("Tabs"); Group root = new Group(); Scene scene = new Scene(root, 400, 250, Color.WHITE); TabPane tabPane = new TabPane(); BorderPane borderPane = new BorderPane(); for (int i = 0; i < 5; i++) { Tab tab = new Tab(); tab.setText("Tab" + i); HBox hbox = new HBox(); hbox.getChildren().add(new Label("Tab" + i)); hbox.setAlignment(Pos.CENTER);//ww w . j a v a 2 s . c o m tab.setContent(hbox); tabPane.getTabs().add(tab); } tabPane.setSide(Side.LEFT); //tabPane.setSide(Side.TOP); //tabPane.setSide(Side.RIGHT); //tabPane.setSide(Side.BOTTOM); // bind to take available space borderPane.prefHeightProperty().bind(scene.heightProperty()); borderPane.prefWidthProperty().bind(scene.widthProperty()); borderPane.setCenter(tabPane); root.getChildren().add(borderPane); primaryStage.setScene(scene); primaryStage.show(); }
From source file:com.playonlinux.javafx.mainwindow.library.ViewLibrary.java
private void drawContent() { libraryTabs = new TabPane(); libraryTabs.getStyleClass().add("rightPane"); final Tab installedApplication = new Tab(); installedApplication.setClosable(false); installedApplication.setText(translate("My applications")); libraryTabs.getTabs().add(installedApplication); applicationListWidget = new ApplicationListWidget(this); applicationListWidget.getStyleClass().add("rightPane"); installedApplication.setContent(applicationListWidget); }
From source file:de.micromata.mgc.javafx.launcher.gui.AbstractConfigDialog.java
public <M extends LocalSettingsConfigModel> boolean addTab( Class<? extends AbstractConfigTabController<M>> controller, M model, String id, String title) { ControllerService cv = ControllerService.get(); Pair<Pane, ? extends AbstractConfigTabController<M>> wc = cv.loadControllerControl(controller, Pane.class, this, id); Tab tab = createTab(model, wc); tab.setId(id);/* ww w.j ava 2 s .c o m*/ tab.setText(title); return true; }
From source file:cz.lbenda.dataman.rc.DatamanApp.java
/** Add node to center pane */ public Tab addToCenter(ObjectProperty<String> title, Node node, boolean closable) { Tab tab = addToCenter(title.getValue(), node, closable); title.addListener((observable, oldValue, newValue) -> tab.setText(newValue)); return tab;//from w ww. j av a2 s . c o m }
From source file:ipat_fx.FXMLDocumentController.java
public TabPane getByProfile(HashMap<String, ArrayList<GridPane>> map, int noOfProfiles) { TabPane tabpane = new TabPane(); Tab tabForProfile; FlowPane paneForProfile;//from w w w . ja va 2 s . c o m for (int i = 0; i < noOfProfiles; i++) { tabForProfile = new Tab(); paneForProfile = new FlowPane(); tabForProfile.setId("li_Profile_" + i); tabForProfile.setText("Profile " + i); int j = 0; for (Iterator<String> iterator = map.keySet().iterator(); iterator.hasNext(); j++) { String nameOfArtefact = iterator.next(); ArrayList<GridPane> cells = map.get(nameOfArtefact); paneForProfile.getChildren().add(cells.get(i)); } ScrollPane scrollPane = new ScrollPane(); scrollPane.setContent(paneForProfile); tabForProfile.setContent(scrollPane); tabpane.getTabs().add(tabForProfile); } return tabpane; }
From source file:ipat_fx.FXMLDocumentController.java
public TabPane getByImage(HashMap<String, ArrayList<GridPane>> map) { TabPane tabpane = new TabPane(); Tab tabForImage; FlowPane paneForImage;/* ww w .j a v a2s .c om*/ Iterator<String> iterator = map.keySet().iterator(); while (iterator.hasNext()) { tabForImage = new Tab(); paneForImage = new FlowPane(); String nameOfArtefact = iterator.next(); tabForImage.setId("li_" + nameOfArtefact); tabForImage.setText(nameOfArtefact); ArrayList<GridPane> cells = map.get(nameOfArtefact); for (GridPane cell1 : cells) { GridPane cell = cell1; //paneForImage.add(cell, 0, i); paneForImage.getChildren().add(cell); } ScrollPane scrollPane = new ScrollPane(); scrollPane.setContent(paneForImage); tabForImage.setContent(scrollPane); tabpane.getTabs().add(tabForImage); } return tabpane; }
From source file:de.micromata.mgc.javafx.launcher.gui.AbstractConfigDialog.java
private Tab createTab(LocalSettingsConfigModel configModel, Pair<Pane, ? extends AbstractConfigTabController<?>> wc) { AbstractConfigTabController<?> contrl = wc.getSecond(); contrl.setConfigDialog(this); Pane tabPane = wc.getFirst();//from w w w. ja v a 2 s . c o m contrl.setTabPane(tabPane); Tab tabB = new Tab(); AnchorPane tabContentPane = new AnchorPane(); tabContentPane.setMaxHeight(Integer.MAX_VALUE); // tabContentPane.setPrefHeight(500); FeedbackPanel feedback = new FeedbackPanel(); feedback.setPrefHeight(100); feedback.setMinHeight(100); FXEvents.get().addEventHandler(this, feedback, FeedbackPanelEvents.CLEAR, event -> { feedback.clearMessages(); }); contrl.setFeedback(feedback); tabContentPane.getChildren().add(tabPane); tabContentPane.getChildren().add(feedback); AnchorPane.setTopAnchor(tabPane, 2.0); AnchorPane.setRightAnchor(tabPane, 0.0); AnchorPane.setLeftAnchor(tabPane, 0.0); AnchorPane.setBottomAnchor(tabPane, 70.0); AnchorPane.setBottomAnchor(feedback, 0.0); tabB.setContent(tabContentPane); AnchorPane.setTopAnchor(tabContentPane, 0.0); AnchorPane.setRightAnchor(tabContentPane, 0.0); AnchorPane.setLeftAnchor(tabContentPane, 0.0); AnchorPane.setBottomAnchor(tabContentPane, 0.0); Node scrollPane = tabPane.getChildren().get(0); AnchorPane.setTopAnchor(scrollPane, 0.0); AnchorPane.setRightAnchor(scrollPane, 0.0); AnchorPane.setLeftAnchor(scrollPane, 0.0); AnchorPane.setBottomAnchor(scrollPane, 0.0); configurationTabs.getTabs().add(tabB); tabController.add(contrl); contrl.setTab(tabB); ((ModelController) contrl).setModel(configModel); contrl.initializeWithModel(); contrl.addToolTips(); tabB.setText(contrl.getTabTitle()); contrl.registerValMessageReceivers(); return tabB; }