2018년 9월 8일 토요일

[JavaFx] Container Examples


1. Border Pane

 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
    public static BorderPane getBorderPane(int top, int right, int bottom, int left) {
        BorderPane pane = new BorderPane();
        pane.setPadding(new Insets(top, right, bottom, left));
        return pane;
    }
    public static void addBorderPaneTop(BorderPane pane, Node node) {
        pane.setTop(node);
    }
    public static void addBorderPaneCenter(BorderPane pane, Node node) {
        pane.setCenter(node);
    }   
    public static void addBorderPaneBottom(BorderPane pane, Node node) {
        pane.setBottom(node);
    }   
    public static void addBorderPaneLeft(BorderPane pane, Node node) {
        pane.setLeft(node);
    }   
    public static void addBorderPaneRight(BorderPane pane, Node node) {
        pane.setRight(node);
    }
    
    public static void setBorderPaneAlignTopLeft(BorderPane pane, Node node) {
        BorderPane.setAlignment(node, Pos.TOP_LEFT);
    }   
    public static void setBorderPaneAlignBottomCenter(BorderPane pane, Node node) {
        BorderPane.setAlignment(node, Pos.BOTTOM_CENTER);
    }   
    public static void setBorderPaneAlignCenter(BorderPane pane, Node node) {
        BorderPane.setAlignment(node, Pos.CENTER);
    }
    


2. Grid Pane

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
   public static GridPane getGridPane(int hgap, int vgap, int top, int right, int bottom, int left) {
        GridPane grid = new GridPane();
        grid.setAlignment(Pos.CENTER);
        grid.setHgap(hgap);
        grid.setVgap(vgap);
        grid.setPadding(new Insets(top, right, bottom, left));
        return grid;
    }
    
    public static GridPane getGridPane() {
        return getGridPane(10,10,25,25,25,25);
    }
    


3. HBox, VBox

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
    public static HBox getHBox(int hgap, int top, int right, int bottom, int left) {
        HBox hbox = new HBox(hgap);
        hbox.setAlignment(Pos.CENTER);
        hbox.setPadding(new Insets(top, right, bottom, left));
        return hbox;
    }
    
    public static HBox getHBox() {
        return getHBox(10,25,25,25,25);
    }
    
    public static VBox getVBox(int vgap, int top, int right, int bottom, int left) {
        VBox vbox = new VBox(vgap);
        vbox.setAlignment(Pos.CENTER);
        vbox.setPadding(new Insets(top, right, bottom, left));
        return vbox;
    }
    
    public static VBox getVBox() {
        return getVBox(10,25,25,25,25);
    }   







댓글 없음:

댓글 쓰기