码迷,mamicode.com
首页 > 编程语言 > 详细

javafx tabPane

时间:2015-08-12 16:36:05      阅读:402      评论:0      收藏:0      [点我收藏+]

标签:

public class EffectTest extends Application {
 @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);
            tab.setContent(hbox);
            
            tab.setClosable(false);
            
            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();
    }
}
//  

 

javafx tabPane

标签:

原文地址:http://www.cnblogs.com/rojas/p/4724568.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!