Java Code Examples for javafx.scene.control.TextArea#setPrefHeight()

The following examples show how to use javafx.scene.control.TextArea#setPrefHeight() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EditAreaView.java    From helloiot with GNU General Public License v3.0 6 votes vote down vote up
@Override
public Node constructContent() {
    
    StackPane stackpaneroot = new StackPane();
    stackpaneroot.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
    
    BorderPane borderpane = new BorderPane();
    
    statusview = new TextArea();
    statusview.setEditable(false);
    statusview.setFocusTraversable(false);
    statusview.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
    statusview.setPrefHeight(100.0);
    statusview.getStyleClass().add("unitinputview");
    BorderPane.setAlignment(statusview, Pos.CENTER);
    
    borderpane.setCenter(statusview);
    
    stackpaneroot.getChildren().add(borderpane);
    
    initialize();
    return stackpaneroot;
}
 
Example 2
Source File: EditAreaEvent.java    From helloiot with GNU General Public License v3.0 6 votes vote down vote up
@Override
public Node constructContent() {
    HBox hboxroot = new HBox();
    hboxroot.setSpacing(6.0);
    
    payload = new TextArea();
    payload.getStyleClass().add("unitinputarea");
    payload.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
    payload.setPrefHeight(100.0);
    HBox.setHgrow(payload, Priority.SOMETIMES);

    
    fireaction = new Button();
    fireaction.setFocusTraversable(false);
    fireaction.setMnemonicParsing(false);
    fireaction.getStyleClass().add("unitbutton");
    fireaction.setOnAction(this::onSendEvent);
    
    hboxroot.getChildren().addAll(payload, fireaction);
    
    initialize();
    return hboxroot;    
}
 
Example 3
Source File: LogView.java    From helloiot with GNU General Public License v3.0 6 votes vote down vote up
@Override
public Node constructContent() {
    StackPane stackpaneroot = new StackPane();
    stackpaneroot.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
    
    BorderPane borderpane = new BorderPane();
    
    statusview = new TextArea();
    statusview.setEditable(false);
    statusview.setFocusTraversable(false);
    statusview.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
    statusview.setPrefHeight(100.0);
    statusview.getStyleClass().addAll("unitinputview", "unitinputcode");
    BorderPane.setAlignment(statusview, Pos.CENTER);
    
    borderpane.setCenter(statusview);
    
    stackpaneroot.getChildren().add(borderpane);
    
    initialize();
    return stackpaneroot;
}
 
Example 4
Source File: VoteResultView.java    From bisq with GNU Affero General Public License v3.0 6 votes vote down vote up
private void maybeShowVoteResultErrors(Cycle cycle) {
    List<VoteResultException> exceptions = voteResultService.getVoteResultExceptions().stream()
            .filter(voteResultException -> cycle.getHeightOfFirstBlock() == voteResultException.getHeightOfFirstBlockInCycle())
            .collect(Collectors.toList());
    if (!exceptions.isEmpty()) {
        TextArea textArea = FormBuilder.addTextArea(root, ++gridRow, "");
        GridPane.setMargin(textArea, new Insets(Layout.GROUP_DISTANCE, -15, 0, -10));
        textArea.setPrefHeight(100);

        StringBuilder sb = new StringBuilder(Res.getWithCol("dao.results.exceptions") + "\n");
        exceptions.forEach(exception -> {
            if (exception.getCause() != null)
                sb.append(exception.getCause().getMessage());
            else
                sb.append(exception.getMessage());
            sb.append("\n");
        });

        textArea.setText(sb.toString());
    }
}
 
Example 5
Source File: ShowWalletDataWindow.java    From bisq with GNU Affero General Public License v3.0 6 votes vote down vote up
private void addContent() {
    gridPane.getColumnConstraints().get(0).setHalignment(HPos.LEFT);
    gridPane.getColumnConstraints().get(0).setHgrow(Priority.ALWAYS);
    gridPane.getColumnConstraints().get(1).setHgrow(Priority.SOMETIMES);

    Tuple2<Label, TextArea> labelTextAreaTuple2 = addTopLabelTextArea(gridPane, ++rowIndex,
            Res.get("showWalletDataWindow.walletData"), "");
    TextArea textArea = labelTextAreaTuple2.second;
    Label label = labelTextAreaTuple2.first;
    label.setMinWidth(150);
    textArea.setPrefHeight(500);
    textArea.getStyleClass().add("small-text");
    CheckBox isUpdateCheckBox = addLabelCheckBox(gridPane, ++rowIndex,
            Res.get("showWalletDataWindow.includePrivKeys"));
    isUpdateCheckBox.setSelected(false);

    isUpdateCheckBox.selectedProperty().addListener((observable, oldValue, newValue) -> {
        showWallet(textArea, isUpdateCheckBox);
    });

    showWallet(textArea, isUpdateCheckBox);

    actionButtonText(Res.get("shared.copyToClipboard"));
    onAction(() -> Utilities.copyToClipboard(textArea.getText()));
}
 
Example 6
Source File: F2FForm.java    From bisq with GNU Affero General Public License v3.0 6 votes vote down vote up
public static int addFormForBuyer(GridPane gridPane, int gridRow,
                                  PaymentAccountPayload paymentAccountPayload, Offer offer, double top) {
    F2FAccountPayload f2fAccountPayload = (F2FAccountPayload) paymentAccountPayload;
    addCompactTopLabelTextFieldWithCopyIcon(gridPane, ++gridRow, 0, Res.get("shared.country"),
            CountryUtil.getNameAndCode(f2fAccountPayload.getCountryCode()), top);
    addCompactTopLabelTextFieldWithCopyIcon(gridPane, gridRow, 1, Res.get("payment.f2f.city"),
            offer.getF2FCity(), top);
    addCompactTopLabelTextFieldWithCopyIcon(gridPane, ++gridRow, Res.get("payment.f2f.contact"),
            f2fAccountPayload.getContact());
    TextArea textArea = addTopLabelTextArea(gridPane, gridRow, 1, Res.get("payment.f2f.extra"), "").second;
    textArea.setPrefHeight(60);
    textArea.setEditable(false);
    textArea.setId("text-area-disabled");
    textArea.setText(offer.getF2FExtraInfo());
    return gridRow;
}
 
Example 7
Source File: F2FForm.java    From bisq with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
public void addFormForDisplayAccount() {
    gridRowFrom = gridRow;

    addTopLabelTextField(gridPane, gridRow, Res.get("payment.account.name"),
            paymentAccount.getAccountName(), Layout.FIRST_ROW_AND_GROUP_DISTANCE);
    addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("shared.paymentMethod"),
            Res.get(paymentAccount.getPaymentMethod().getId()));
    addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("payment.country"),
            getCountryBasedPaymentAccount().getCountry() != null ? getCountryBasedPaymentAccount().getCountry().name : "");
    TradeCurrency singleTradeCurrency = paymentAccount.getSingleTradeCurrency();
    String nameAndCode = singleTradeCurrency != null ? singleTradeCurrency.getNameAndCode() : "null";
    addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("shared.currency"), nameAndCode);
    addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("payment.f2f.contact", f2fAccount.getContact()),
            f2fAccount.getContact());
    addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("payment.f2f.city", f2fAccount.getCity()),
            f2fAccount.getCity());
    TextArea textArea = addCompactTopLabelTextArea(gridPane, ++gridRow, Res.get("payment.f2f.extra"), "").second;
    textArea.setText(f2fAccount.getExtraInfo());
    textArea.setPrefHeight(60);
    textArea.setEditable(false);

    addLimitations(true);
}
 
Example 8
Source File: USPostalMoneyOrderForm.java    From bisq with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
public void addFormForDisplayAccount() {
    gridRowFrom = gridRow;
    addTopLabelTextField(gridPane, gridRow, Res.get("payment.account.name"),
            usPostalMoneyOrderAccount.getAccountName(), Layout.FIRST_ROW_AND_GROUP_DISTANCE);
    addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("shared.paymentMethod"),
            Res.get(usPostalMoneyOrderAccount.getPaymentMethod().getId()));
    addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("payment.account.owner"),
            usPostalMoneyOrderAccount.getHolderName());
    TextArea textArea = addCompactTopLabelTextArea(gridPane, ++gridRow, Res.get("payment.postal.address"), "").second;
    textArea.setText(usPostalMoneyOrderAccount.getPostalAddress());
    textArea.setPrefHeight(70);
    textArea.setEditable(false);
    TradeCurrency singleTradeCurrency = usPostalMoneyOrderAccount.getSingleTradeCurrency();
    String nameAndCode = singleTradeCurrency != null ? singleTradeCurrency.getNameAndCode() : "null";
    addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("shared.currency"), nameAndCode);
    addLimitations(true);
}
 
Example 9
Source File: F2FForm.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public void addFormForAddAccount() {
    gridRowFrom = gridRow + 1;

    Tuple2<ComboBox<TradeCurrency>, Integer> tuple = GUIUtil.addRegionCountryTradeCurrencyComboBoxes(gridPane, gridRow, this::onCountrySelected, this::onTradeCurrencySelected);
    currencyComboBox = tuple.first;
    gridRow = tuple.second;

    InputTextField contactInputTextField = FormBuilder.addInputTextField(gridPane, ++gridRow,
            Res.get("payment.f2f.contact"));
    contactInputTextField.setPromptText(Res.get("payment.f2f.contact.prompt"));
    contactInputTextField.setValidator(f2fValidator);
    contactInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
        f2fAccount.setContact(newValue);
        updateFromInputs();
    });

    cityInputTextField = FormBuilder.addInputTextField(gridPane, ++gridRow,
            Res.get("payment.f2f.city"));
    cityInputTextField.setPromptText(Res.get("payment.f2f.city.prompt"));
    cityInputTextField.setValidator(f2fValidator);
    cityInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
        f2fAccount.setCity(newValue);
        updateFromInputs();
    });

    TextArea extraTextArea = addTopLabelTextArea(gridPane, ++gridRow,
            Res.get("payment.f2f.optionalExtra"), Res.get("payment.f2f.extra.prompt")).second;
    extraTextArea.setPrefHeight(60);
    ((JFXTextArea) extraTextArea).setLabelFloat(false);
    //extraTextArea.setValidator(f2fValidator);
    extraTextArea.textProperty().addListener((ov, oldValue, newValue) -> {
        f2fAccount.setExtraInfo(newValue);
        updateFromInputs();
    });

    addLimitations(false);
    addAccountNameTextFieldWithAutoFillToggleButton();
}
 
Example 10
Source File: USPostalMoneyOrderForm.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
public static int addFormForBuyer(GridPane gridPane, int gridRow,
                                  PaymentAccountPayload paymentAccountPayload) {
    addCompactTopLabelTextFieldWithCopyIcon(gridPane, ++gridRow, Res.get("payment.account.owner"),
            ((USPostalMoneyOrderAccountPayload) paymentAccountPayload).getHolderName());
    TextArea textArea = addCompactTopLabelTextArea(gridPane, ++gridRow, Res.get("payment.postal.address"), "").second;
    textArea.setPrefHeight(70);
    textArea.setEditable(false);
    textArea.setId("text-area-disabled");
    textArea.setText(((USPostalMoneyOrderAccountPayload) paymentAccountPayload).getPostalAddress());
    return gridRow;
}
 
Example 11
Source File: DiffDisplayDialog.java    From zest-writer with GNU General Public License v3.0 4 votes vote down vote up
public DiffDisplayDialog(File file, String newContent, String titleContent, String titleExtract) {
	super(Configuration.getBundle().getString("ui.dialog.download.compare.window.title"), Configuration.getBundle().getString("ui.dialog.download.compare.window.header"));
	this.file = file;
	this.newContent = newContent;
	this.titleContent = titleContent;
       this.titleExtract = titleExtract;
       try {
           if(this.file.exists()) {
               this.oldContent = IOUtils.toString(new FileInputStream(this.file), "UTF-8");
           }
       } catch (IOException e) {
           log.error(e.getMessage(), e);
       }
       ;

    // Set the button types.
    ButtonType validButtonType = new ButtonType(Configuration.getBundle().getString("ui.dialog.download.compare.button.confirm"), ButtonData.OK_DONE);
    this.getDialogPane().getButtonTypes().addAll(validButtonType, ButtonType.CANCEL);

	// Create the username and password labels and fields.
	GridPane grid = new GridPane();
	grid.setHgap(10);
	grid.setVgap(10);
	grid.setPadding(new Insets(20, 20, 10, 10));
       Label l01 = new Label(Configuration.getBundle().getString("ui.dialog.download.compare.content_name") + " : "+titleContent);
       Label l02 = new Label(Configuration.getBundle().getString("ui.dialog.download.compare.extract_name") + " : "+titleExtract);
	Label l1 = new Label(Configuration.getBundle().getString("ui.dialog.download.compare.old_content"));
       Label l2 = new Label(Configuration.getBundle().getString("ui.dialog.download.compare.new_content"));
	TextArea textArea1 = new TextArea();
	textArea1.setEditable(false);
       textArea1.setWrapText(true);
       textArea1.setPrefHeight(500);
       textArea1.setText(oldContent);
       ScrollPane scrollPane1 = new ScrollPane();
       scrollPane1.setContent(textArea1);
       scrollPane1.setFitToWidth(true);
	TextArea textArea2 = new TextArea();
       textArea2.setEditable(false);
       textArea2.setWrapText(true);
       textArea2.setPrefHeight(500);
       textArea2.setText(newContent);
       ScrollPane scrollPane2 = new ScrollPane();
       scrollPane2.setContent(textArea2);
       scrollPane2.setFitToWidth(true);


       grid.add(l01, 0, 0,2, 1);
       grid.add(l02, 0, 1, 2, 1);
	grid.add(l1, 0, 2);
    grid.add(l2, 1, 2);
       grid.add(scrollPane1, 0, 3);
       grid.add(scrollPane2, 1, 3);

    // Enable/Disable login button depending on whether a username was entered.
	this.getDialogPane().lookupButton(validButtonType);

	this.getDialogPane().setContent(grid);

	Platform.runLater(textArea1::requestFocus);

	this.setResultConverter(dialogButton -> {
		if(dialogButton == validButtonType) {
               return true;
		}
		return false;
	});
}
 
Example 12
Source File: UserView.java    From NLIDB with Apache License 2.0 4 votes vote down vote up
@Override
public void start(Stage primaryStage) throws Exception {
	
	stage = primaryStage;
	stage.setTitle("Window for NLIDB");
	
	Label label1 = new Label("Welcome to Natural Language Interface to DataBase!");
	
	Label lblInput = new Label("Natural Language Input:");
	TextArea fieldIn = new TextArea();
	fieldIn.setPrefHeight(100);
	fieldIn.setPrefWidth(100);
	fieldIn.setWrapText(true);
	fieldIn.setText(TEST_TEXT);
	
	btnTranslate = new Button("translate");
	
	// Define action of the translate button.
	btnTranslate.setOnAction(e -> {
		ctrl.processNaturalLanguage(fieldIn.getText());
	});
	
	display = new Text();
	display.setWrappingWidth(500);
	display.prefHeight(300);
	display.setText("Default display text");

	// choices and button for nodes mapping
	choiceBox = new ComboBox<NodeInfo>();
	choiceBox.setVisibleRowCount(6);
	btnConfirmChoice = new Button("confirm choice");
	btnConfirmChoice.setOnAction(e -> {
		ctrl.chooseNode(getChoice());
	});
	
	// choices and button for tree selection
	treeChoice = new ComboBox<Integer>(); // ! only show 3 choices now
	treeChoice.setItems(FXCollections.observableArrayList(0,1,2));
	treeChoice.getSelectionModel().selectedIndexProperty().addListener((ov, oldV, newV) -> {
		ctrl.showTree(treeChoice.getItems().get((Integer) newV));
	});
	btnTreeConfirm = new Button("confirm tree choice");
	btnTreeConfirm.setOnAction(e -> {
		ctrl.chooseTree(treeChoice.getValue());
	});
	
	vb1 = new VBox();
	vb1.setSpacing(10);
	vb1.getChildren().addAll(
			label1,
			lblInput,fieldIn,
			btnTranslate
			);
	
	vb2 = new VBox();
	vb2.setSpacing(20);
	vb2.getChildren().addAll(display);
	
	hb = new HBox();
	hb.setPadding(new Insets(15, 12, 15, 12));
	hb.setSpacing(10);
	hb.getChildren().addAll(vb1, vb2);
	
	scene = new Scene(hb, 800, 450);
	
	stage.setScene(scene);
	ctrl = new Controller(this);
	stage.show();
	
}
 
Example 13
Source File: EditAreaStatus.java    From helloiot with GNU General Public License v3.0 4 votes vote down vote up
@Override
public Node constructContent() {
    StackPane stackpaneroot = new StackPane();
    
    boxview = new HBox();
    boxview.setSpacing(6.0);
    
    statusview = new TextArea();
    statusview.setEditable(false);
    statusview.setFocusTraversable(false);
    statusview.setMaxSize(Double.MAX_VALUE,Double.MAX_VALUE);
    statusview.setPrefHeight(100.0);
    statusview.getStyleClass().add("unitinputview");
    HBox.setHgrow(statusview, Priority.SOMETIMES);
    
    editaction = new Button();
    editaction.setFocusTraversable(false);
    editaction.setMnemonicParsing(false);
    editaction.getStyleClass().add("unitbutton");
    editaction.setOnAction(this::onEditEvent);
    
    boxview.getChildren().addAll(statusview, editaction);
    
    boxedit = new HBox();
    boxedit.setSpacing(6.0);
    boxedit.setVisible(false);
    
    statusedit = new TextArea();
    statusedit.setMaxSize(Double.MAX_VALUE,Double.MAX_VALUE);
    statusedit.setPrefHeight(100.0);        
    statusedit.getStyleClass().add("unitinputarea");
    HBox.setHgrow(statusedit, Priority.SOMETIMES);
    
    okaction = new Button();
    okaction.setFocusTraversable(false);
    okaction.setMnemonicParsing(false);
    okaction.getStyleClass().add("unitbutton");
    okaction.setOnAction(this::onOkEvent);
    
    cancelaction = new Button();
    cancelaction.setFocusTraversable(false);
    cancelaction.setMnemonicParsing(false);
    cancelaction.getStyleClass().add("unitbutton");
    cancelaction.setOnAction(this::onCancelEvent);
    
    boxedit.getChildren().addAll(statusedit, okaction, cancelaction);
    
    stackpaneroot.getChildren().addAll(boxview, boxedit);

    initialize();
    return stackpaneroot;
}