当前位置: 首页>>代码示例>>Java>>正文


Java GridPane.setMaxSize方法代码示例

本文整理汇总了Java中javafx.scene.layout.GridPane.setMaxSize方法的典型用法代码示例。如果您正苦于以下问题:Java GridPane.setMaxSize方法的具体用法?Java GridPane.setMaxSize怎么用?Java GridPane.setMaxSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.scene.layout.GridPane的用法示例。


在下文中一共展示了GridPane.setMaxSize方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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

示例2: initializeGrid

import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
private void initializeGrid() {
	grid = new GridPane();
	//grid.setAlignment(Pos.CENTER);
	grid.setHgap(10);
	grid.setVgap(10);
	grid.setPadding(new Insets(25, 25, 25, 25));
	grid.setMaxSize(Region.USE_COMPUTED_SIZE, Region.USE_COMPUTED_SIZE);
	ColumnConstraints c1 = new ColumnConstraints();
	c1.setFillWidth(true);
	c1.setHgrow(Priority.ALWAYS);
	grid.getColumnConstraints().addAll(new ColumnConstraints(), c1, new ColumnConstraints());
	RowConstraints r2 = new RowConstraints();
	r2.setFillHeight(true);
	r2.setVgrow(Priority.ALWAYS);
}
 
开发者ID:joakimkistowski,项目名称:HTTP-Load-Generator,代码行数:16,代码来源:ScriptTestWindow.java

示例3: YearViewSkin

import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
public YearViewSkin(YearView view) {
    super(view);

    view.dateProperty().addListener(evt -> updateMonths());

    GridPane gridPane = new GridPane();
    gridPane.getStyleClass().add("container");
    gridPane.setMaxSize(MAX_VALUE, MAX_VALUE);

    for (int row = 0; row < 3; row++) {
        RowConstraints rowConstraints = new RowConstraints();
        rowConstraints.setMinHeight(Region.USE_PREF_SIZE);
        rowConstraints.setPrefHeight(Region.USE_COMPUTED_SIZE);
        rowConstraints.setMaxHeight(Region.USE_COMPUTED_SIZE);
        rowConstraints.setVgrow(Priority.ALWAYS);
        rowConstraints.setValignment(VPos.CENTER);
        gridPane.getRowConstraints().add(rowConstraints);
    }

    for (int col = 0; col < 4; col++) {
        ColumnConstraints colConstraints = new ColumnConstraints();
        colConstraints.setMinWidth(Region.USE_PREF_SIZE);
        colConstraints.setPrefWidth(Region.USE_COMPUTED_SIZE);
        colConstraints.setMaxWidth(Region.USE_COMPUTED_SIZE);
        colConstraints.setHgrow(Priority.ALWAYS);
        colConstraints.setHalignment(HPos.CENTER);
        gridPane.getColumnConstraints().add(colConstraints);
    }

    for (int row = 0; row < 3; row++) {
        for (int col = 0; col < 4; col++) {
            Month month = Month.of(row * 4 + col + 1);

            YearMonthView yearMonthView = view.getMonthView(month);
            yearMonthView.setShowMonthArrows(false);
            yearMonthView.setShowTodayButton(false);
            yearMonthView.setShowUsageColors(true);
            yearMonthView.setClickBehaviour(YearMonthView.ClickBehaviour.SHOW_DETAILS);
            gridPane.add(yearMonthView, col, row);

            // do not bind date, we manage it manually
            view.bind(yearMonthView, false);
        }
    }

    getChildren().add(gridPane);

    updateMonths();
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:50,代码来源:YearViewSkin.java

示例4: LoginComponent

import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
public LoginComponent(BorderPane p) {
	GridPane g = new GridPane();

	{
		g.add(new Label("Username"), 0, 0);
		username = new TextField();
		g.add(username, 1, 0);
	}

	{
		g.add(new Label("Password"), 0, 1);
		password = new PasswordField();
		g.add(password, 1, 1);
	}

	Button button = new Button("Login");
	button.setOnAction(e -> {
		if( username.getText().equals("[email protected]") ) {
			if( password.getText().equals("test") ) {
				status = Status.ok();
			} else {
				status = Status.status(Status.State.ERROR, 2, "Invalid password for '"+username.getText()+"'", null);
			}
		} else {
			status = Status.status(Status.State.ERROR, 1, "Unknown username", null);
		}
	});
	g.add(button, 1, 2);
	g.setMaxSize(Region.USE_PREF_SIZE, Region.USE_PREF_SIZE);
	g.setMinSize(Region.USE_PREF_SIZE, Region.USE_PREF_SIZE);
	p.setCenter(g);
}
 
开发者ID:BestSolution-at,项目名称:FX-Test,代码行数:33,代码来源:BaseTestFXComponentTest.java

示例5: PrintViewSkin

import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
public PrintViewSkin(PrintView control) {
    super(control);

    GridPane gridPane = new GridPane();
    gridPane.getStyleClass().add("container");
    gridPane.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);

    RowConstraints row1 = new RowConstraints();
    RowConstraints row2 = new RowConstraints();

    ColumnConstraints col1 = new ColumnConstraints();
    ColumnConstraints col2 = new ColumnConstraints();
    ColumnConstraints col3 = new ColumnConstraints();

    row1.setVgrow(Priority.ALWAYS);
    row2.setVgrow(Priority.NEVER);

    col1.setHgrow(Priority.ALWAYS);
    col2.setHgrow(Priority.NEVER);
    col3.setHgrow(Priority.NEVER);

    row1.setFillHeight(true);
    row2.setFillHeight(true);

    col1.setFillWidth(true);
    col2.setFillWidth(true);
    col3.setFillWidth(true);

    col1.setMaxWidth(Double.MAX_VALUE);
    col3.setMaxWidth(Region.USE_PREF_SIZE);
    col3.setMinWidth(Region.USE_PREF_SIZE);

    row1.setMaxHeight(Double.MAX_VALUE);
    row2.setMinHeight(Region.USE_PREF_SIZE);

    gridPane.getRowConstraints().setAll(row1, row2);
    gridPane.getColumnConstraints().setAll(col1, col2, col3);

    // preview pane
    PreviewPane previewPane = control.getPreviewPane();
    gridPane.add(previewPane, 0, 0);
    GridPane.setRowSpan(previewPane, 2);

    // settings
    SettingsView settingsView = control.getSettingsView();
    gridPane.add(settingsView, 2, 0);

    // separator
    Separator separator = new Separator();
    separator.setOrientation(Orientation.VERTICAL);
    GridPane.setRowSpan(separator, 2);
    gridPane.add(separator, 1, 0);

    // button bar
    Button cancelBtn = new Button(Messages.getString("PrintView.CANCEL_BUTTON"));
    cancelBtn.onActionProperty().bind(control.onCancelProperty());

    Button continueBtn = new Button(Messages.getString("PrintView.CONTINUE_BUTTON"));
    continueBtn.onActionProperty().bind(control.onContinueProperty());

    HBox buttonsBar = new HBox();
    buttonsBar.getStyleClass().add("button-bar");
    buttonsBar.getChildren().addAll(cancelBtn, continueBtn);

    gridPane.add(buttonsBar, 2, 1);

    getChildren().add(gridPane);
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:69,代码来源:PrintViewSkin.java


注:本文中的javafx.scene.layout.GridPane.setMaxSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。