textarea续写函数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

​點讚 4

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,

示例2: build

​點讚 3

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,

示例3: initUI

​點讚 3

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,

示例4: show

​點讚 3

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,

示例5: openFile

​點讚 3

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,

示例6: createDescriptionField

​點讚 2

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,

示例7: updateText

​點讚 2

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,

示例8: updateText

​點讚 2

import javafx.scene.control.TextArea; //導入方法依賴的package包/類

private void updateText(TextArea textArea, List 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,

示例9: updateText

​點讚 2

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,

示例10: handleExternalChanges

​點讚 2

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,

示例11: updateProblemsText

​點讚 2

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,

示例12: updateProblemsText

​點讚 2

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,

示例13: updateSyntaxErrors

​點讚 2

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,

注:本文中的javafx.scene.control.TextArea.setText方法示例整理自Github/MSDocs等源碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值