Java Code Examples for javafx.scene.control.TextField#setEditable()

The following examples show how to use javafx.scene.control.TextField#setEditable() . 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: FormBuilder.java    From bisq with GNU Affero General Public License v3.0 6 votes vote down vote up
public static Tuple3<Label, TextField, Button> addTopLabelTextFieldButton(GridPane gridPane,
                                                                          int rowIndex,
                                                                          String title,
                                                                          String buttonTitle,
                                                                          double top) {

    TextField textField = new BisqTextField();
    textField.setEditable(false);
    textField.setMouseTransparent(true);
    textField.setFocusTraversable(false);
    Button button = new AutoTooltipButton(buttonTitle);
    button.setDefaultButton(true);

    HBox hBox = new HBox();
    hBox.setSpacing(10);
    hBox.getChildren().addAll(textField, button);
    HBox.setHgrow(textField, Priority.ALWAYS);

    final Tuple2<Label, VBox> labelVBoxTuple2 = addTopLabelWithVBox(gridPane, rowIndex, title, hBox, top);

    return new Tuple3<>(labelVBoxTuple2.first, textField, button);
}
 
Example 2
Source File: CodePane.java    From JRemapper with MIT License 6 votes vote down vote up
/**
 * Update the current selected class.
 * 
 * @param c
 *            The newly selected class.
 */
private void updateSelection(CDec c) {
	selectedDec = c;
	info.getChildren().clear();
	info.add(new Label("Class name"), 0, 0);
	TextField name = new TextField();
	if (c.hasMappings()) {
		name.setText(c.map().getCurrentName());
	} else {
		name.setText(c.getFullName());
		name.setEditable(false);
	}
	if (c.isLocked())
		name.setDisable(true);
	info.add(name, 1, 0);
	name.addEventHandler(KeyEvent.KEY_PRESSED, (KeyEvent e) -> {
		if (KeyCode.ENTER == e.getCode()) {
			pass = -2;
			c.map().setCurrentName(name.getText());
			refreshCode();
			resetSelection();
			updateStyleAndRegions();
		}
	});
}
 
Example 3
Source File: EditView.java    From helloiot with GNU General Public License v3.0 6 votes vote down vote up
@Override
public Node constructContent() {
    
    boxview = new HBox();
    boxview.setSpacing(6.0);

    statusview = new TextField();
    statusview.setEditable(false);
    statusview.setFocusTraversable(false);
    statusview.getStyleClass().add("unitinputview");
    HBox.setHgrow(statusview, Priority.SOMETIMES);
    
    boxview.getChildren().add(statusview);

    initialize();
    return boxview;
}
 
Example 4
Source File: FormBuilder.java    From bisq with GNU Affero General Public License v3.0 6 votes vote down vote up
public static Tuple4<Label, TextField, Label, TextField> addCompactTopLabelTextFieldTopLabelTextField(GridPane gridPane,
                                                                                                      int rowIndex,
                                                                                                      String title1,
                                                                                                      String title2) {
    TextField textField1 = new BisqTextField();
    textField1.setEditable(false);
    textField1.setMouseTransparent(true);
    textField1.setFocusTraversable(false);

    final Tuple2<Label, VBox> topLabelWithVBox1 = getTopLabelWithVBox(title1, textField1);

    TextField textField2 = new BisqTextField();
    textField2.setEditable(false);
    textField2.setMouseTransparent(true);
    textField2.setFocusTraversable(false);

    final Tuple2<Label, VBox> topLabelWithVBox2 = getTopLabelWithVBox(title2, textField2);

    HBox hBox = new HBox();
    hBox.setSpacing(10);
    hBox.getChildren().addAll(topLabelWithVBox1.second, topLabelWithVBox2.second);
    GridPane.setRowIndex(hBox, rowIndex);
    gridPane.getChildren().add(hBox);

    return new Tuple4<>(topLabelWithVBox1.first, textField1, topLabelWithVBox2.first, textField2);
}
 
Example 5
Source File: TransfersTab.java    From xframium-java with GNU General Public License v3.0 5 votes vote down vote up
private HBox getLine (RadioButton button, TextField text)
{
  HBox line = new HBox (10);
  line.getChildren ().addAll (button, text);
  button.setPrefWidth (LABEL_WIDTH);
  text.setPrefWidth (300);
  text.setFont (defaultFont);
  text.setEditable (false);
  text.setFocusTraversable (false);
  button.setUserData (text);

  return line;
}
 
Example 6
Source File: TakeOfferView.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
private void addPayInfoEntry(GridPane infoGridPane, int row, String labelText, String value) {
    Label label = new AutoTooltipLabel(labelText);
    TextField textField = new TextField(value);
    textField.setMinWidth(500);
    textField.setEditable(false);
    textField.setFocusTraversable(false);
    textField.setId("payment-info");
    GridPane.setConstraints(label, 0, row, 1, 1, HPos.RIGHT, VPos.CENTER);
    GridPane.setConstraints(textField, 1, row);
    infoGridPane.getChildren().addAll(label, textField);
}
 
Example 7
Source File: MutableOfferView.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
private void addPayInfoEntry(GridPane infoGridPane, int row, String labelText, String value) {
    Label label = new AutoTooltipLabel(labelText);
    TextField textField = new TextField(value);
    textField.setMinWidth(500);
    textField.setEditable(false);
    textField.setFocusTraversable(false);
    textField.setId("payment-info");
    GridPane.setConstraints(label, 0, row, 1, 1, HPos.RIGHT, VPos.CENTER);
    GridPane.setConstraints(textField, 1, row);
    infoGridPane.getChildren().addAll(label, textField);
}
 
Example 8
Source File: PacketHex.java    From trex-stateless-gui with Apache License 2.0 5 votes vote down vote up
/**
 *
 */
public TextFieldCell() {
    textField = new TextField();
    textField.addEventFilter(KeyEvent.KEY_TYPED, hex_Validation(50));
    textField.getStyleClass().add("hexTextFieldEditor");
    textField.setEditable(false);
    textField.setOnMouseClicked((MouseEvent mouseEvent) -> {
        if (mouseEvent.getButton().equals(MouseButton.PRIMARY) && mouseEvent.getClickCount() == 2) {
            handleMouseClickedEvent();
        }
    });
    this.setGraphic(textField);
}
 
Example 9
Source File: TransfersTab.java    From xframium-java with GNU General Public License v3.0 5 votes vote down vote up
private HBox getLine (Label label, TextField text, HBox hbox)
{
  HBox line = new HBox (10);

  line.getChildren ().addAll (label, text, hbox);
  label.setPrefWidth (LABEL_WIDTH);
  text.setPrefWidth (100);
  text.setFont (defaultFont);
  text.setEditable (true);
  text.setFocusTraversable (true);

  return line;
}
 
Example 10
Source File: PropertiesAction.java    From phoebus with Eclipse Public License 1.0 5 votes vote down vote up
private Node createContent()
{
    final GridPane layout = new GridPane();
    layout.setHgap(5);
    layout.setVgap(5);

    int row = 0;

    final TextField filename = new TextField(file.getAbsolutePath());
    filename.setEditable(false);
    GridPane.setHgrow(filename, Priority.ALWAYS);
    layout.add(new Label(Messages.PropDlgPath), 0, row);
    layout.add(filename, 1, row);

    final TextField date = new TextField(TimestampFormats.MILLI_FORMAT.format(Instant.ofEpochMilli(file.lastModified())));
    date.setEditable(false);
    date.setMinWidth(200);
    GridPane.setHgrow(date, Priority.ALWAYS);
    layout.add(new Label(Messages.PropDlgDate), 0, ++row);
    layout.add(date, 1, row);

    if (!file.isDirectory())
    {
        final TextField size = new TextField(file.length() + " " + Messages.PropDlgBytes);
        size.setEditable(false);
        GridPane.setHgrow(size, Priority.ALWAYS);
        layout.add(new Label(Messages.PropDlgSize), 0, ++row);
        layout.add(size, 1, row);
    }

    layout.add(new Label(Messages.PropDlgPermissions), 0, ++row);
    layout.add(writable, 1, row);
    layout.add(executable, 1, ++row);

    writable.setSelected(file.canWrite());
    executable.setSelected(file.canExecute());

    return layout;
}
 
Example 11
Source File: CheckListFormNode.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
private VBox createNameField() {
    VBox nameFieldBox = new VBox();
    TextField nameField = new TextField();
    nameField.textProperty().addListener((observable, oldValue, newValue) -> {
        fireContentChanged();
        checkList.setName(nameField.getText());
    });
    nameField.setEditable(mode.isSelectable());
    nameFieldBox.getChildren().addAll(new Label("Name"), nameField);
    HBox.setHgrow(nameField, Priority.ALWAYS);
    VBox.setMargin(nameFieldBox, new Insets(5, 10, 0, 5));
    nameField.setText(checkList.getName());
    HBox.setHgrow(nameFieldBox, Priority.ALWAYS);
    return nameFieldBox;
}
 
Example 12
Source File: JapanBankTransferForm.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
private void addBankAccountTypeDisplay() // {{{
{
    TradeCurrency singleTradeCurrency = japanBankAccount.getSingleTradeCurrency();
    String currency = singleTradeCurrency != null ? singleTradeCurrency.getNameAndCode() : "null";
    String accountTypeText = currency + " " + japanBankAccount.getBankAccountType();
    TextField accountTypeTextField = addCompactTopLabelTextField(gridPane, ++gridRow, JapanBankData.getString("account.type"), accountTypeText).second;
    accountTypeTextField.setEditable(false);
}
 
Example 13
Source File: TransfersTab.java    From dm3270 with Apache License 2.0 5 votes vote down vote up
private HBox getLine (Label label, TextField text, HBox hbox)
{
  HBox line = new HBox (10);

  line.getChildren ().addAll (label, text, hbox);
  label.setPrefWidth (LABEL_WIDTH);
  text.setPrefWidth (100);
  text.setFont (defaultFont);
  text.setEditable (true);
  text.setFocusTraversable (true);

  return line;
}
 
Example 14
Source File: NeutralMassComponent.java    From mzmine3 with GNU General Public License v2.0 5 votes vote down vote up
public NeutralMassComponent() {

    add(new Label("m/z:"), 0, 0);

    ionMassField = new TextField();
    ionMassField.textProperty().addListener((observable, oldValue, newValue) -> {
      updateNeutralMass();
    });
    ionMassField.setPrefColumnCount(8);
    add(ionMassField, 1, 0);

    add(new Label("Charge:"), 2, 0);

    chargeField = new TextField();
    chargeField.textProperty().addListener((observable, oldValue, newValue) -> {
      updateNeutralMass();
    });
    chargeField.setPrefColumnCount(2);
    add(chargeField, 3, 0);

    add(new Label("Ionization type:"), 0, 1, 2, 1);
    ionTypeCombo =
        new ComboBox<IonizationType>(FXCollections.observableArrayList(IonizationType.values()));
    ionTypeCombo.setOnAction(e -> {
      updateNeutralMass();
    });
    add(ionTypeCombo, 2, 1, 2, 1);

    add(new Label("Calculated mass:"), 0, 2, 2, 1);

    neutralMassField = new TextField();
    neutralMassField.setPrefColumnCount(8);
    neutralMassField.setStyle("-fx-background-color: rgb(192, 224, 240);");
    neutralMassField.setEditable(false);
    add(neutralMassField, 2, 2, 2, 1);

  }
 
Example 15
Source File: JapanBankTransferForm.java    From bisq with GNU Affero General Public License v3.0 4 votes vote down vote up
private void addBankDisplay() // {{{
{
    String bankText = japanBankAccount.getBankCode() + " " + japanBankAccount.getBankName();
    TextField bankTextField = addCompactTopLabelTextField(gridPane, ++gridRow, JapanBankData.getString("bank"), bankText).second;
    bankTextField.setEditable(false);
}
 
Example 16
Source File: AttributeEditorPanel.java    From constellation with Apache License 2.0 4 votes vote down vote up
private Node createAttributeValueNode(final Object[] values, final AttributeData attribute, final AttributeTitledPane parent, final boolean multiValue) {

        boolean noneSelected = values == null;
        boolean isNull = !noneSelected && (values[0] == null);
        parent.setAttribute(attribute);

        AbstractAttributeInteraction<?> interaction = AbstractAttributeInteraction.getInteraction(attribute.getDataType());

        final String displayText;
        final List<Node> displayNodes;
        if (multiValue) {
            displayText = "<Multiple Values>";
            displayNodes = Collections.emptyList();
        } else if (isNull) {
            displayText = NO_VALUE_TEXT;
            displayNodes = Collections.emptyList();
        } else if (noneSelected) {
            displayText = "<Nothing Selected>";
            displayNodes = Collections.emptyList();
        } else {
            displayText = interaction.getDisplayText(values[0]);
            displayNodes = interaction.getDisplayNodes(values[0], -1, CELL_ITEM_HEIGHT);
        }

        parent.setAttributeValue(displayText);
        final TextField attributeValueText = new TextField(displayText);
        attributeValueText.setEditable(false);
        if (noneSelected || isNull || multiValue) {
            attributeValueText.getStyleClass().add("undisplayedValue");
        }

        if (displayNodes.isEmpty()) {
            return attributeValueText;
        }

        GridPane gridPane = new GridPane();
        gridPane.setAlignment(Pos.CENTER_RIGHT);
        gridPane.setPadding(Insets.EMPTY);
        gridPane.setHgap(CELL_ITEM_SPACING);
        ColumnConstraints displayNodeConstraint = new ColumnConstraints(CELL_ITEM_HEIGHT);
        displayNodeConstraint.setHalignment(HPos.LEFT);
        ColumnConstraints displayTextConstraint = new ColumnConstraints();
        displayTextConstraint.setHalignment(HPos.RIGHT);
        displayTextConstraint.setHgrow(Priority.ALWAYS);
        displayTextConstraint.setFillWidth(true);

        for (int i = 0; i < displayNodes.size(); i++) {
            final Node displayNode = displayNodes.get(i);
            gridPane.add(displayNode, i, 0);
            gridPane.getColumnConstraints().add(displayNodeConstraint);
        }

        gridPane.add(attributeValueText, displayNodes.size(), 0);
        gridPane.getColumnConstraints().add(displayTextConstraint);

        return gridPane;
    }
 
Example 17
Source File: JapanBankTransferForm.java    From bisq with GNU Affero General Public License v3.0 4 votes vote down vote up
private void addBankBranchDisplay() // {{{
{
    String branchText = japanBankAccount.getBankBranchCode() + " " + japanBankAccount.getBankBranchName();
    TextField branchTextField = addCompactTopLabelTextField(gridPane, ++gridRow, JapanBankData.getString("branch"), branchText).second;
    branchTextField.setEditable(false);
}
 
Example 18
Source File: LockFileAlreadyExistsDialog.java    From paintera with GNU General Public License v2.0 4 votes vote down vote up
public static void showDialog(final LockFile.UnableToCreateLock exception)
{
	final Alert alert = new Alert(AlertType.ERROR);
	alert.setTitle("Paintera");
	alert.setHeaderText("Unable to create lock file.");

	final Label instructions = new Label(
			"If no other Paintera instance is accessing the same project please delete lock file and try to " +
					"restart Paintera.");
	instructions.setWrapText(true);

	final GridPane  content      = new GridPane();
	final Label     fileLabel    = new Label("Lock File");
	final Label     messageLabel = new Label("Message");
	final TextField fileField    = new TextField(exception.getLockFile().getAbsolutePath());
	final TextField messageField = new TextField(exception.getMessage());
	fileField.setTooltip(new Tooltip(fileField.getText()));
	messageField.setTooltip(new Tooltip(messageField.getText()));

	fileField.setEditable(false);
	messageField.setEditable(false);

	GridPane.setHgrow(fileField, Priority.ALWAYS);
	GridPane.setHgrow(messageField, Priority.ALWAYS);

	content.add(fileLabel, 0, 0);
	content.add(messageLabel, 0, 1);
	content.add(fileField, 1, 0);
	content.add(messageField, 1, 1);

	final VBox contentBox = new VBox(instructions, content);

	alert.getDialogPane().setContent(contentBox);

	final StringWriter stringWriter = new StringWriter();
	exception.printStackTrace(new PrintWriter(stringWriter));
	final String   exceptionText = stringWriter.toString();
	final TextArea textArea      = new TextArea(exceptionText);
	textArea.setEditable(false);
	textArea.setWrapText(true);

	LOG.trace("Exception text (length={}): {}", exceptionText.length(), exceptionText);

	textArea.setMaxWidth(Double.MAX_VALUE);
	textArea.setMaxHeight(Double.MAX_VALUE);
	GridPane.setVgrow(textArea, Priority.ALWAYS);
	GridPane.setHgrow(textArea, Priority.ALWAYS);

	//		final GridPane expandableContent = new GridPane();
	//		expandableContent.setMaxWidth( Double.MAX_VALUE );
	//
	//		expandableContent.add( child, columnIndex, rowIndex );

	alert.getDialogPane().setExpandableContent(textArea);

	//		alert.setResizable( true );
	alert.showAndWait();
}
 
Example 19
Source File: EditStatus.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 TextField();
    statusview.setEditable(false);
    statusview.setFocusTraversable(false);
    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 TextField();
    statusedit.getStyleClass().add("unitinput");
    HBox.setHgrow(statusedit, Priority.SOMETIMES);
    ((TextField) statusedit).setOnAction(this::onEnterEvent);
    
    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;
}
 
Example 20
Source File: JapanBankTransferForm.java    From bisq with GNU Affero General Public License v3.0 4 votes vote down vote up
private void addBankAccountDisplay() // {{{
{
    String accountText = japanBankAccount.getBankAccountNumber() + " " + japanBankAccount.getBankAccountName();
    TextField accountTextField = addCompactTopLabelTextField(gridPane, ++gridRow, JapanBankData.getString("account"), accountText).second;
    accountTextField.setEditable(false);
}