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


Java GridPane.setMaxWidth方法代碼示例

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


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

示例1: createExpandableContent

import javafx.scene.layout.GridPane; //導入方法依賴的package包/類
private static GridPane createExpandableContent(String content) {
	Label label = new Label("Exception stacktrace");

	TextArea textArea = new TextArea(content);
	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:vibridi,項目名稱:fxutils,代碼行數:20,代碼來源:FXDialog.java

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

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

示例4: makeGrid

import javafx.scene.layout.GridPane; //導入方法依賴的package包/類
private void makeGrid() {
	myGrid = new GridPane();
	myGrid.setMaxHeight(getScreenHeight());
	myGrid.setMaxWidth(getScreenWidth());
	for (int i = 0; i < getNumRows(); i++) {
		RowConstraints row = new RowConstraints(getScreenHeight()/getNumRows());
		myGrid.getRowConstraints().add(row);
	}
	for (int j = 0; j < getNumCols(); j++) {
		ColumnConstraints col = new ColumnConstraints(getScreenWidth()/getNumCols());
		myGrid.getColumnConstraints().add(col);
	}
	for (int i = 0; i < getNumRows(); i++) {
		for (int j = 0; j < getNumCols(); j++) {
			myGrid.add(new Rectangle(CELL_SIZE, CELL_SIZE, Color.WHITESMOKE), j, i);
		}
	}
	this.getChildren().clear();
	this.getChildren().add(myGrid);
}
 
開發者ID:LtubSalad,項目名稱:voogasalad-ltub,代碼行數:21,代碼來源:ScreenMap.java

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

示例6: createSideBar

import javafx.scene.layout.GridPane; //導入方法依賴的package包/類
private Node createSideBar(ObservableList<SamplePage> relatedSamples) {
    GridPane sidebar = new GridPane() {
        // stretch to allways fill height of scrollpane
        @Override protected double computePrefHeight(double width) {
            return Math.max(
                    super.computePrefHeight(width),
                    getParent().getBoundsInLocal().getHeight()
            );
        }
    };
    sidebar.getStyleClass().add("right-sidebar");
    sidebar.setMaxWidth(Double.MAX_VALUE);
    sidebar.setMaxHeight(Double.MAX_VALUE);
    int sideRow = 0;
    // create side bar content
    // description
    Label discTitle = new Label("Related Samples");
    discTitle.getStyleClass().add("right-sidebar-title");
    GridPane.setConstraints(discTitle, 0, sideRow++);
    sidebar.getChildren().add(discTitle);
    // add sample tiles
    for (SamplePage sp: relatedSamples) {
        Node tile = sp.createTile();
        GridPane.setConstraints(tile, 0, sideRow++);
        sidebar.getChildren().add(tile);
    }
    return sidebar;
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:29,代碼來源:DocPage.java

示例7: buildExeptionAlert

import javafx.scene.layout.GridPane; //導入方法依賴的package包/類
private void buildExeptionAlert(ShowExceptionAlert msg, Alert alert) {
    alert.setTitle(msg.getTitle());
    alert.setHeaderText(msg.getHeaderText());
    alert.setContentText(msg.getContentText());

    // Create expandable Exception.
    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    msg.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);

    // Set expandable Exception into the dialog pane.
    alert.getDialogPane()
            .setExpandableContent(expContent);
    alert.getDialogPane()
            .getStylesheets()
            .addAll(toolBox.getStylesheets());
    alert.showAndWait();
}
 
開發者ID:mbari-media-management,項目名稱:vars-annotation,代碼行數:36,代碼來源:Alerts.java

示例8: createAlert

import javafx.scene.layout.GridPane; //導入方法依賴的package包/類
/**
 * Create an alert with a given type, title, desciption, content text and expandable content.
 *
 * @param type The type of the alert
 * @param title The title of the alert
 * @param description The description in the alert
 * @param contentText The content text for the alert
 * @param expandableContent The expandable content in the alert. This parameter may be null
 * @return The created alert
 */
public static Alert createAlert(Alert.AlertType type, String title, String description,
    String contentText, String expandableContent) {
  Alert alert = new Alert(type);
  alert.setTitle(title);
  alert.setHeaderText(description);
  alert.setContentText(contentText);

  TextArea textArea = new TextArea(expandableContent);
  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);
  
  if (expandableContent != null && expandableContent.length() > 0) {
    GridPane expContent = new GridPane();
    expContent.setMaxWidth(Double.MAX_VALUE);
    if (type.equals(Alert.AlertType.ERROR)) {
      Label label = new Label("Stack trace:");
      expContent.add(label, 0, 0);
    }
    expContent.add(textArea, 0, 1);
    alert.getDialogPane().setExpandableContent(expContent);
  }

  if (type.equals(Alert.AlertType.ERROR) && expandableContent != null) {
    System.err.println(contentText);
    System.err.println(expandableContent);
  }

  alert.getDialogPane().setId("AlertDialogPane_" + type.toString());

  return alert;
}
 
開發者ID:VerifAPS,項目名稱:stvs,代碼行數:47,代碼來源:AlertFactory.java

示例9: ExceptionMessage

import javafx.scene.layout.GridPane; //導入方法依賴的package包/類
public ExceptionMessage(String message, Exception ex) {
      super(AlertType.ERROR);
      setTitle("Exception");
      setHeaderText("Encountered an Exception");
      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);

      getDialogPane().setExpandableContent(expContent);
}
 
開發者ID:nshusa,項目名稱:rsam-gui,代碼行數:30,代碼來源:Dialogue.java

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

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

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

示例13: error

import javafx.scene.layout.GridPane; //導入方法依賴的package包/類
private static void error(String title, String header, String text, Throwable cause) {
	StringWriter stringWriter = new StringWriter(); // Doesn't need to be closed & is unbuffered
	try (PrintWriter writer = new PrintWriter(stringWriter)) {
		cause.printStackTrace(writer);
	}

	Alert alert = new Alert(AlertType.ERROR);
	setIcon(alert);
	alert.setTitle(title);
	alert.setHeaderText(header);

	String actualText = text + "\n\nPlease append this exception stacktrace when reporting this error:";
	Label textLabel = new Label(actualText);
	textLabel.setPadding(new Insets(0, 0, 10, 0));

	TextArea exceptionText = new TextArea(stringWriter.toString());
	exceptionText.setEditable(false);
	exceptionText.setMaxHeight(Double.MAX_VALUE);
	exceptionText.setMaxWidth(Double.MAX_VALUE);
	GridPane.setHgrow(exceptionText, Priority.ALWAYS);
	GridPane.setVgrow(exceptionText, Priority.ALWAYS);

	GridPane alertContent = new GridPane();
	alertContent.setMaxWidth(Double.MAX_VALUE);
	alertContent.add(textLabel, 0, 0);
	alertContent.add(exceptionText, 0, 1);

	alert.getDialogPane().setContent(alertContent);
	alert.showAndWait();
}
 
開發者ID:zeobviouslyfakeacc,項目名稱:ModLoaderInstaller,代碼行數:31,代碼來源:MainPanel.java

示例14: 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());

    if (dialog.getexception() == null) {
        alert.showAndWait();
    } 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,項目名稱:EasyDragDrop,代碼行數:36,代碼來源:JFxBuilder.java

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


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