當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。