Ejemplo n.º 1
0
 public SaveDialog(final Stage stg, String text) {
   width = 300;
   height = 100;
   final Stage stage = new Stage();
   stage.initModality(Modality.APPLICATION_MODAL);
   stage.initOwner(stg);
   stage.setTitle("提示框");
   Group root = new Group();
   AnchorPane anchorPane = new AnchorPane();
   area = new TextArea();
   area.setFont(new Font(30));
   area.setEditable(false);
   area.setWrapText(true);
   area.setPrefWidth(width);
   area.setPrefHeight(height);
   System.out.println(area.getWidth());
   System.out.println(area.getHeight());
   Scene scene = new Scene(root, width, height);
   area.setText(text);
   anchorPane.getChildren().add(area);
   root.getChildren().add(anchorPane);
   stage.setScene(scene);
   stage.show();
 }