當前位置: 首頁>>代碼示例>>Java>>正文


Java GridPane.setPrefSize方法代碼示例

本文整理匯總了Java中javafx.scene.layout.GridPane.setPrefSize方法的典型用法代碼示例。如果您正苦於以下問題:Java GridPane.setPrefSize方法的具體用法?Java GridPane.setPrefSize怎麽用?Java GridPane.setPrefSize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javafx.scene.layout.GridPane的用法示例。


在下文中一共展示了GridPane.setPrefSize方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: start

import javafx.scene.layout.GridPane; //導入方法依賴的package包/類
public void start(Stage primaryStage) {

        canvas = new GridPane();
        canvas.setPrefSize(800,800);
        canvas.setGridLinesVisible(true);
        final int numCols = 9 ;
        final int numRows = 8 ;
        for (int i = 0; i < numCols; i++) {
            ColumnConstraints colConst = new ColumnConstraints();
            colConst.setPercentWidth(100.0 / numCols);
            canvas.getColumnConstraints().add(colConst);
        }
        for (int i = 0; i < numRows; i++) {
            RowConstraints rowConst = new RowConstraints();
            rowConst.setPercentHeight(100.0 / numRows);
            canvas.getRowConstraints().add(rowConst);
        }


        scene = new Scene(canvas, 800, 800);
        primaryStage.setScene(scene);
        bubble = new Bubble(scene);
        primaryStage.show();

        scene.setFill(createGridPattern());


    }
 
開發者ID:schwabdidier,項目名稱:GazePlay,代碼行數:29,代碼來源:Circles_handler2.java

示例2: start

import javafx.scene.layout.GridPane; //導入方法依賴的package包/類
@Override
public void start(Stage primaryStage) throws Exception {
	GridPane pane = new GridPane();
	pane.setAlignment(Pos.CENTER);
	pane.setMaxSize(800, 600);
	pane.setPrefSize(800, 600);
	pane.setManaged(true);
	pane.setVgap(3);
	pane.setHgap(3);
	pane.addRow(1, new Label("Chess Master"));
	ComboBox<RenderWrapper> renderCombo = new ComboBox<>();
	renderCombo.getItems().addAll(new RenderWrapper(new BGFXRenderer()), new RenderWrapper(new OpenGLRenderer()));
	ChessMaster.getPluginManager().getExtensions(Renderer.class).stream().map(RenderWrapper::new).forEach(renderCombo.getItems()::add);
	pane.addRow(2, new Label("Select a renderer:"), renderCombo);
	Button button = new Button("Start!");
	button.setOnAction(event -> {
		ChessMaster.getLogger().info("Using renderer: {} ({})", renderCombo.getSelectionModel().getSelectedItem().renderer.getName(), renderCombo.getSelectionModel().getSelectedItem().renderer.getClass().getName());
		renderCombo.getSelectionModel().getSelectedItem().renderer.render();
		primaryStage.close();
	});
	pane.addRow(3, button);
	primaryStage.setScene(new Scene(pane));
	primaryStage.show();
}
 
開發者ID:HuajiStudio,項目名稱:ChessMaster,代碼行數:25,代碼來源:RenderEngineSelector.java

示例3: start

import javafx.scene.layout.GridPane; //導入方法依賴的package包/類
@Override
public void start(Stage primaryStage) {

    canvas = new GridPane();
    canvas.setPrefSize(800,800);
    canvas.setGridLinesVisible(true);
    final int numCols = 9 ;
    final int numRows = 8 ;
    for (int i = 0; i < numCols; i++) {
        ColumnConstraints colConst = new ColumnConstraints();
        colConst.setPercentWidth(100.0 / numCols);
        canvas.getColumnConstraints().add(colConst);
    }
    for (int i = 0; i < numRows; i++) {
        RowConstraints rowConst = new RowConstraints();
        rowConst.setPercentHeight(100.0 / numRows);
        canvas.getRowConstraints().add(rowConst);
    }


    scene = new Scene(canvas, 800, 800);
    primaryStage.setScene(scene);
    bubble = new Bubble(scene);
    primaryStage.show();

    scene.setFill(createGridPattern());


}
 
開發者ID:schwabdidier,項目名稱:GazePlay,代碼行數:30,代碼來源:Circles_handler.java

示例4: start

import javafx.scene.layout.GridPane; //導入方法依賴的package包/類
@Override
public void start(Stage primaryStage) {

    canvas = new GridPane();
    canvas.setPrefSize(800,800);
    canvas.setGridLinesVisible(true);
    final int numCols = 9 ;
    final int numRows = 8 ;
    for (int i = 0; i < numCols; i++) {
        ColumnConstraints colConst = new ColumnConstraints();
        colConst.setPercentWidth(100.0 / numCols);
        canvas.getColumnConstraints().add(colConst);
    }
    for (int i = 0; i < numRows; i++) {
        RowConstraints rowConst = new RowConstraints();
        rowConst.setPercentHeight(100.0 / numRows);
        canvas.getRowConstraints().add(rowConst);
    }

    scene = new Scene(canvas, 800, 800);
    primaryStage.setScene(scene);
    bubble = new Bubble(scene);
    primaryStage.show();

    scene.setFill(createGridPattern());


}
 
開發者ID:schwabdidier,項目名稱:GazePlay,代碼行數:29,代碼來源:Circles_points_handler.java

示例5: start

import javafx.scene.layout.GridPane; //導入方法依賴的package包/類
public void start(Stage primaryStage) {

        canvas = new GridPane();

        canvas.setPrefSize(1300,741);
        canvas.setGridLinesVisible(false);
        final int numCols = 13 ;
        final int numRows = 13 ;
        for (int i = 0; i < numCols; i++) {
            ColumnConstraints colConst = new ColumnConstraints();
            colConst.setPercentWidth(100.0 / numCols);
            canvas.getColumnConstraints().add(colConst);
        }
        for (int i = 0; i < numRows; i++) {
            RowConstraints rowConst = new RowConstraints();
            rowConst.setPercentHeight(100.0 / numRows);
            canvas.getRowConstraints().add(rowConst);
        }

        scene = new Scene(canvas);
        primaryStage.setScene(scene);

        //primaryStage.sizeToScene();
        //primaryStage.setFullScreen(true);
        primaryStage.show();

        scene.setFill(createGridPattern());

    }
 
開發者ID:schwabdidier,項目名稱:GazePlay,代碼行數:30,代碼來源:HeatMap.java


注:本文中的javafx.scene.layout.GridPane.setPrefSize方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。