Java 类javafx.scene.control.TextArea 实例源码

项目:ServerBrowser    文件:FilesView.java   
/**
 * Initializes the whole view.
 */
public FilesView() {

    chatLogTextArea = new TextArea();
    chatLogTextArea.setEditable(false);

    clearLogsButton = new Button(Client.lang.getString("clear"));
    loadLogsButton = new Button(Client.lang.getString("reload"));

    final ButtonBar buttonBar = new ButtonBar();
    buttonBar.getButtons().addAll(loadLogsButton, clearLogsButton);

    final VBox chatLogsTabContent = new VBox(5.0, chatLogTextArea, buttonBar);
    VBox.setVgrow(chatLogTextArea, Priority.ALWAYS);

    chatLogsTab = new Tab(Client.lang.getString("chatlogs"), chatLogsTabContent);

    rootPane = new TabPane(chatLogsTab);
    rootPane.setTabClosingPolicy(TabClosingPolicy.UNAVAILABLE);
}
项目:stvs    文件:SpecificationTableDemo.java   
private Pane createExtractedTableTextArea(ConstraintSpecification spec, ConstraintSpecificationValidator recognizer) {
  final TextArea textArea = new TextArea();
  textArea.getStyleClass().addAll("model-text-area");
  textArea.setEditable(false);

  updateText(textArea, spec);

  final Button updateButton = new Button("Refresh");
  updateButton.setOnAction(event -> updateText(textArea, spec));

  final TextArea problemsArea = new TextArea();
  problemsArea.getStyleClass().addAll("model-text-area");
  textArea.setEditable(false);

  updateProblemsText(problemsArea, recognizer);

  recognizer.problemsProperty().addListener((Observable o) -> updateProblemsText(problemsArea, recognizer));

  SplitPane splitPane = new SplitPane(textArea, problemsArea);
  splitPane.setOrientation(Orientation.VERTICAL);
  VBox.setVgrow(splitPane, Priority.ALWAYS);
  return new VBox(updateButton, splitPane);
}
项目:marathonv5    文件:CheckListFormNode.java   
private VBox createDescriptionField() {
    VBox descriptionFieldBox = new VBox();
    TextArea descriptionArea = new TextArea();
    descriptionArea.setPrefRowCount(4);
    descriptionArea.textProperty().addListener((observable, oldValue, newValue) -> {
        fireContentChanged();
        checkList.setDescription(descriptionArea.getText());
    });
    descriptionArea.setEditable(mode.isSelectable());
    descriptionFieldBox.getChildren().addAll(new Label("Description"), descriptionArea);
    HBox.setHgrow(descriptionArea, Priority.ALWAYS);
    VBox.setMargin(descriptionFieldBox, new Insets(5, 10, 5, 5));
    descriptionArea.setText(checkList.getDescription());
    HBox.setHgrow(descriptionArea, Priority.ALWAYS);
    HBox.setHgrow(descriptionFieldBox, Priority.ALWAYS);
    return descriptionFieldBox;
}
项目:marathonv5    文件:CheckList.java   
private Node createTextArea(boolean selectable, boolean editable) {
    textArea = new TextArea();
    textArea.setPrefRowCount(4);
    textArea.setEditable(editable);
    textArea.textProperty().addListener((observable, oldValue, newValue) -> {
        text = textArea.getText();
    });
    textArea.setText(text);
    ScrollPane scrollPane = new ScrollPane(textArea);
    scrollPane.setFitToWidth(true);
    scrollPane.setFitToHeight(true);
    scrollPane.setHbarPolicy(ScrollBarPolicy.NEVER);
    scrollPane.setVbarPolicy(ScrollBarPolicy.ALWAYS);
    HBox.setHgrow(scrollPane, Priority.ALWAYS);
    return scrollPane;
}
项目:marathonv5    文件:RFXTextAreaTest.java   
@Test public void getText() {
    final TextArea textArea = (TextArea) getPrimaryStage().getScene().getRoot().lookup(".text-area");
    LoggingRecorder lr = new LoggingRecorder();
    List<Object> text = new ArrayList<>();
    Platform.runLater(() -> {
        RFXComponent rTextField = new RFXTextInputControl(textArea, null, null, lr);
        textArea.setText("Hello World");
        rTextField.focusLost(null);
        text.add(rTextField.getAttribute("text"));
    });
    new Wait("Waiting for text area text.") {
        @Override public boolean until() {
            return text.size() > 0;
        }
    };
    AssertJUnit.assertEquals("Hello World", text.get(0));
}
项目:marathonv5    文件:RFXTextAreaTest.java   
@Test public void selectWithSpecialChars() throws InterruptedException {
    final TextArea textArea = (TextArea) getPrimaryStage().getScene().getRoot().lookup(".text-area");
    Platform.runLater(new Runnable() {
        @Override public void run() {
            textArea.setText("Hello\n World'\"");
        }
    });
    LoggingRecorder lr = new LoggingRecorder();
    RFXComponent rTextField = new RFXTextInputControl(textArea, null, null, lr);
    Platform.runLater(new Runnable() {
        @Override public void run() {
            rTextField.focusLost(null);
        }
    });
    List<Recording> recordings = lr.waitAndGetRecordings(1);
    Recording select = recordings.get(0);
    AssertJUnit.assertEquals("recordSelect", select.getCall());
    AssertJUnit.assertEquals("Hello\n World'\"", select.getParameters()[0]);
}
项目:marathonv5    文件:RFXTextAreaTest.java   
@Test public void selectWithUtf8Chars() throws InterruptedException {
    final TextArea textArea = (TextArea) getPrimaryStage().getScene().getRoot().lookup(".text-area");
    Platform.runLater(new Runnable() {
        @Override public void run() {
            textArea.setText("å∫ç∂´ƒ©˙ˆ∆");
        }
    });
    LoggingRecorder lr = new LoggingRecorder();
    RFXComponent rTextField = new RFXTextInputControl(textArea, null, null, lr);
    Platform.runLater(new Runnable() {
        @Override public void run() {
            rTextField.focusLost(null);
        }
    });
    List<Recording> recordings = lr.waitAndGetRecordings(1);
    Recording select = recordings.get(0);
    AssertJUnit.assertEquals("recordSelect", select.getCall());
    AssertJUnit.assertEquals("å∫ç∂´ƒ©˙ˆ∆", select.getParameters()[0]);
}
项目:HotaruFX    文件:Main.java   
@Override
public void start(Stage primaryStage) {
    ClickableHyperLink.setHostServices(getHostServices());
    primaryStage.setTitle("HotaruFX");
    try {
        val loader = new FXMLLoader(getClass().getResource("/fxml/Editor.fxml"));
        val scene = new Scene(loader.load());
        scene.getStylesheets().addAll(
                getClass().getResource("/styles/theme-dark.css").toExternalForm(),
                getClass().getResource("/styles/codearea.css").toExternalForm(),
                getClass().getResource("/styles/hotarufx-keywords.css").toExternalForm(),
                getClass().getResource("/styles/color-picker-box.css").toExternalForm()
                );
        controller = loader.getController();
        controller.setPrimaryStage(primaryStage);
        primaryStage.setOnCloseRequest(controller::onCloseRequest);
        primaryStage.setScene(scene);
    } catch (IOException ex) {
        val text = new TextArea(Exceptions.stackTraceToString(ex));
        text.setEditable(false);
        primaryStage.setScene(new Scene(text));
    }
    primaryStage.show();
}
项目:ClassViewer    文件:HexPaneMenu.java   
public HexPaneMenu(TextArea textArea) {
    MenuItem copy = new MenuItem("_Copy");
    this.setStyle(FontUtils.setUIFont(this.getStyle()));
    copy.setMnemonicParsing(true);
    copy.setOnAction(e -> {
        Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();

        StringSelection s = new StringSelection(
                textArea.getSelectedText().replace("\n", "")
        );

        clipboard.setContents(s, null);
    });
    copy.setGraphic(new ImageView(ImageUtils.copyImage));


    getItems().addAll(
            copy
    );
}
项目:ClassViewer    文件:TextPaneMenu.java   
public TextPaneMenu(TextArea textArea) {
    this.textArea = textArea;
    MenuItem copy = new MenuItem("_Copy");
    this.setStyle(FontUtils.setUIFont(this.getStyle()));
    copy.setMnemonicParsing(true);
    copy.setOnAction(e -> {
        Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();

        StringSelection s = new StringSelection(
                textArea.getSelectedText()
        );

        clipboard.setContents(s, null);
    });
    copy.setGraphic(new ImageView(ImageUtils.copyImage));

    getItems().addAll(copy);
}
项目:ClassViewer    文件:AsciiPaneMenu.java   
public AsciiPaneMenu(TextArea textArea) {
    this.textArea = textArea;
    MenuItem copy = new MenuItem("_Copy");
    this.setStyle(FontUtils.setUIFont(this.getStyle()));
    copy.setMnemonicParsing(true);
    copy.setOnAction(e -> {
        Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();

        StringSelection s = new StringSelection(
                textArea.getSelectedText().replace("\n", "")
        );

        clipboard.setContents(s, null);
    });
    copy.setGraphic(new ImageView(ImageUtils.copyImage));

    getItems().addAll(copy);
}
项目:TechnicalAnalysisTool    文件:TatMessageBox.java   
/**
    * Make a Error Dialog
    * @return BorderPane
    */
   public void makeErrorGUI() {
       root = new Group();
       Scene scene = new Scene(root, 360, 185, Color.WHITE);
       ImagePattern pattern = new ImagePattern(new Image("icon/bk2.jpg"));
       scene.setFill(pattern);
       setTitle("Error");
       setScene(scene);
       Image appIcon = new Image("icon/ERROR.png");
       getIcons().add(appIcon);
       BorderPane bp = new BorderPane();

       textArea = new TextArea(message);
       textArea.setEditable(false);
       textArea.setWrapText(true);
       textArea.setMaxWidth(320);
       textArea.setMaxHeight(130);
       HBox hBox = new HBox();
       hBox.setSpacing(5);
       hBox.setPadding(new Insets(5,0,0,0));
       hBox.setAlignment(Pos.BOTTOM_RIGHT);
       hBox.getChildren().addAll(openLogButton,okButton);
       bp.setCenter(textArea);
       bp.setBottom(hBox);
       root.getChildren().add(bp);
       sizeToScene();
       setX(owner.getX() + Math.abs(owner.getWidth() - scene.getWidth()) / 2.0);
setY(owner.getY() + Math.abs(owner.getHeight() - scene.getHeight()) / 2.0);
   }
项目:DeskChan    文件:App.java   
/** Show error dialog. **/
static void showThrowable(Window parent, Throwable e) {
    Main.log(e);
    Alert alert = new Alert(Alert.AlertType.ERROR);
    alert.setTitle("Exception");
    alert.initOwner(parent);
    alert.initModality(Modality.WINDOW_MODAL);
    alert.setHeaderText(e.getClass().getName());
    alert.setContentText(e.getMessage());
    StringWriter stringWriter = new StringWriter();
    PrintWriter printWriter = new PrintWriter(stringWriter);
    e.printStackTrace(printWriter);
    String exceptionText = stringWriter.toString();
    TextArea textArea = new TextArea(exceptionText);
    textArea.setEditable(false);
    textArea.setWrapText(true);
    textArea.setMaxWidth(Double.MAX_VALUE);
    textArea.setMaxHeight(Double.MAX_VALUE);
    alert.getDialogPane().setExpandableContent(textArea);
    alert.showAndWait();
}
项目:MooProject    文件:ConsoleTab.java   
public ConsoleTab(Button button, Pane pane, TextArea mooConsole, TextField commandInput, Button commandSend) {
    super(button, pane);
    this.mooConsole = mooConsole;
    this.commandInput = commandInput;
    this.commandSend = commandSend;

    // for sending command
    commandSend.setOnAction(event -> {
        String text = commandInput.getText();
        commandInput.clear();
        PacketMessenger.message(new PacketConsoleInput(text));
    });

    // register this as event listener
    EventExecutor.getInstance().register(this);
    PacketAdapting.getInstance().register(this);
}
项目:IO    文件:BaseController.java   
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;
}
项目:Elementary-Number-Theory    文件:HelpingClass.java   
public static ArrayList<Long[]> input2ArrayListofArrayOfLongs(TextArea ta) throws NumberFormatException {

        String[] lines = ta.getText().trim().split("\n");
        ArrayList<Long[]> result = new ArrayList<>(lines.length);
        for (int i = 0; i < lines.length; i++) {
            String[] inputs = lines[i].trim().split("[, ]+");
            result.add(new Long[inputs.length]);
            try {
                for (int j = 0; j < inputs.length; j++) {
                    result.get(i)[j] = strPow(inputs[j]);
                }
            } catch (NumberFormatException ex) {
                throw new NumberFormatException("Invaild Number (" + inputs + ")");
            }
        }
        return result;
    }
项目:SensorThingsManager    文件:EntityGuiController.java   
@Override
public void init(SensorThingsService service, FeatureOfInterest entity, GridPane gridProperties, Accordion accordionLinks, Label labelId, boolean editable) {
    this.labelId = labelId;
    this.entity = entity;
    int i = 0;
    textName = addFieldTo(gridProperties, i, "Name", new TextField(), false, editable);
    textDescription = addFieldTo(gridProperties, ++i, "Description", new TextArea(), true, editable);
    textEncodingType = addFieldTo(gridProperties, ++i, "EncodingType", new TextField(), false, editable);
    textFeature = addFieldTo(gridProperties, ++i, "Feature", new TextArea(), false, editable);

    if (accordionLinks != null) {
        try {
            TitledPane tp = new TitledPane("Observations", createCollectionPaneFor(entity.observations().query()));
            accordionLinks.getPanes().add(tp);
        } catch (NullPointerException e) {
            // Happens when entity is new.
        }
    }
}
项目:SensorThingsManager    文件:EntityGuiController.java   
@Override
public void init(SensorThingsService service, Observation entity, GridPane gridProperties, Accordion accordionLinks, Label labelId, boolean editable) {
    this.labelId = labelId;
    this.entity = entity;
    int i = 0;
    textPhenomenonTime = addFieldTo(gridProperties, i, "PhenomenonTime", new TextField(), false, editable);
    textResultTime = addFieldTo(gridProperties, ++i, "ResultTime", new TextField(), false, editable);
    textResult = addFieldTo(gridProperties, ++i, "Result", new TextArea(), true, editable);
    textResultQuality = addFieldTo(gridProperties, ++i, "ResultQuality", new TextField(), false, editable);
    textValidTime = addFieldTo(gridProperties, ++i, "ValidTime", new TextField(), false, editable);
    textParameters = addFieldTo(gridProperties, ++i, "Parameters", new TextArea(), true, editable);

    if (accordionLinks != null) {
        try {
            accordionLinks.getPanes().add(createEditableEntityPane(entity, entity.getDatastream(), service.datastreams().query(), entity::setDatastream));
            accordionLinks.getPanes().add(createEditableEntityPane(entity, entity.getMultiDatastream(), service.multiDatastreams().query(), entity::setMultiDatastream));
            accordionLinks.getPanes().add(createEditableEntityPane(entity, entity.getFeatureOfInterest(), service.featuresOfInterest().query(), entity::setFeatureOfInterest));
        } catch (IOException | ServiceFailureException ex) {
            LOGGER.error("Failed to create panel.", ex);
        }
    }
}
项目:uPMT    文件:TypePropertyRepresentation.java   
private void pickPropertyExtract() {
    Stage promptWindow = new Stage();
    promptWindow.setTitle("Selection de l'extrait");
    try {
        main.getCurrentMoment().setCurrentProperty(property);
        FXMLLoader loader = new FXMLLoader();
        loader.setLocation(getClass().getResource("/view/SelectDescriptemePart.fxml"));
        loader.setController(new SelectDescriptemePartController(main, promptWindow, new TextArea(),Enregistrement.PROPERTY));
        loader.setResources(main._langBundle);
        BorderPane layout = (BorderPane) loader.load();
        Scene launchingScene = new Scene(layout);
        promptWindow.setScene(launchingScene);
        promptWindow.show();

    } catch (IOException e) {
        // TODO Exit Program
        e.printStackTrace();
    }
}
项目:karate    文件:StepPanel.java   
public StepPanel(AppSession session, StepWrapper step) {
    this.session = session;
    runButton = new Button("►");        
    textArea = new TextArea();
    textArea.setFont(App.getDefaultFont());
    textArea.setMinHeight(0);
    textArea.setWrapText(true);
    textArea.focusedProperty().addListener((val, before, after) -> {
        if (!after) { // if we lost focus
            rebuildFeatureIfTextChanged();
        }
    });
    this.step = step;
    initTextArea();
    runButton.setOnAction(e -> run());
    getChildren().addAll(textArea, runButton);
    setLeftAnchor(textArea, 0.0);
    setRightAnchor(textArea, 30.0);
    setBottomAnchor(textArea, 0.0);
    setRightAnchor(runButton, 0.0);
    setTopAnchor(runButton, 2.0);
    setBottomAnchor(runButton, 0.0);
}
项目:voogasalad-ltub    文件:ScriptingMainTest.java   
@Override
public void start(Stage primaryStage) throws Exception {
    primaryStage.setTitle("Test the Scripting");
    BorderPane root = new BorderPane();
    TextArea input = new TextArea();
    input.setPrefWidth(300);
    input.setPrefHeight(300);
    ScriptingExample scriptingExample = new ScriptingExample();
    Button executeButton = new Button("Execute");
    Button retrieveButton = new Button("Retrieve");
    executeButton.setOnAction(e -> scriptingExample.inputScript(input.getText()));
    retrieveButton.setOnAction(e ->scriptingExample.getTowersFromGroovy());
    root.setCenter(input);
    root.setBottom(executeButton);
    root.setRight(retrieveButton);
    primaryStage.setScene(new Scene(root));
    primaryStage.show();

}
项目:SnapDup    文件:MainDisplay.java   
@FXML
private void btnDeleteAction()
{
    try
    {
        FXMLLoader loader = new FXMLLoader(MainDisplay.class.getResource("/fxml/DeleteResultDialog.fxml"));
        Parent root = loader.load();
        Scene scene = new Scene(root);
        Stage stage = new Stage();

        stage.initModality(Modality.APPLICATION_MODAL);
        stage.initStyle(StageStyle.UNDECORATED);
        stage.setScene(scene);
        stage.show();

        Node node = scene.lookup("#txtArea");

        if(node instanceof TextArea)
        {
            TextArea textArea = (TextArea)node;

            DeleteTask task = new DeleteTask(dataContainer);

            textArea.textProperty().bind(task.valueProperty());

            Thread th = new Thread(task);
            th.setDaemon(true);
            th.start();
        }
        else
            throw new IOException("Unable to find \"TextArea\" node");

    }
    catch(IOException e)
    {
        e.printStackTrace();
    }
}
项目:SemanticRelationsEditor    文件:InputPart.java   
@PostConstruct
  void initUI(BorderPane pane) {
    try {
    Button EnterButton = new Button();
    TextArea textbox = new TextArea();
    EnterButton.setText("Send Data");

    EnterButton.setOnAction((event) -> {
        String tmp = textbox.getText();
        Helper.handleButton(tmp);
    });

    textbox.setMaxWidth(500);
    textbox.setMaxHeight(100);
    textbox.setWrapText(true);
    textbox.setText("Type your sentence here");
    pane.setLeft(EnterButton);
    pane.setCenter(textbox);
}
      catch (Exception e)
      {
          e.printStackTrace();
      }
  }
项目:WebPLP    文件:Dialogues.java   
/**
 * Spawns an error dialogue detailing the given exception.
 * <p>
 * The given message will be used as the dialogue's header, and the exception's stack
 * trace will appear in the hidden "more information" dropdown.
 * <p>
 * If the exception has a message, it will be displayed in the dialogue's content
 * field, prefaced by "Cause:"
 * 
 * @param exception
 *            The exception to display
 * @param message
 *            A message to describe the context of the dialogue, usually why the
 *            dialogue is appearing (e.g. "An error has occurred!")
 */
public static void showAlertDialogue(Exception exception, String message)
{
    String context = exception.getMessage();
    boolean valid = (context != null && !context.isEmpty());
    context = (valid) ? "Cause: " + context : null;

    Alert alert = new Alert(AlertType.ERROR);
    alert.setTitle("Exception Dialog");
    alert.setHeaderText(message);
    alert.setContentText(context);
    alert.setGraphic(null);

    String exceptionText = getStackTraceAsString(exception);
    TextArea textArea = new TextArea(exceptionText);
    textArea.setEditable(false);
    textArea.setWrapText(false);

    alert.getDialogPane().setExpandableContent(textArea);
    alert.showAndWait();
}
项目:jmonkeybuilder    文件:TextFilePreview.java   
@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);
}
项目:TextClassifier    文件:MainWindow.java   
private void buildForm(Stage primaryStage) {
  textAreaClassifiableText = new TextArea();
  textAreaClassifiableText.setWrapText(true);

  btnClassify = new Button("Classify");
  btnClassify.setOnAction(new ClassifyBtnPressEvent());

  lblCharacteristics = new Label("");

  root = new FlowPane(Orientation.VERTICAL, 10, 10);
  root.setAlignment(Pos.BASELINE_CENTER);
  root.getChildren().addAll(textAreaClassifiableText, btnClassify, lblCharacteristics);

  primaryStage.setScene(new Scene(root, 500, 300));
  primaryStage.show();
}
项目:ethereum-ingest    文件:Form.java   
public static void showAlertFromError(Throwable e) {
    Platform.runLater(() -> {
        Alert alert = new Alert(Alert.AlertType.ERROR);
        alert.initStyle(StageStyle.UTILITY);
        alert.setTitle("Error");
        alert.setContentText("An error has occured, submit an issue with the stack " +
                "trace if you need help.");
        alert.setHeaderText(null);

        TextArea textArea = new TextArea(throwableToString(e));
        textArea.setEditable(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(textArea, 0, 1);
        alert.getDialogPane().setExpandableContent(expContent);
        alert.getDialogPane().getStylesheets().add(Form.class.getResource(CSS_FILE).toExternalForm());
        alert.showAndWait();
    });
}
项目:textmd    文件:ExceptionAlertDialog.java   
@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;
}
项目:marathonv5    文件:TextAreaReadline.java   
public TextAreaReadline(TextField text, TextArea output, final String message) {
    this.area = text;
    this.output = output;
    readline = new Readline();
    inputJoin.send(Channel.EMPTY, null);
    text.setOnKeyPressed(this);
    if (message != null) {
        append(message, promptStyle);
    }
}
项目:marathonv5    文件:ImagePanel.java   
private static TextArea createTextArea(TableCell<Annotation, String> cell) {
    TextArea textArea = new TextArea(cell.getItem() == null ? "" : cell.getItem());
    textArea.setPrefRowCount(1);
    textArea.setWrapText(true);
    textArea.focusedProperty().addListener(new ChangeListener<Boolean>() {
        @Override public void changed(ObservableValue<? extends Boolean> arg0, Boolean arg1, Boolean arg2) {
            if (!textArea.isFocused() && cell.getItem() != null && cell.isEditing()) {
                cell.commitEdit(textArea.getText());
            }
            cell.getTableView().getItems().get(cell.getIndex()).setText(textArea.getText());
        }
    });
    textArea.addEventFilter(MouseEvent.MOUSE_CLICKED, (event) -> {
        if (event.getClickCount() > 1) {
            cell.getTableView().edit(cell.getTableRow().getIndex(), cell.getTableColumn());
        } else {
            TableViewSelectionModel<Annotation> selectionModel = cell.getTableView().getSelectionModel();
            if (event.isControlDown()) {
                if (selectionModel.isSelected(cell.getIndex())) {
                    selectionModel.clearSelection(cell.getIndex());
                } else {
                    selectionModel.select(cell.getIndex());
                }
            } else {
                selectionModel.clearAndSelect(cell.getIndex());
            }
        }
    });
    textArea.addEventFilter(KeyEvent.KEY_PRESSED, (event) -> {
        if (event.getCode() == KeyCode.ENTER && event.isShiftDown() && cell.isEditing()) {
            cell.commitEdit(textArea.getText());
            cell.getTableView().getItems().get(cell.getIndex()).setText(textArea.getText());
            event.consume();
        }
        if (event.getCode() == KeyCode.F2) {
            cell.getTableView().edit(cell.getTableRow().getIndex(), cell.getTableColumn());
        }
    });
    return textArea;
}
项目:marathonv5    文件:ResultPane.java   
private void showMessage(Failure selectedItem) {
    if (selectedItem.getMessage() != null) {
        MessageStage messageStage = new MessageStage(
                new MessageInfo(selectedItem.getMessage(), "Failure Message", new TextArea()));
        messageStage.getStage().showAndWait();
    }
}
项目:marathonv5    文件:LogView.java   
private void showMessage(LogRecord selectedItem) {
    if (selectedItem.getDescription() != null) {
        String title = "Log @" + dateTimeInstance.format(selectedItem.getDate()) + " >" + selectedItem.getModule();
        MessageStage messageStage = new MessageStage(new MessageInfo(selectedItem.getDescription(), title, new TextArea()));
        messageStage.getStage().showAndWait();
    }
}
项目:stvs    文件:VariableCollectionDemo.java   
private void updateText(TextArea textArea, List<FreeVariable> freeVariables) {
  if (freeVariables != null) {
    StringBuilder output = new StringBuilder();
    output.append("Defined free variables:\n");
    freeVariables.forEach(type -> output.append(" - " + type + "\n"));
    textArea.setText(output.toString());
  }
}
项目:TechnicalAnalysisTool    文件:TatMessageBox.java   
/**
    * Make a Warning Dialog
    * @return BorderPane
    */
   public void makeWaningGUI() {
       root = new Group();
       Scene scene = new Scene(root, 360, 185, Color.WHITE);
       ImagePattern pattern = new ImagePattern(new Image("icon/bk2.jpg"));
       scene.setFill(pattern);
       setTitle("Warning");
       setScene(scene);
       Image appIcon = new Image("icon/ERROR.png");
       getIcons().add(appIcon);
       BorderPane bp = new BorderPane();

       textArea = new TextArea(message);
       textArea.setEditable(false);
       textArea.setWrapText(true);
       textArea.setMaxWidth(320);
       textArea.setMaxHeight(130);
       HBox hBox = new HBox();
       hBox.setSpacing(5);
       hBox.setPadding(new Insets(5,0,0,0));
       hBox.setAlignment(Pos.BOTTOM_RIGHT);
       hBox.getChildren().addAll(okButton);
       bp.setCenter(textArea);
       bp.setBottom(hBox);
       root.getChildren().add(bp);
       sizeToScene();
       setX(owner.getX() + Math.abs(owner.getWidth() - scene.getWidth()) / 2.0);
setY(owner.getY() + Math.abs(owner.getHeight() - scene.getHeight()) / 2.0);
   }
项目:AlertFX    文件:ErrorBox.java   
/**
 * Shows the alert
 */
public void show(){
    alert.initStyle(style);
    alert.setTitle("Exception Caught!");
    alert.setHeaderText("Exception encountered");
    alert.setContentText(error.getMessage());

    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    error.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.showAndWait();

}
项目:marathonv5    文件:JavaFXTextAreaElementTest.java   
@Test public void marathon_select() {
    TextArea textAreaNode = (TextArea) getPrimaryStage().getScene().getRoot().lookup(".text-area");
    textarea.marathon_select("Hello World");
    new Wait("Waiting for the text area value to be set") {
        @Override public boolean until() {
            return "Hello World".equals(textAreaNode.getText());
        }
    };
}
项目:stvs    文件:AlertFactory.java   
/**
 * 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;
}
项目:marathonv5    文件:TextAreaSample.java   
public TextAreaSample() {
    TextArea textArea = new TextArea();
    textArea.setMaxSize(250, 250);
    VBox root = new VBox();
    root.getChildren().addAll(textArea, new Button("Click Me!!"));
    getChildren().add(root);
}
项目:ClassViewer    文件:HexPane.java   
public HexPane(HexText hex) {
    this.hex = hex;
    textArea1 = new TextArea(hex.rowHeaderText);
    textArea2 = new TextArea(hex.bytesText);
    textArea3 = new TextArea(hex.asciiString);

    initTextArea();

    HBox hbox = new HBox();

    hbox.getChildren().addAll(textArea1, textArea2, textArea3);

    setContent(hbox);
}
项目:rsam-gui    文件:Dialogue.java   
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);
}