本文整理汇总了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;
}
示例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;
}
示例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();
}
}
示例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);
}
示例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());
}
示例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;
}
示例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());
}
}
示例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());
}
}
示例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());
}
}
示例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);
}
示例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);
}
示例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);
}
示例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());
}