List of usage examples for javafx.scene.control TextArea TextArea
public TextArea()
From source file:Main.java
@Override public void start(Stage stage) { VBox root = new VBox(5); Label textLbl = new Label("Text:"); TextArea text = new TextArea(); text.setPrefRowCount(10);//from w w w .ja v a 2s. c om text.setPrefColumnCount(20); text.setWrapText(true); // Button to print the TextArea node Button printTextBtn = new Button("Print Text"); printTextBtn.setOnAction(e -> print(text)); // Button to print the entire scene Button printSceneBtn = new Button("Print Scene"); printSceneBtn.setOnAction(e -> print(root)); HBox buttonBox = new HBox(5, printTextBtn, printSceneBtn); root.getChildren().addAll(textLbl, text, buttonBox); Scene scene = new Scene(root); stage.setScene(scene); stage.setTitle("Printing Nodes"); stage.show(); }
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 w w . jav a2 s . com*/ 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:Main.java
@Override public void start(Stage primaryStage) { TextArea myTextArea = new TextArea(); VBox hbox = new VBox(); hbox.getChildren().add(myTextArea); VBox.setVgrow(myTextArea, Priority.ALWAYS); Scene scene = new Scene(hbox, 320, 112, Color.rgb(0, 0, 0, 0)); primaryStage.setScene(scene);// ww w . j a va 2s.c o m primaryStage.show(); }
From source file:de.chaosfisch.uploader.gui.renderer.TagTextArea.java
private void initTextArea() { final TextArea textArea = new TextArea(); textArea.setWrapText(true);//from ww w . j a va 2s . c o m textArea.textProperty().bindBidirectional(tags); getChildren().add(textArea); }
From source file:Main.java
private VBox getCenter() { Label nameLbl = new Label("Name:"); TextField nameFld = new TextField(); HBox.setHgrow(nameFld, Priority.ALWAYS); HBox nameFields = new HBox(nameLbl, nameFld); Label descLbl = new Label("Description:"); TextArea descText = new TextArea(); descText.setPrefColumnCount(20);// ww w.j a v a 2 s . c om descText.setPrefRowCount(5); VBox.setVgrow(descText, Priority.ALWAYS); VBox center = new VBox(nameFields, descLbl, descText); return center; }
From source file:org.kordamp.javatrove.example04.util.ApplicationEventHandler.java
@Handler public void handleThrowable(ThrowableEvent event) { Platform.runLater(() -> {/* w w w . j a v a2 s . c o m*/ TitledPane pane = new TitledPane(); pane.setCollapsible(false); pane.setText("Stacktrace"); TextArea textArea = new TextArea(); textArea.setEditable(false); pane.setContent(textArea); ByteArrayOutputStream baos = new ByteArrayOutputStream(); event.getThrowable().printStackTrace(new PrintStream(baos)); textArea.setText(baos.toString()); Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("Error"); alert.setHeaderText("An unexpected error occurred"); alert.getDialogPane().setContent(pane); alert.showAndWait(); }); }
From source file:Main.java
@Override public void start(Stage primaryStage) { final Label label = new Label("Progress:"); final ProgressBar progressBar = new ProgressBar(0); final ProgressIndicator progressIndicator = new ProgressIndicator(0); final Button startButton = new Button("Start"); final Button cancelButton = new Button("Cancel"); final TextArea textArea = new TextArea(); startButton.setOnAction((ActionEvent event) -> { startButton.setDisable(true);// w w w.j ava2s . c om progressBar.setProgress(0); progressIndicator.setProgress(0); textArea.setText(""); cancelButton.setDisable(false); copyWorker = createWorker(numFiles); progressBar.progressProperty().unbind(); progressBar.progressProperty().bind(copyWorker.progressProperty()); progressIndicator.progressProperty().unbind(); progressIndicator.progressProperty().bind(copyWorker.progressProperty()); copyWorker.messageProperty().addListener( (ObservableValue<? extends String> observable, String oldValue, String newValue) -> { textArea.appendText(newValue + "\n"); }); new Thread(copyWorker).start(); }); cancelButton.setOnAction((ActionEvent event) -> { startButton.setDisable(false); cancelButton.setDisable(true); copyWorker.cancel(true); progressBar.progressProperty().unbind(); progressBar.setProgress(0); progressIndicator.progressProperty().unbind(); progressIndicator.setProgress(0); textArea.appendText("File transfer was cancelled."); }); BorderPane root = new BorderPane(); Scene scene = new Scene(root, 500, 250, javafx.scene.paint.Color.WHITE); FlowPane topPane = new FlowPane(5, 5); topPane.setPadding(new Insets(5)); topPane.setAlignment(Pos.CENTER); topPane.getChildren().addAll(label, progressBar, progressIndicator); GridPane middlePane = new GridPane(); middlePane.setPadding(new Insets(5)); middlePane.setHgap(20); middlePane.setVgap(20); ColumnConstraints column1 = new ColumnConstraints(300, 400, Double.MAX_VALUE); middlePane.getColumnConstraints().addAll(column1); middlePane.setAlignment(Pos.CENTER); middlePane.add(textArea, 0, 0); FlowPane bottomPane = new FlowPane(5, 5); bottomPane.setPadding(new Insets(5)); bottomPane.setAlignment(Pos.CENTER); bottomPane.getChildren().addAll(startButton, cancelButton); root.setTop(topPane); root.setCenter(middlePane); root.setBottom(bottomPane); primaryStage.setScene(scene); primaryStage.show(); }
From source file:org.jamocha.gui.JamochaGui.java
private Scene generateScene() { final TabPane tabPane = new TabPane(); tabPane.setSide(Side.LEFT);//from ww w . j a v a2 s .c o m this.log = new TextArea(); final Tab logTab = new Tab("Log"); logTab.setContent(this.log); logTab.setClosable(false); final Tab networkTab = new Tab("Network"); networkTab.setClosable(false); final ScrollPane scrollPane = new ScrollPane(); networkTab.setContent(scrollPane); this.networkVisualisation = new NetworkVisualisation(this.jamocha.getNetwork()); this.networkVisualisation.setTranslateX(10); this.networkVisualisation.setTranslateY(10); this.networkVisualisation.update(); scrollPane.setContent(this.networkVisualisation); tabPane.getTabs().addAll(logTab, networkTab); final Scene scene = new Scene(tabPane); tabPane.prefHeightProperty().bind(scene.heightProperty()); tabPane.prefWidthProperty().bind(scene.widthProperty()); return scene; }
From source file:FeeBooster.java
@Override public void start(Stage primaryStage) throws Exception { // Setup the stage stage = primaryStage;//from www . j a v a2s .c o m primaryStage.setTitle("Bitcoin Transaction Fee Booster"); // Setup intro gridpane GridPane grid = new GridPane(); grid.setAlignment(Pos.CENTER); grid.setHgap(10); grid.setVgap(10); grid.setPadding(new Insets(25, 25, 25, 25)); // Intro Text Text scenetitle = new Text( "Welcome to the fee booster. \n\nWhat type of transaction would you like to boost the fee of?"); grid.add(scenetitle, 0, 0, 2, 3); // radio button selections VBox boostRadioVbox = new VBox(); ToggleGroup boostTypeGroup = new ToggleGroup(); RadioButton rbfRadio = new RadioButton("A transaction you sent"); rbfRadio.setToggleGroup(boostTypeGroup); boostRadioVbox.getChildren().add(rbfRadio); RadioButton cpfpRadio = new RadioButton("A transaction you received"); cpfpRadio.setToggleGroup(boostTypeGroup); rbfRadio.setSelected(true); boostRadioVbox.getChildren().add(cpfpRadio); grid.add(boostRadioVbox, 0, 3); // Instructions Text Text instruct = new Text("Please enter the raw hex or transaction id of your transaction below:"); grid.add(instruct, 0, 4); // Textbox for hex of transaction TextArea txHexTxt = new TextArea(); txHexTxt.setWrapText(true); grid.add(txHexTxt, 0, 5, 5, 1); // Next Button Button nextBtn = new Button("Next"); nextBtn.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { // Create Transaction Transaction tx = new Transaction(); // Check if txid boolean isTxid = txHexTxt.getText().length() == 64 && txHexTxt.getText().matches("[0-9A-Fa-f]+"); if (isTxid) tx.setHash(txHexTxt.getText()); // Determine which page to go to if (Transaction.deserializeStr(txHexTxt.getText(), tx) || isTxid) { // Get the fee JSONObject apiResult = Utils .getFromAnAPI("https://api.blockcypher.com/v1/btc/main/txs/" + tx.getHash(), "GET"); // Get the fee tx.setFee(apiResult.getInt("fees")); tx.setTotalAmtPre(tx.getFee() + tx.getOutAmt()); // Get info if txid if (isTxid) { } Scene scene = null; if (rbfRadio.isSelected()) if (sceneCursor == scenes.size() - 1 || !rbf) { scene = new Scene(rbfGrid(tx), 900, 500); if (!rbf) { scenes.clear(); scenes.add(stage.getScene()); } rbf = true; } if (cpfpRadio.isSelected()) if (sceneCursor == scenes.size() - 1 || rbf) { scene = new Scene(cpfpGrid(tx), 900, 500); if (rbf) { scenes.clear(); scenes.add(stage.getScene()); } rbf = false; } if (sceneCursor != scenes.size() - 1) scene = scenes.get(sceneCursor + 1); else scenes.add(scene); sceneCursor++; stage.setScene(scene); } else { Alert alert = new Alert(Alert.AlertType.ERROR, "Please enter a valid transaction"); alert.showAndWait(); } } }); HBox btnHbox = new HBox(10); btnHbox.getChildren().add(nextBtn); // Cancel Button Button cancelBtn = new Button("Cancel"); cancelBtn.setOnAction(cancelEvent); btnHbox.getChildren().add(cancelBtn); grid.add(btnHbox, 2, 7); // Display everything Scene scene = new Scene(grid, 900, 500); scenes.add(scene); primaryStage.setScene(scene); primaryStage.show(); }
From source file:be.makercafe.apps.makerbench.Main.java
@Override public void start(Stage primaryStage) { setupWorkspace();//from w w w. j a v a2 s .co m rootContextMenu = createViewerContextMenu(); viewer = createViewer(); this.stage = primaryStage; BorderPane p = new BorderPane(); p.setTop(createMenuBar()); // p.setLeft(viewer); tabFolder = new TabPane(); BorderPane bodyPane = new BorderPane(); TextArea taConsole = new TextArea(); taConsole.setPrefSize(Double.MAX_VALUE, 200.0); taConsole.setEditable(false); Console console = new Console(taConsole); PrintStream ps = new PrintStream(console, true); System.setOut(ps); System.setErr(ps); bodyPane.setBottom(taConsole); bodyPane.setCenter(tabFolder); SplitPane splitpane = new SplitPane(); splitpane.getItems().addAll(viewer, bodyPane); splitpane.setDividerPositions(0.0f, 1.0f); p.setCenter(splitpane); Scene scene = new Scene(p, 1024, 800); //scene.getStylesheets().add(this.getClass().getResource("/styles/java-keywords.css").toExternalForm()); primaryStage.setResizable(true); primaryStage.setTitle("Makerbench"); primaryStage.setScene(scene); //primaryStage.getIcons().add(new Image("/path/to/stackoverflow.jpg")); primaryStage.show(); }