public Tab newTab() { Tab tab = sTabPool.acquire(); if (tab == null) { tab = new Tab(this); } tab.mView = createTabView(tab); return tab; }
BorderPane borderPane = new BorderPane(); for (int i = 0; i < 5; i++) { Tab tab = new Tab(); tab.setGraphic(new Circle(0, 0, 10)); HBox hbox = new HBox();
@Override public void initialize(URL url, ResourceBundle resourceBundle) { try { Tab tab = new Tab(); tabPane.getTabs().add(tab); tab.setContent((Node) FXMLLoader.load(this.getClass().getResource("main.fxml"))); } catch (IOException e) { e.printStackTrace(); } }
static Tab tab(String labelText) { Tab tab = new Tab(labelText); tab.setContent(new Label(" " + labelText + " content")); return tab; }
try { Tab tab = new Tab(); //... FXMLLoader loader = new FXMLLoader(getClass().getResource("../fxml/connectionTab.fxml")); tab.setContent(loader.load()); ConnectionTabController controller = loader.getController(); // ... }
TabPane tabPane = new TabPane(); tabPane.getTabs().addAll(new Tab("Tab1"), new Tab("Tab2"), new Tab("Tab3")); Button b = new Button("Get header"); b.setOnAction((e) -> { StackPane headerArea = (StackPane) tabPane.lookup(".tab-header-area"); System.out.println("Coordinates relatively to Scene: " + headerArea.localToScene(headerArea.getBoundsInLocal())); });
Tab studentAdmission = new Tab(); studentAdmission.setContent((Parent)new FXMLLoader(getClass().getResource("Customer_View.fxml")).load()); Label l = new Label("Student Admission"); l.setRotate(90); StackPane stp = new StackPane(new Group(l)); studentAdmission.setGraphic(stp); mainTab.getTabs().add(studentAdmission);
Tab tabA = new Tab(); tabA.setText("Tab A"); tabA.setStyle("-fx-padding: 0 30 0 30;"); tabPane.getTabs().add(tabA);
Tab tab = new Tab(...); // ... WebView webView = new WebView(...); // ... layout, etc tab content, etc... tab.selectedProperty().addListener((obs, wasSelected, isNowSelected) -> { if (isNowSelected) { currentWebView = webView ; } });
Tab tabB = new Tab(); tabB.setText(""); tabPane.getTabs().add(tabB); tabB.setStyle("-fx-border-color:red; -fx-background-color: blue;"); tabB.setGraphic(new Label("Tab B")); tabB.getGraphic().setStyle("-fx-text-fill: #c4d8de;");
final Tab tab = new Tab("xyzzy"); ContextMenu contextMenu = new ContextMenu(); MenuItem menuItem = new MenuItem("Do Some Action"); menuItem.setOnAction(new EventHandler<ActionEvent>(){ @Override public void handle(ActionEvent e){ tab.setText("Activated by User"); } });
TabPane tabPane = new TabPane(); Tab tab1 = new Tab("Tab 1"); tab1.setContent(new Label("Tab1 content")) tabPane.getTabs().add(tab1); tabPane.setSide(Side.BOTTOM)
Tab tab = new Tab(); tab.setText("TabText"); TextArea ta = new TextArea("New User added"); tab.setContent(ta); tabPan.getTabs().add(tab);
Tab tab = new Tab(); tab.setGraphic(buildImage("patch/to/image"); // Helper method to create image from image patch private static ImageView buildImage(String imgPatch) { Image i = new Image(imgPatch); ImageView imageView = new ImageView(); //You can set width and height imageView.setFitHeight(16); imageView.setFitWidth(16); imageView.setImage(i); return imageView; }
Hyperlink hlink = new Hyperlink(); Image image = new Image(MyClass.class.getResourceAsStream("/images/close.png")); hlink.setGraphic(new ImageView(image)); hlink.setFocusTraversable(false); Tab tab = new Tab(); tab.setGraphic(hlink); hlink.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { //Do somthing } });
/** * Subroutine of {@link #createTab(View, boolean, int, int)}. Exposed for testing. Never call this except from * within the other createTab method. */ Tab createTab( final WorkbenchPartPresenter.View view, final boolean isActive ) { Tab tab = new Tab(); tab.setHeading( view.getPresenter().getTitle() ); tab.setActive( isActive ); return tab; }
TabPane tabPane = new TabPane(); BorderPane mainPane = new BorderPane(); Tab tabB = new Tab(); tabB.setText("Tab B"); tabB.setContent(yourcontent); tabPane.getTabs().add(tabB); mainPane.setCenter(tabPane); primaryStage.setScene(new Scene(mainpane, 400, 300, Color.WHITE););