當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。