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


Java GridPane.setHgrow方法代码示例

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


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

示例1: build

import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
@Override
public AlertDialog build() {
    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    TextArea textArea = new TextArea();
    GridPane expContent = new GridPane();
    Label label = new Label("Stacktrace:");
    label.setTextFill(Utils.getDefaultTextColor());
    initOwner(ownerStage);
    setTitle(title);
    setHeaderText(header);
    setContentText(message);

    exception.printStackTrace(pw);
    String exceptionText = sw.toString();
    textArea.setText(exceptionText);
    textArea.setEditable(false);
    textArea.setWrapText(true);
    textArea.setMaxWidth(Double.MAX_VALUE);
    textArea.setMaxHeight(Double.MAX_VALUE);
    GridPane.setVgrow(textArea, Priority.ALWAYS);
    GridPane.setHgrow(textArea, Priority.ALWAYS);
    expContent.setMaxWidth(Double.MAX_VALUE);
    expContent.add(label, 0, 0);
    expContent.add(textArea, 0, 1);

    getDialogPane().setExpandableContent(expContent);
    return this;
}
 
开发者ID:jdesive,项目名称:textmd,代码行数:30,代码来源:ExceptionAlertDialog.java

示例2: FileSelection

import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
public FileSelection(File parent) {
	DialogPane dialogPane = this.getDialogPane();
	dialogPane.setMaxWidth(1.7976931348623157E308D);
	this.directoryView = new CheckTreeView<>();
	this.directoryView.setMaxWidth(1.7976931348623157E308D);
	CheckBoxTreeItem<File> root = createTree(new CheckBoxTreeItem<>(parent));
	root.setExpanded(true);
	directoryView.setRoot(root);
	GridPane.setHgrow(this.directoryView, Priority.ALWAYS);
	GridPane.setFillWidth(this.directoryView, true);
	this.grid = new GridPane();
	this.grid.setHgap(10.0D);
	this.grid.setMaxWidth(1.7976931348623157E308D);
	this.grid.setAlignment(Pos.CENTER_LEFT);
	dialogPane.contentTextProperty().addListener((o) -> this.updateGrid());
	this.setTitle(ControlResources.getString("Dialog.confirm.title"));
	dialogPane.setHeaderText(ControlResources.getString("Dialog.confirm.header"));
	dialogPane.getStyleClass().add("text-input-dialog");
	dialogPane.getButtonTypes().addAll(new ButtonType[] { ButtonType.APPLY, ButtonType.CANCEL });
	this.updateGrid();
	this.setResultConverter((dialogButton) -> {
		ButtonBar.ButtonData data = dialogButton == null ? null : dialogButton.getButtonData();
		return data == ButtonData.APPLY ? this.getValues() : null;
	});
}
 
开发者ID:HearthProject,项目名称:OneClient,代码行数:26,代码来源:FileSelection.java

示例3: setupView

import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
private void setupView() {
    ImageView weatherIcon = new ImageView();
    weatherIcon.setImage(weatherEvent.getForecast().getWeather().getIcon());
    weatherIcon.fitWidthProperty().bind(stage.widthProperty().divide(3));
    weatherIcon.fitHeightProperty().bind(stage.heightProperty().multiply(1));
    GridPane.setHgrow(weatherIcon, Priority.ALWAYS);
    GridPane.setVgrow(weatherIcon, Priority.ALWAYS);
    GridPane.setHalignment(weatherIcon, HPos.CENTER);
    GridPane.setValignment(weatherIcon, VPos.CENTER);
    add(weatherIcon, 0, 0);

    Text txt_weather_event = new Text();
    txt_weather_event.setText(controller.getWeatherEventText());
    GridPane.setHgrow(txt_weather_event, Priority.ALWAYS);
    GridPane.setVgrow(txt_weather_event, Priority.ALWAYS);
    GridPane.setValignment(txt_weather_event, VPos.CENTER);
    add(txt_weather_event, 1, 0);
}
 
开发者ID:ykarim,项目名称:WeatherWatch,代码行数:19,代码来源:NotificationPane.java

示例4: showException

import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
public static Optional<ButtonType> showException(String header, Exception e) {
	Alert alert = getAlert(header, "错误信息追踪:", AlertType.ERROR);

	StringWriter stringWriter = new StringWriter();
	PrintWriter printWriter = new PrintWriter(stringWriter);
	e.printStackTrace(printWriter);
	String exception = stringWriter.toString();

	TextArea textArea = new TextArea(exception);
	textArea.setEditable(false);
	textArea.setWrapText(true);

	textArea.setMaxWidth(Double.MAX_VALUE);
	textArea.setMaxHeight(Double.MAX_VALUE);
	GridPane.setVgrow(textArea, Priority.ALWAYS);
	GridPane.setHgrow(textArea, Priority.ALWAYS);

	GridPane gridPane = new GridPane();
	gridPane.setMaxWidth(Double.MAX_VALUE);
	gridPane.add(textArea, 0, 0);

	alert.getDialogPane().setExpandableContent(gridPane);

	return alert.showAndWait();
}
 
开发者ID:zhazhapan,项目名称:qiniu,代码行数:26,代码来源:Dialogs.java

示例5: createExceptionTextArea

import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
protected static GridPane createExceptionTextArea(Throwable errorToDisplay) {
    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    errorToDisplay.printStackTrace(pw);
    String exceptionText = sw.toString();

    Label label = new Label("The exception stacktrace was:");

    TextArea textArea = new TextArea(exceptionText);
    textArea.setEditable(false);
    textArea.setWrapText(true);

    textArea.setMaxWidth(Double.MAX_VALUE);
    textArea.setMaxHeight(Double.MAX_VALUE);
    GridPane.setVgrow(textArea, Priority.ALWAYS);
    GridPane.setHgrow(textArea, Priority.ALWAYS);

    GridPane expContent = new GridPane();
    expContent.setMaxWidth(Double.MAX_VALUE);
    expContent.add(label, 0, 0);
    expContent.add(textArea, 0, 1);
    return expContent;
}
 
开发者ID:ciphertechsolutions,项目名称:IO,代码行数:24,代码来源:BaseController.java

示例6: updateControl

import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
private void updateControl() {
    pane.getChildren().clear();
    pane.getColumnConstraints().clear();

    // the day views
    WeekDayHeaderView view = getSkinnable();
    final int numberOfDays = view.getNumberOfDays();

    Callback<WeekDayHeaderView, WeekDayCell> cellFactory = view.getCellFactory();
    for (int i = 0; i < numberOfDays; i++) {
        ColumnConstraints con = new ColumnConstraints();
        con.setPercentWidth((double) 100 / (double) numberOfDays);
        pane.getColumnConstraints().add(con);
        WeekDayCell cell = cellFactory.call(view);
        GridPane.setHgrow(cell, Priority.ALWAYS);
        GridPane.setVgrow(cell, Priority.ALWAYS);
        GridPane.setFillHeight(cell, true);
        GridPane.setFillWidth(cell, true);

        final int dayCount = i;
        /*
         * TODO: listener must be removed when number of days change.
         */
        view.dateProperty().addListener(evt -> updateCell(cell, dayCount));
        updateCell(cell, dayCount);

        pane.add(cell, i, 0);
    }
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:30,代码来源:WeekDayHeaderViewSkin.java

示例7: updateBackgrounds

import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
private void updateBackgrounds() {
    // the day views

    pane.getChildren().clear();
    List<ColumnConstraints> constraints = new ArrayList<>();

    int numberOfDays = getSkinnable().getNumberOfDays();
    for (int i = 0; i < numberOfDays; i++) {
        ColumnConstraints con = new ColumnConstraints();
        con.setPercentWidth((double) 100 / (double) numberOfDays);
        constraints.add(con);
        Region region = new Region();
        region.setMaxWidth(Double.MAX_VALUE);
        region.getStyleClass().add(ALL_DAY_BACKGROUND_REGION);
        GridPane.setHgrow(region, Priority.ALWAYS);
        GridPane.setVgrow(region, Priority.ALWAYS);
        GridPane.setFillHeight(region, true);
        GridPane.setFillWidth(region, true);

        final int day = i;
        getSkinnable().dateProperty().addListener(evt -> updateRegion(region, day));
        updateRegion(region, day);

        pane.add(region, i, 0);
    }

    pane.getColumnConstraints().setAll(constraints);

    getSkinnable().requestLayout();
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:31,代码来源:AllDayViewSkin.java

示例8: exceptionAlert

import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
public static ViewerAlert exceptionAlert(Throwable ex) {
    ViewerAlert alert = new ViewerAlert(AlertType.ERROR);

    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    ex.printStackTrace(pw);
    String exceptionText = sw.toString();

    Label label = new Label("The exception stacktrace was:");

    TextArea textArea = new TextArea(exceptionText);
    textArea.setEditable(false);
    textArea.setWrapText(true);
    //textArea.setFont(FontUtils.textFont);

    textArea.setMaxWidth(Double.MAX_VALUE);
    textArea.setMaxHeight(Double.MAX_VALUE);
    GridPane.setVgrow(textArea, Priority.ALWAYS);
    GridPane.setHgrow(textArea, Priority.ALWAYS);

    GridPane expContent = new GridPane();
    expContent.setMaxWidth(Double.MAX_VALUE);
    expContent.add(label, 0, 0);
    expContent.add(textArea, 0, 1);

    alert.getDialogPane().setExpandableContent(expContent);
    return alert;
}
 
开发者ID:Glavo,项目名称:ClassViewer,代码行数:29,代码来源:ViewerAlert.java

示例9: createAlertDialog

import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
private void createAlertDialog(DialogObject dialog) {
    Alert alert = new Alert(dialog.getType());
    alert.setTitle(dialog.getTitle());
    alert.setHeaderText(dialog.getHeader());
    alert.setContentText(dialog.getContent());

    Optional<ButtonType> result = alert.showAndWait();
    if (result.get() == ButtonType.OK) {
        System.exit(0);
    } else {
        StringWriter sw = new StringWriter();
        PrintWriter pw = new PrintWriter(sw);
        dialog.getexception().printStackTrace(pw);
        String exceptionText = sw.toString();

        Label label = new Label("The exception stacktrace was:");

        TextArea textArea = new TextArea(exceptionText);
        textArea.setEditable(false);
        textArea.setWrapText(true);

        textArea.setMaxWidth(Double.MAX_VALUE);
        textArea.setMaxHeight(Double.MAX_VALUE);
        GridPane.setVgrow(textArea, Priority.ALWAYS);
        GridPane.setHgrow(textArea, Priority.ALWAYS);

        GridPane expContent = new GridPane();
        expContent.setMaxWidth(Double.MAX_VALUE);
        expContent.add(label, 0, 0);
        expContent.add(textArea, 0, 1);

        alert.getDialogPane().setExpandableContent(expContent);

        alert.showAndWait();
    }
}
 
开发者ID:PanagiotisDrakatos,项目名称:Weather-Forecast,代码行数:37,代码来源:JFxBuilder.java

示例10: showDetailedErrorAlert

import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
public static void showDetailedErrorAlert(String title, String content, String detaildescription, String details) {
    Alert alert = new Alert(Alert.AlertType.ERROR);
    alert.setTitle(title);
    alert.setHeaderText(null);
    alert.setContentText(content);

    TextArea textArea = new TextArea(details);
    textArea.setEditable(false);
    textArea.setWrapText(true);

    Label label = new Label(detaildescription);

    textArea.setMaxWidth(Double.MAX_VALUE);
    textArea.setMaxHeight(Double.MAX_VALUE);
    GridPane.setVgrow(textArea, Priority.ALWAYS);
    GridPane.setHgrow(textArea, Priority.ALWAYS);

    GridPane expContent = new GridPane();
    expContent.setMaxWidth(Double.MAX_VALUE);
    expContent.add(label, 0, 0);
    expContent.add(textArea, 0, 1);

    // Set expandable Exception into the dialog pane.
    alert.getDialogPane().setExpandableContent(expContent);

    alert.showAndWait();
}
 
开发者ID:rumangerst,项目名称:CSLMusicModStationCreator,代码行数:28,代码来源:DialogHelper.java

示例11: showErrorDialog

import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
static void showErrorDialog(Throwable ex) {
    Alert alert = new Alert(Alert.AlertType.ERROR);
    alert.setTitle("Error!");
    alert.setHeaderText(ex.getMessage());

    // Create expandable Exception.
    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    ex.printStackTrace(pw);
    String exceptionText = sw.toString();

    Label label = new Label("The exception stacktrace was:");

    TextArea textArea = new TextArea(exceptionText);
    textArea.setEditable(false);
    textArea.setWrapText(false);

    textArea.setMaxWidth(Double.MAX_VALUE);
    textArea.setMaxHeight(Double.MAX_VALUE);
    GridPane.setVgrow(textArea, Priority.ALWAYS);
    GridPane.setHgrow(textArea, Priority.ALWAYS);

    GridPane expContent = new GridPane();
    expContent.setMaxWidth(Double.MAX_VALUE);
    expContent.add(label, 0, 0);
    expContent.add(textArea, 0, 1);

    // Set expandable Exception into the dialog pane.
    alert.getDialogPane().setContent(expContent);
    alert.showAndWait();

    ex.printStackTrace();
}
 
开发者ID:dizitart,项目名称:nitrite-database,代码行数:34,代码来源:ErrorDialog.java

示例12: showExceptionDialog

import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
public static void showExceptionDialog (String title, String headerText, String content, Throwable e) {
    //Source: http://code.makery.ch/blog/javafx-dialogs-official/

    Alert alert = new Alert(Alert.AlertType.ERROR);
    alert.setTitle(title);
    alert.setHeaderText(headerText);
    alert.setContentText(content);

    // Create expandable Exception.
    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    e.printStackTrace(pw);
    String exceptionText = sw.toString();

    Label label = new Label("The exception stacktrace was:");

    TextArea textArea = new TextArea(exceptionText);
    textArea.setEditable(false);
    textArea.setWrapText(true);

    textArea.setMaxWidth(Double.MAX_VALUE);
    textArea.setMaxHeight(Double.MAX_VALUE);
    GridPane.setVgrow(textArea, Priority.ALWAYS);
    GridPane.setHgrow(textArea, Priority.ALWAYS);

    GridPane expContent = new GridPane();
    expContent.setMaxWidth(Double.MAX_VALUE);
    expContent.add(label, 0, 0);
    expContent.add(textArea, 0, 1);

    //set expandable Exception into the dialog pane.
    alert.getDialogPane().setExpandableContent(expContent);

    alert.showAndWait();
}
 
开发者ID:leeks-and-dragons,项目名称:dialog-tool,代码行数:36,代码来源:JavaFXUtils.java

示例13: showException

import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
public static Alert showException(String message, Exception ex) {
	Alert alert = new Alert(AlertType.ERROR);
	
	alert.setTitle("Exception");
       alert.setHeaderText("Encountered an Exception");
       alert.setContentText(message);

       StringWriter sw = new StringWriter();
       PrintWriter pw = new PrintWriter(sw);
       ex.printStackTrace(pw);
       String exceptionText = sw.toString();

       Label label = new Label("The exception stacktrace was:");

       TextArea textArea = new TextArea(exceptionText);
       textArea.setEditable(false);
       textArea.setWrapText(true);

       textArea.setMaxWidth(Double.MAX_VALUE);
       textArea.setMaxHeight(Double.MAX_VALUE);
       GridPane.setVgrow(textArea, Priority.ALWAYS);
       GridPane.setHgrow(textArea, Priority.ALWAYS);

       GridPane expContent = new GridPane();
       expContent.setMaxWidth(Double.MAX_VALUE);
       expContent.add(label, 0, 0);
       expContent.add(textArea, 0, 1);

       alert.getDialogPane().setExpandableContent(expContent);        
       return alert;
}
 
开发者ID:nshusa,项目名称:osrs-data-converter,代码行数:32,代码来源:Dialogue.java

示例14: _setFormConstraints

import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
private void _setFormConstraints(ChoiceBox<?> field) {
    field.setMaxWidth(Double.MAX_VALUE);
    GridPane.setHgrow(field, Priority.ALWAYS);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:5,代码来源:FormPane.java

示例15: GoogleCalendarCreateView

import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
GoogleCalendarCreateView(Consumer<CalendarViewBean> onAccept) {
    nameField = new TextField();
    styleComboBox = new ComboBox<>();
    styleComboBox.getItems().setAll(Calendar.Style.values());
    styleComboBox.setButtonCell(new StyleCell());
    styleComboBox.setCellFactory(listView -> new StyleCell());

    Button acceptButton = new Button("Accept");
    acceptButton.disableProperty().bind(Bindings.or(Bindings.isEmpty(nameField.textProperty()), Bindings.isNull(styleComboBox.valueProperty())));
    acceptButton.setOnAction(evt -> {
        if (onAccept != null) {
            CalendarViewBean bean = new CalendarViewBean();
            bean.setName(nameField.getText());
            bean.setStyle(styleComboBox.getValue());
            onAccept.accept(bean);
        }
        close();
    });
    Button cancelButton = new Button("Cancel");
    cancelButton.setOnAction(evt -> close());

    GridPane gridPane = new GridPane();
    gridPane.add(new Label("Name"), 0, 0);
    gridPane.add(nameField, 1, 0);
    gridPane.add(new Label("Color"), 0, 1);
    gridPane.add(styleComboBox, 1, 1);
    gridPane.getStyleClass().add("center");
    gridPane.setVgap(5);
    gridPane.setHgap(5);
    gridPane.setPadding(new Insets(10));

    GridPane.setHgrow(nameField, Priority.ALWAYS);
    GridPane.setHgrow(styleComboBox, Priority.ALWAYS);

    ButtonBar buttonBar = new ButtonBar();
    buttonBar.getButtons().addAll(acceptButton, cancelButton);

    VBox bottomPane = new VBox();
    bottomPane.getChildren().addAll(new Separator(), buttonBar);
    bottomPane.getStyleClass().add("bottom");
    bottomPane.setFillWidth(true);
    bottomPane.setSpacing(10);

    setCenter(gridPane);
    setBottom(bottomPane);
    setPadding(new Insets(15));
    setPrefWidth(300);
    getStylesheets().add(CalendarView.class.getResource("calendar.css").toExternalForm());
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:50,代码来源:GoogleCalendarCreateView.java


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