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


Java TextArea类代码示例

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


TextArea类属于javafx.scene.control包,在下文中一共展示了TextArea类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: getText

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

示例4: TextPaneMenu

import javafx.scene.control.TextArea; //导入依赖的package包/类
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);
}
 
开发者ID:Glavo,项目名称:ClassViewer,代码行数:19,代码来源:TextPaneMenu.java

示例5: AsciiPaneMenu

import javafx.scene.control.TextArea; //导入依赖的package包/类
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);
}
 
开发者ID:Glavo,项目名称:ClassViewer,代码行数:19,代码来源:AsciiPaneMenu.java

示例6: makeErrorGUI

import javafx.scene.control.TextArea; //导入依赖的package包/类
/**
    * 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);
   }
 
开发者ID:ztan5,项目名称:TechnicalAnalysisTool,代码行数:33,代码来源:TatMessageBox.java

示例7: showThrowable

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

示例8: ConsoleTab

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

示例9: createExceptionTextArea

import javafx.scene.control.TextArea; //导入依赖的package包/类
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;
}
 
开发者ID:ciphertechsolutions,项目名称:IO,代码行数:24,代码来源:BaseController.java

示例10: input2ArrayListofArrayOfLongs

import javafx.scene.control.TextArea; //导入依赖的package包/类
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;
    }
 
开发者ID:WaleedMortaja,项目名称:Elementary-Number-Theory,代码行数:18,代码来源:HelpingClass.java

示例11: init

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

示例12: pickPropertyExtract

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

示例13: StepPanel

import javafx.scene.control.TextArea; //导入依赖的package包/类
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);
}
 
开发者ID:intuit,项目名称:karate,代码行数:24,代码来源:StepPanel.java

示例14: start

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

示例15: btnDeleteAction

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


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