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