当前位置: 首页>>代码示例>>Java>>正文


Java TextArea.setText方法代码示例

本文整理汇总了Java中javafx.scene.control.TextArea.setText方法的典型用法代码示例。如果您正苦于以下问题:Java TextArea.setText方法的具体用法?Java TextArea.setText怎么用?Java TextArea.setText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.scene.control.TextArea的用法示例。


在下文中一共展示了TextArea.setText方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createTextArea

import javafx.scene.control.TextArea; //导入方法依赖的package包/类
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;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:17,代码来源:CheckList.java

示例2: build

import javafx.scene.control.TextArea; //导入方法依赖的package包/类
@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;
}
 
开发者ID:jdesive,项目名称:textmd,代码行数:30,代码来源:ExceptionAlertDialog.java

示例3: initUI

import javafx.scene.control.TextArea; //导入方法依赖的package包/类
@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();
      }
  }
 
开发者ID:agentlab,项目名称:SemanticRelationsEditor,代码行数:25,代码来源:InputPart.java

示例4: show

import javafx.scene.control.TextArea; //导入方法依赖的package包/类
@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);
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:21,代码来源:TextFilePreview.java

示例5: openFile

import javafx.scene.control.TextArea; //导入方法依赖的package包/类
@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());
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:18,代码来源:TextFileEditor.java

示例6: createDescriptionField

import javafx.scene.control.TextArea; //导入方法依赖的package包/类
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;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:18,代码来源:CheckListFormNode.java

示例7: updateText

import javafx.scene.control.TextArea; //导入方法依赖的package包/类
private void updateText(TextArea textArea, ConstraintSpecification spec) {
  try {
    ByteArrayOutputStream stream = ExporterFacade.exportSpec(spec, ExporterFacade.ExportFormat.XML);
    String output = IOUtils.toString(stream.toByteArray(), "UTF-8");
    textArea.setText(output);
  } catch (Exception e) {
    StringWriter writeString = new StringWriter();
    e.printStackTrace(new PrintWriter(writeString));
    e.printStackTrace();
    textArea.setText(writeString.toString());
  }
}
 
开发者ID:VerifAPS,项目名称:stvs,代码行数:13,代码来源:SpecificationTableDemo.java

示例8: updateText

import javafx.scene.control.TextArea; //导入方法依赖的package包/类
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());
  }
}
 
开发者ID:VerifAPS,项目名称:stvs,代码行数:9,代码来源:VariableCollectionDemo.java

示例9: updateText

import javafx.scene.control.TextArea; //导入方法依赖的package包/类
private void updateText(TextArea textArea, Code code) {
  ParsedCode parsedCode = code.getParsedCode();
  if (parsedCode != null) {
    StringBuilder output = new StringBuilder();
    output.append("Defined types:\n");
    parsedCode.getDefinedTypes().forEach(type -> output.append(" - " + type + "\n"));
    output.append("\n");
    output.append("\n");
    output.append("Defined IOVariables:\n");
    parsedCode.getDefinedVariables().forEach(codeIoVariable -> output.append(" - " + codeIoVariable + "\n"));
    output.append("SyntaxErrors: \n");
    code.getSyntaxErrors().forEach(syntaxError -> output.append(" - " + syntaxError + "\n"));
    textArea.setText(output.toString());
  }
}
 
开发者ID:VerifAPS,项目名称:stvs,代码行数:16,代码来源:EditorDemo.java

示例10: handleExternalChanges

import javafx.scene.control.TextArea; //导入方法依赖的package包/类
@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);
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:15,代码来源:TextFileEditor.java

示例11: updateProblemsText

import javafx.scene.control.TextArea; //导入方法依赖的package包/类
private void updateProblemsText(TextArea problemsArea, ConstraintSpecificationValidator recognizer) {
  String error = String.join("\n", recognizer.problemsProperty().get().stream().map(
      specProblem -> specProblem.getClass().getSimpleName() + ": " + specProblem.getErrorMessage()
  ).collect(Collectors.toList()));
  problemsArea.setText(error);
}
 
开发者ID:VerifAPS,项目名称:stvs,代码行数:7,代码来源:SpecificationTableDemo.java

示例12: updateProblemsText

import javafx.scene.control.TextArea; //导入方法依赖的package包/类
private void updateProblemsText(TextArea problemsArea, FreeVariableListValidator validator) {
  String error = String.join("\n", validator.problemsProperty().get().entrySet().stream().map(
      entry -> entry.getKey() + " -> " + entry.getValue()
  ).collect(Collectors.toList()));
  problemsArea.setText(error);
}
 
开发者ID:VerifAPS,项目名称:stvs,代码行数:7,代码来源:VariableCollectionDemo.java

示例13: updateSyntaxErrors

import javafx.scene.control.TextArea; //导入方法依赖的package包/类
private void updateSyntaxErrors(TextArea textField, Code code) {
  StringBuilder output = new StringBuilder();
  output.append("Syntax-Errors:\n");
  code.getSyntaxErrors().forEach(error -> output.append(" - " + error + "\n"));
  textField.setText(output.toString());
}
 
开发者ID:VerifAPS,项目名称:stvs,代码行数:7,代码来源:EditorDemo.java


注:本文中的javafx.scene.control.TextArea.setText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。