Java Code Examples for javafx.scene.control.TextArea#setText()
The following examples show how to use
javafx.scene.control.TextArea#setText() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GUIUtil.java From bisq with GNU Affero General Public License v3.0 | 7 votes |
public static void showSelectableTextModal(String title, String text) { TextArea textArea = new BisqTextArea(); textArea.setText(text); textArea.setEditable(false); textArea.setWrapText(true); textArea.setPrefSize(800, 600); Scene scene = new Scene(textArea); Stage stage = new Stage(); if (null != title) { stage.setTitle(title); } stage.setScene(scene); stage.initModality(Modality.NONE); stage.initStyle(StageStyle.UTILITY); stage.show(); }
Example 2
Source File: VoteResultView.java From bisq with GNU Affero General Public License v3.0 | 6 votes |
private void maybeShowVoteResultErrors(Cycle cycle) { List<VoteResultException> exceptions = voteResultService.getVoteResultExceptions().stream() .filter(voteResultException -> cycle.getHeightOfFirstBlock() == voteResultException.getHeightOfFirstBlockInCycle()) .collect(Collectors.toList()); if (!exceptions.isEmpty()) { TextArea textArea = FormBuilder.addTextArea(root, ++gridRow, ""); GridPane.setMargin(textArea, new Insets(Layout.GROUP_DISTANCE, -15, 0, -10)); textArea.setPrefHeight(100); StringBuilder sb = new StringBuilder(Res.getWithCol("dao.results.exceptions") + "\n"); exceptions.forEach(exception -> { if (exception.getCause() != null) sb.append(exception.getCause().getMessage()); else sb.append(exception.getMessage()); sb.append("\n"); }); textArea.setText(sb.toString()); } }
Example 3
Source File: SimplePopups.java From pmd-designer with BSD 2-Clause "Simplified" License | 6 votes |
public static void showAboutPopup(DesignerRoot root) { Alert licenseAlert = new Alert(AlertType.INFORMATION); licenseAlert.setWidth(500); licenseAlert.setHeaderText("About"); ScrollPane scroll = new ScrollPane(); TextArea textArea = new TextArea(); String sb = "PMD core version:\t\t\t" + PMDVersion.VERSION + "\n" + "Designer version:\t\t\t" + Designer.getCurrentVersion() + " (supports PMD core " + Designer.getPmdCoreMinVersion() + ")\n" + "Designer settings dir:\t\t" + root.getService(DesignerRoot.DISK_MANAGER).getSettingsDirectory() + "\n" + "Available languages:\t\t" + AuxLanguageRegistry.getSupportedLanguages().map(Language::getTerseName).collect(Collectors.toList()) + "\n"; textArea.setText(sb); scroll.setContent(textArea); licenseAlert.getDialogPane().setContent(scroll); licenseAlert.showAndWait(); }
Example 4
Source File: TextFileEditor.java From jmonkeybuilder with Apache License 2.0 | 6 votes |
@Override @FxThread public void openFile(@NotNull final Path file) { super.openFile(file); setOriginalContent(FileUtils.read(file)); /* TODO added to handle some exceptions try { } catch (final MalformedInputException e) { throw new RuntimeException("This file isn't a text file.", e); } */ final TextArea textArea = getTextArea(); textArea.setText(getOriginalContent()); }
Example 5
Source File: TextFilePreview.java From jmonkeybuilder with Apache License 2.0 | 6 votes |
@Override @FxThread public void show(@NotNull final String resource) { super.show(resource); final ResourceManager resourceManager = ResourceManager.getInstance(); final URL url = resourceManager.tryToFindResource(resource); String content; if (url != null) { content = Utils.get(url, toRead -> FileUtils.read(toRead.openStream())); } else { final Path realFile = EditorUtil.getRealFile(resource); content = realFile == null ? "" : FileUtils.read(realFile); } final TextArea textArea = getGraphicsNode(); textArea.setText(content); }
Example 6
Source File: F2FForm.java From bisq with GNU Affero General Public License v3.0 | 6 votes |
@Override public void addFormForDisplayAccount() { gridRowFrom = gridRow; addTopLabelTextField(gridPane, gridRow, Res.get("payment.account.name"), paymentAccount.getAccountName(), Layout.FIRST_ROW_AND_GROUP_DISTANCE); addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("shared.paymentMethod"), Res.get(paymentAccount.getPaymentMethod().getId())); addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("payment.country"), getCountryBasedPaymentAccount().getCountry() != null ? getCountryBasedPaymentAccount().getCountry().name : ""); TradeCurrency singleTradeCurrency = paymentAccount.getSingleTradeCurrency(); String nameAndCode = singleTradeCurrency != null ? singleTradeCurrency.getNameAndCode() : "null"; addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("shared.currency"), nameAndCode); addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("payment.f2f.contact", f2fAccount.getContact()), f2fAccount.getContact()); addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("payment.f2f.city", f2fAccount.getCity()), f2fAccount.getCity()); TextArea textArea = addCompactTopLabelTextArea(gridPane, ++gridRow, Res.get("payment.f2f.extra"), "").second; textArea.setText(f2fAccount.getExtraInfo()); textArea.setPrefHeight(60); textArea.setEditable(false); addLimitations(true); }
Example 7
Source File: BrowserTab.java From marathonv5 with Apache License 2.0 | 5 votes |
public void addArguments() { arguments = new TextArea(); arguments.setPrefRowCount(3); arguments.setText(BrowserConfig.instance().getValue(getBrowserName(), "browser-arguments", "")); Label prompt = new Label("One argument per line."); basicPane.addFormField("Browser Arguments:", prompt, 2, 3); basicPane.addFormField("", arguments); }
Example 8
Source File: BrowserTab.java From marathonv5 with Apache License 2.0 | 5 votes |
public void addEnvironment() { environment = new TextArea(); environment.setText(BrowserConfig.instance().getValue(getBrowserName(), "browser-environment", "")); environment.setPrefRowCount(3); Label prompt = new Label("One variable per line. Eg:\nTMP=/temp-browser\n"); advancedPane.addFormField("Environment Variables:", prompt, 2, 1); advancedPane.addFormField("", environment); }
Example 9
Source File: TextFilePreview.java From jmonkeybuilder with Apache License 2.0 | 5 votes |
@Override @FxThread public void show(@NotNull final Path file) { super.show(file); final TextArea textArea = getGraphicsNode(); textArea.setText(FileUtils.read(file)); }
Example 10
Source File: DialogErrorContent.java From WorkbenchFX with Apache License 2.0 | 5 votes |
/** * Creates a control which shows the details of an exception or error to be used as the content of * a {@link WorkbenchDialog}. * * @param message the {@link Node} containing the standard dialog message * @param details about the error or exception */ public DialogErrorContent(Node message, String details) { this.message = message; this.details = details; getStyleClass().add("container"); // add message to the dialog content getChildren().add(message); // if details were specified, add them wrapped in a TitledPane if (!Strings.isNullOrEmpty(details)) { TextArea textArea = new TextArea(); textArea.setText(details); textArea.setWrapText(true); textArea.getStyleClass().add("error-details-text-area"); TitledPane titledPane = new TitledPane(); titledPane.getStyleClass().add("error-details-titled-pane"); titledPane.setText("Details"); titledPane.setContent(textArea); titledPane.setPrefHeight(300); getChildren().add(titledPane); } }
Example 11
Source File: TextFileEditor.java From jmonkeybuilder with Apache License 2.0 | 5 votes |
@Override @FxThread protected void handleExternalChanges() { super.handleExternalChanges(); final String newContent = FileUtils.read(getEditFile()); final TextArea textArea = getTextArea(); final String currentContent = textArea.getText(); textArea.setText(newContent); setOriginalContent(currentContent); updateDirty(newContent); }
Example 12
Source File: ExceptionHandler.java From arma-dialog-creator with MIT License | 5 votes |
/** Returns a TextArea with the Throwable's stack trace printed inside it @param thread thread where the Throwable occurred @param t throwable @return TextArea */ @NotNull public static TextArea getExceptionTextArea(Thread thread, Throwable t) { String err = getExceptionString(t); TextArea ta = new TextArea(); ta.setPrefSize(700, 700); ta.setText(err + "\nTHREAD:" + thread.getName()); ta.setEditable(false); return ta; }
Example 13
Source File: UpdatesView.java From Maus with GNU General Public License v3.0 | 5 votes |
private HBox getUpdatesPanel() { TextArea updates = new TextArea(); updates.setPrefWidth(600); updates.setEditable(false); try { updates.setText(new Scanner(new URL("https://raw.githubusercontent.com/Ghosts/Maus/master/Changelog.txt").openStream(), "UTF-8").useDelimiter("\\A").next()); } catch (IOException e) { e.printStackTrace(); } return Styler.hContainer(updates); }
Example 14
Source File: CashDepositForm.java From bisq with GNU Affero General Public License v3.0 | 4 votes |
@Override public void addFormForDisplayAccount() { gridRowFrom = gridRow; String countryCode = cashDepositAccountPayload.getCountryCode(); addTopLabelTextField(gridPane, gridRow, Res.get("payment.account.name"), paymentAccount.getAccountName(), Layout.FIRST_ROW_AND_GROUP_DISTANCE); addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("shared.paymentMethod"), Res.get(paymentAccount.getPaymentMethod().getId())); addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("payment.country"), getCountryBasedPaymentAccount().getCountry() != null ? getCountryBasedPaymentAccount().getCountry().name : ""); TradeCurrency singleTradeCurrency = paymentAccount.getSingleTradeCurrency(); String nameAndCode = singleTradeCurrency != null ? singleTradeCurrency.getNameAndCode() : "null"; addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("shared.currency"), nameAndCode); addHolderNameAndIdForDisplayAccount(); addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("payment.email"), cashDepositAccountPayload.getHolderEmail()); if (BankUtil.isBankNameRequired(countryCode)) addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("payment.bank.name"), cashDepositAccountPayload.getBankName()).second.setMouseTransparent(false); if (BankUtil.isBankIdRequired(countryCode)) addCompactTopLabelTextField(gridPane, ++gridRow, BankUtil.getBankIdLabel(countryCode), cashDepositAccountPayload.getBankId()).second.setMouseTransparent(false); if (BankUtil.isBranchIdRequired(countryCode)) addCompactTopLabelTextField(gridPane, ++gridRow, BankUtil.getBranchIdLabel(countryCode), cashDepositAccountPayload.getBranchId()).second.setMouseTransparent(false); if (BankUtil.isNationalAccountIdRequired(countryCode)) addCompactTopLabelTextField(gridPane, ++gridRow, BankUtil.getNationalAccountIdLabel(countryCode), cashDepositAccountPayload.getNationalAccountId()).second.setMouseTransparent(false); if (BankUtil.isAccountNrRequired(countryCode)) addCompactTopLabelTextField(gridPane, ++gridRow, BankUtil.getAccountNrLabel(countryCode), cashDepositAccountPayload.getAccountNr()).second.setMouseTransparent(false); if (BankUtil.isAccountTypeRequired(countryCode)) addCompactTopLabelTextField(gridPane, ++gridRow, BankUtil.getAccountTypeLabel(countryCode), cashDepositAccountPayload.getAccountType()).second.setMouseTransparent(false); String requirements = cashDepositAccountPayload.getRequirements(); boolean showRequirements = requirements != null && !requirements.isEmpty(); if (showRequirements) { TextArea textArea = addCompactTopLabelTextArea(gridPane, ++gridRow, Res.get("payment.extras"), "").second; textArea.setMinHeight(30); textArea.setMaxHeight(30); textArea.setEditable(false); textArea.setId("text-area-disabled"); textArea.setText(requirements); } addLimitations(true); }
Example 15
Source File: ShowWalletDataWindow.java From bisq with GNU Affero General Public License v3.0 | 4 votes |
private void showWallet(TextArea textArea, CheckBox includePrivKeysCheckBox) { textArea.setText(walletsManager.getWalletsAsString(includePrivKeysCheckBox.isSelected())); }
Example 16
Source File: DataCollectionUI.java From SONDY with GNU General Public License v3.0 | 4 votes |
public final void newSourceUI(){ GridPane gridLEFT = new GridPane(); // Labels Label sourceIdentifierLabel = new Label("Source ID"); UIUtils.setSize(sourceIdentifierLabel, Main.columnWidthLEFT/2, 24); Label sourceTypeLabel = new Label("Source type"); UIUtils.setSize(sourceTypeLabel, Main.columnWidthLEFT/2, 24); Label sourceConfigLabel = new Label("Source configuration"); sourceConfigLabel.setAlignment(Pos.CENTER_LEFT); UIUtils.setSize(sourceConfigLabel, Main.columnWidthLEFT/2, 150); gridLEFT.add(sourceTypeLabel,0,0); gridLEFT.add(new Rectangle(0,3),0,1); gridLEFT.add(sourceIdentifierLabel,0,2); gridLEFT.add(new Rectangle(0,3),0,3); gridLEFT.add(sourceConfigLabel,0,4); // Values sourceTypeList = new ChoiceBox(); ObservableList<String> list = FXCollections.observableArrayList(); list.add("Twitter"); sourceTypeList.setItems(list); UIUtils.setSize(sourceTypeList,Main.columnWidthLEFT/2, 24); newSourceIdentifierField = new TextField(); newSourceIdentifierField.setPromptText("unique identifier"); UIUtils.setSize(newSourceIdentifierField,Main.columnWidthLEFT/2, 24); configurationTextArea = new TextArea(); configurationTextArea.setText("# This is a configuration file for Twitter\n" + "# It is formatted as a Java properties file\n" + "# i.e. a property (key = value) per line \n" + "OAuthConsumerKey = w9ixmKqezBWtyughn4y7w\n" + "OAuthConsumerSecret = mQ7L6cfSRPRAdUoiIOSWRYaHBeU5yBTRPGgc8fFdY\n" + "OAuthAccessToken = 2371904670-XAnOV6XquVDuWzXwwhAvKiZ9T1DI9ziM3r7Cz3s\n" + "OAuthAccessTokenSecret = wRwJhSq1m7zZeQYeTgivVSZ6H7acsv0KNiznF3StoH4TU"); UIUtils.setSize(configurationTextArea, Main.columnWidthLEFT/2, 150); gridLEFT.add(sourceTypeList,1,0); gridLEFT.add(newSourceIdentifierField,1,2); gridLEFT.add(configurationTextArea,1,4); HBox importDatasetBOTH = new HBox(5); importDatasetBOTH.getChildren().addAll(gridLEFT,createNewSourceButton()); grid.add(importDatasetBOTH,0,5); }
Example 17
Source File: UserView.java From NLIDB with Apache License 2.0 | 4 votes |
@Override public void start(Stage primaryStage) throws Exception { stage = primaryStage; stage.setTitle("Window for NLIDB"); Label label1 = new Label("Welcome to Natural Language Interface to DataBase!"); Label lblInput = new Label("Natural Language Input:"); TextArea fieldIn = new TextArea(); fieldIn.setPrefHeight(100); fieldIn.setPrefWidth(100); fieldIn.setWrapText(true); fieldIn.setText(TEST_TEXT); btnTranslate = new Button("translate"); // Define action of the translate button. btnTranslate.setOnAction(e -> { ctrl.processNaturalLanguage(fieldIn.getText()); }); display = new Text(); display.setWrappingWidth(500); display.prefHeight(300); display.setText("Default display text"); // choices and button for nodes mapping choiceBox = new ComboBox<NodeInfo>(); choiceBox.setVisibleRowCount(6); btnConfirmChoice = new Button("confirm choice"); btnConfirmChoice.setOnAction(e -> { ctrl.chooseNode(getChoice()); }); // choices and button for tree selection treeChoice = new ComboBox<Integer>(); // ! only show 3 choices now treeChoice.setItems(FXCollections.observableArrayList(0,1,2)); treeChoice.getSelectionModel().selectedIndexProperty().addListener((ov, oldV, newV) -> { ctrl.showTree(treeChoice.getItems().get((Integer) newV)); }); btnTreeConfirm = new Button("confirm tree choice"); btnTreeConfirm.setOnAction(e -> { ctrl.chooseTree(treeChoice.getValue()); }); vb1 = new VBox(); vb1.setSpacing(10); vb1.getChildren().addAll( label1, lblInput,fieldIn, btnTranslate ); vb2 = new VBox(); vb2.setSpacing(20); vb2.getChildren().addAll(display); hb = new HBox(); hb.setPadding(new Insets(15, 12, 15, 12)); hb.setSpacing(10); hb.getChildren().addAll(vb1, vb2); scene = new Scene(hb, 800, 450); stage.setScene(scene); ctrl = new Controller(this); stage.show(); }
Example 18
Source File: PropertySheet.java From JetUML with GNU General Public License v3.0 | 4 votes |
private Control createExtendedStringEditor(Property pProperty) { final int rows = 5; final int columns = 30; final TextArea textArea = new TextArea(); textArea.setPrefRowCount(rows); textArea.setPrefColumnCount(columns); textArea.addEventFilter(KeyEvent.KEY_PRESSED, pKeyEvent -> { final String aFocusEventText = "TAB_TO_FOCUS_EVENT"; if (!KeyCode.TAB.equals(pKeyEvent.getCode())) { return; } if (pKeyEvent.isAltDown() || pKeyEvent.isMetaDown() || pKeyEvent.isShiftDown() || !(pKeyEvent.getSource() instanceof TextArea)) { return; } final TextArea textAreaSource = (TextArea) pKeyEvent.getSource(); if (pKeyEvent.isControlDown()) { if (!aFocusEventText.equalsIgnoreCase(pKeyEvent.getText())) { pKeyEvent.consume(); textAreaSource.replaceSelection("\t"); } } else { pKeyEvent.consume(); final KeyEvent tabControlEvent = new KeyEvent(pKeyEvent.getSource(), pKeyEvent.getTarget(), pKeyEvent.getEventType(), pKeyEvent.getCharacter(), aFocusEventText, pKeyEvent.getCode(), pKeyEvent.isShiftDown(), true, pKeyEvent.isAltDown(), pKeyEvent.isMetaDown()); textAreaSource.fireEvent(tabControlEvent); } }); textArea.setText((String) pProperty.get()); textArea.textProperty().addListener((pObservable, pOldValue, pNewValue) -> { pProperty.set(textArea.getText()); aListener.propertyChanged(); }); return new ScrollPane(textArea); }
Example 19
Source File: InfoBox.java From scenic-view with GNU General Public License v3.0 | 4 votes |
public InfoBox(final Window owner, final String title, final String labelText, final String textAreaText, final boolean editable, final int width, final int height) { final VBox pane = new VBox(20); pane.setId(StageController.FX_CONNECTOR_BASE_ID + "InfoBox"); final Scene scene = new Scene(pane, width, height); final Stage stage = new Stage(StageStyle.UTILITY); stage.setTitle(title); stage.initModality(Modality.WINDOW_MODAL); stage.initOwner(owner); stage.setScene(scene); stage.getIcons().add(ScenicViewGui.APP_ICON); final Label label = new Label(labelText); stage.setWidth(width); stage.setHeight(height); textArea = new TextArea(); if (textAreaText != null) { textArea.setEditable(editable); textArea.setText(textAreaText); VBox.setMargin(textArea, new Insets(5, 5, 0, 5)); VBox.setVgrow(textArea, Priority.ALWAYS); } final Button close = new Button("Close"); VBox.setMargin(label, new Insets(5, 5, 0, 5)); VBox.setMargin(close, new Insets(5, 5, 5, 5)); pane.setAlignment(Pos.CENTER); close.setDefaultButton(true); close.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(final ActionEvent arg0) { stage.close(); } }); if (textArea != null) { pane.getChildren().addAll(label, textArea, close); } else { pane.getChildren().addAll(label, close); } stage.show(); }
Example 20
Source File: UnitDescriptionStage.java From mars-sim with GNU General Public License v3.0 | 3 votes |
public BorderPane init(String unitName, String unitType, String unitDescription) { //this.setSize(350, 400); // undecorated 301, 348 ; decorated : 303, 373 mainPane = new BorderPane(); name = new Label(unitName); name.setPadding(new Insets(5,5,5,5)); name.setTextAlignment(TextAlignment.CENTER); name.setContentDisplay(ContentDisplay.TOP); box0 = new VBox(); box0.setAlignment(Pos.CENTER); box0.setPadding(new Insets(5,5,5,5)); box0.getChildren().addAll(name); mainPane.setTop(box0); String type = "TYPE :"; String description = "DESCRIPTION :"; box1 = new VBox(); ta = new TextArea(); ta.setEditable(false); ta.setWrapText(true); box1.getChildren().add(ta); ta.setText(System.lineSeparator() + type + System.lineSeparator() + unitType + System.lineSeparator() + System.lineSeparator()); ta.appendText(description + System.lineSeparator() + unitDescription + System.lineSeparator() + System.lineSeparator()); ta.setScrollTop(300); applyTheme(); mainPane.setCenter(ta); return mainPane; }