List of usage examples for javafx.scene.control TextArea setPrefWidth
public final void setPrefWidth(double value)
From source file:Main.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle("Borders"); Group root = new Group(); Scene scene = new Scene(root, 600, 330, Color.WHITE); GridPane gridpane = new GridPane(); gridpane.setPadding(new Insets(5)); gridpane.setHgap(10);//from w ww . jav a 2 s .c o m gridpane.setVgap(10); final TextArea cssEditorFld = new TextArea(); cssEditorFld.setPrefRowCount(10); cssEditorFld.setPrefColumnCount(100); cssEditorFld.setWrapText(true); cssEditorFld.setPrefWidth(150); GridPane.setHalignment(cssEditorFld, HPos.CENTER); gridpane.add(cssEditorFld, 0, 1); String cssDefault = "line1;\nline2;\n"; cssEditorFld.setText(cssDefault); root.getChildren().add(gridpane); primaryStage.setScene(scene); primaryStage.show(); }
From source file:com.github.drbookings.ui.controller.MainController.java
private void showAbout() { final Alert alert = new Alert(AlertType.INFORMATION); alert.setTitle("About DrBookings"); final TextArea label = new TextArea(); label.setEditable(false);//from www.j a v a 2s .co m label.setPrefHeight(400); label.setPrefWidth(400); label.getStyleClass().add("copyable-label"); final StringBuilder sb = new StringBuilder(); try { sb.append("Application version\t").append(Manifests.read("Implementation-Version")).append("\n"); sb.append("Build time\t\t").append(Manifests.read("Build-Time")).append("\n"); } catch (final Exception e) { if (logger.isInfoEnabled()) { logger.error("Failed to add manifest entry", e.getLocalizedMessage()); } } label.setText(sb.toString()); alert.setHeaderText("proudly brought to you by kerner1000"); alert.setContentText(null); alert.getDialogPane().setContent(label); alert.showAndWait(); }
From source file:com.cdd.bao.editor.EditSchema.java
public void actionFileAssayStats() { List<String> stats = new ArrayList<>(); SchemaUtil.gatherAssayStats(stack.peekSchema(), stats); String text = String.join("\n", stats); Dialog<Boolean> showdlg = new Dialog<>(); showdlg.setTitle("Assay Stats"); TextArea area = new TextArea(text); area.setWrapText(true);/* ww w. j av a2 s . com*/ area.setPrefWidth(700); area.setPrefHeight(500); showdlg.getDialogPane().setContent(area); showdlg.getDialogPane().getButtonTypes().addAll(new ButtonType("OK", ButtonBar.ButtonData.OK_DONE)); showdlg.setResultConverter(buttonType -> true); showdlg.showAndWait(); }
From source file:com.cdd.bao.editor.EditSchema.java
public void actionFileMerge() { FileChooser chooser = new FileChooser(); chooser.setTitle("Merge Schema"); if (schemaFile != null) chooser.setInitialDirectory(schemaFile.getParentFile()); File file = chooser.showOpenDialog(stage); if (file == null) return;// w ww . j a v a 2s.c o m Schema addSchema = null; try { addSchema = ModelSchema.deserialise(file); } catch (IOException ex) { ex.printStackTrace(); Util.informWarning("Merge", "Failed to parse file: is it a valid schema?"); return; } List<String> log = new ArrayList<>(); Schema merged = SchemaUtil.mergeSchema(stack.getSchema(), addSchema, log); if (log.size() == 0) { Util.informMessage("Merge", "The merge file is the same: no action."); return; } String text = String.join("\n", log); Dialog<Boolean> confirm = new Dialog<>(); confirm.setTitle("Confirm Merge Modifications"); TextArea area = new TextArea(text); area.setWrapText(true); area.setPrefWidth(700); area.setPrefHeight(500); confirm.getDialogPane().setContent(area); ButtonType btnApply = new ButtonType("Apply", ButtonBar.ButtonData.OK_DONE); confirm.getDialogPane().getButtonTypes().addAll(new ButtonType("Cancel", ButtonBar.ButtonData.CANCEL_CLOSE), btnApply); confirm.setResultConverter(buttonType -> { if (buttonType == btnApply) return true; return null; }); Optional<Boolean> result = confirm.showAndWait(); if (!result.isPresent() || result.get() != true) return; stack.changeSchema(merged, true); rebuildTree(); }