1. TabPane Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Node; import javafx.scene.Scene; import javafx.scene.control.Label; import javafx.scene.control.Tab; import javafx.scene.control.TabPane; import javafx.scene.layout.BorderPane; import javafx.scene.paint.Color; import javafx.stage.Stage; public class FxTabPane extends Application implements FxNode { TabPane pane; public static void main(String[] args) { Application.launch(args); } @Override public void start(Stage stage) { Group root = new Group(); Scene scene = new Scene(root, 400, 250, Color.WHITE); BorderPane borderPane = new BorderPane(); borderPane.prefHeightProperty().bind(scene.heightProperty()); borderPane.prefWidthProperty().bind(scene.widthProperty()); borderPane.setCenter(pane); root.getChildren().add(borderPane); stage.setTitle("Tabs"); stage.setScene(scene); stage.show(); add("TabA", new Label("TabAA")); add("TabB", new Label("TabBB")); add("TabC", new Label("TabCC")); } public FxTabPane() { pane = new TabPane(); } @Override public TabPane get() { return pane; } public void add(String title, Node item) { Tab tab = new Tab(); tab.setText(title); tab.setContent(item); pane.getTabs().add(tab); } public void add(String title, FxNode item) { add(title, item.get()); } } |
댓글 없음:
댓글 쓰기