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


Java TextArea.setPrefRowCount方法代码示例

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


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

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

示例3: 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

示例4: show

import javafx.scene.control.TextArea; //导入方法依赖的package包/类
void show() {
  textAreaLog = new TextArea();
  textAreaLog.setWrapText(true);
  textAreaLog.setEditable(false);
  textAreaLog.setPrefColumnCount(50);
  textAreaLog.setPrefRowCount(30);

  root = new FlowPane();
  root.setAlignment(Pos.BASELINE_CENTER);
  root.getChildren().add(textAreaLog);

  Stage stage = new Stage();
  stage.setScene(new Scene(root));
  stage.show();
}
 
开发者ID:RusZ,项目名称:TextClassifier,代码行数:16,代码来源:LogWindow.java

示例5: HeaderPanel

import javafx.scene.control.TextArea; //导入方法依赖的package包/类
public HeaderPanel(AppSession session) {
    this.session = session;
    content = new HBox(5);
    content.setPadding(new Insets(5));
    setCenter(content);
    textContent = new TextArea();
    textContent.setPrefRowCount(16);
    textContent.setVisible(false);
    setBottom(textContent);
    textContent.setManaged(false);
    textContent.setFont(App.getDefaultFont());
    textContent.focusedProperty().addListener((val, before, after) -> {
        if (!after) { // if we lost focus
            rebuildFeatureIfTextChanged();
        }
    });        
    MenuBar menuBar = new MenuBar();
    Menu fileMenu = new Menu("File");
    openFileMenuItem = new MenuItem("Open");
    fileMenu.getItems().addAll(openFileMenuItem);

    Menu importMenu = new Menu("Import");
    openImportMenuItem = new MenuItem("Open");
    importMenu.getItems().addAll(openImportMenuItem);

    menuBar.getMenus().addAll(fileMenu, importMenu);
    setTop(menuBar);

    if (session != null) {
        Label envLabel = new Label("karate.env");
        envLabel.setPadding(new Insets(5, 0, 0, 0));
        TextField envTextField = new TextField();
        envTextField.setText(session.getEnv().env);
        Button envButton = new Button("Reset");
        envButton.setOnAction(e -> session.resetAll(envTextField.getText()));
        Button runAllButton = new Button("Run ►►");
        runAllButton.setOnAction(e -> session.runAll());            
        Button showContentButton = new Button(getContentButtonText(false));
        initTextContent();
        showContentButton.setOnAction(e -> { 
            boolean visible = !textContent.isVisible();
            textContent.setVisible(visible);
            textContent.setManaged(visible);
            showContentButton.setText(getContentButtonText(visible));
        });
        content.getChildren().addAll(envLabel, envTextField, envButton, runAllButton, showContentButton);            
    }
}
 
开发者ID:intuit,项目名称:karate,代码行数:49,代码来源:HeaderPanel.java


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