1. FlowPane 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 58 59 60 61 62 63 | import javafx.application.Application; import javafx.geometry.Insets; import javafx.geometry.Orientation; import javafx.scene.Group; import javafx.scene.Node; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.layout.BorderPane; import javafx.scene.layout.FlowPane; import javafx.scene.paint.Color; import javafx.stage.Stage; public class FxFlowPane extends Application implements FxNode { FlowPane 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("TitledPane"); stage.setScene(scene); stage.show(); vertical(); for( int i = 0; i < 100; i++ ) { add( new Button("Button" + i ) ); } } public FxFlowPane() { pane = new FlowPane(); pane.setPadding(new Insets(0, 0, 0, 0)); pane.setVgap(8); pane.setHgap(4); } @Override public FlowPane get() { return pane; } public void add(Node item) { pane.getChildren().add(item); } public void add(FxNode item) { add(item.get()); } public void vertical() { pane.setOrientation(Orientation.VERTICAL); } } |
댓글 없음:
댓글 쓰기