Search in sources :

Example 76 with TextField

use of javafx.scene.control.TextField in project uPMT by coco35700.

the class MomentExpVBox method editNameMode.

private void editNameMode() {
    TextField t = new TextField();
    t.setMaxWidth(180);
    t.setText(moment.getName());
    t.requestFocus();
    ChangeListener<Boolean> listener = new ChangeListener<Boolean>() {

        @Override
        public void changed(ObservableValue<? extends Boolean> arg0, Boolean oldPropertyValue, Boolean newPropertyValue) {
            if (!newPropertyValue) {
                RenameMomentCommand cmd = new RenameMomentCommand(nameController, moment.getName(), t.getText(), main);
                cmd.execute();
                UndoCollector.INSTANCE.add(cmd);
                borderPaneLabel.setCenter(label);
                // borderPaneLabel.setCenter(label);
                t.focusedProperty().removeListener(this);
            }
        }
    };
    t.setOnKeyPressed(new EventHandler<KeyEvent>() {

        @Override
        public void handle(KeyEvent event) {
            if (event.getCode() == KeyCode.ENTER) {
                t.setText(t.getText());
                borderPaneLabel.setCenter(label);
            // borderPaneLabel.setCenter(label);
            }
            if (event.getCode() == KeyCode.ESCAPE) {
                borderPaneLabel.setCenter(label);
            // borderPaneLabel.setCenter(label);
            }
        }
    });
    t.focusedProperty().addListener(listener);
    Platform.runLater(() -> t.requestFocus());
    Platform.runLater(() -> t.selectAll());
    borderPaneLabel.setCenter(t);
// borderPaneLabel.setCenter(t);
}
Also used : KeyEvent(javafx.scene.input.KeyEvent) RenameMomentCommand(controller.command.RenameMomentCommand) ObservableValue(javafx.beans.value.ObservableValue) TextField(javafx.scene.control.TextField) ChangeListener(javafx.beans.value.ChangeListener)

Example 77 with TextField

use of javafx.scene.control.TextField in project uPMT by coco35700.

the class TypePropertyRepresentation method setLabelChangeName.

private void setLabelChangeName(HBox propertyPane2, TypePropertyRepresentation tpr) {
    propertyValue.setOnMouseClicked(new EventHandler<MouseEvent>() {

        @Override
        public void handle(MouseEvent arg0) {
            if (arg0.getClickCount() == 2) {
                TextField t = new TextField(propertyValue.getText());
                t.setMaxWidth(70);
                t.setMinWidth(10);
                ChangeListener<Boolean> listener = new ChangeListener<Boolean>() {

                    @Override
                    public void changed(ObservableValue<? extends Boolean> arg0, Boolean oldPropertyValue, Boolean newPropertyValue) {
                        if (!newPropertyValue) {
                            ChangePropertyValueCommand cmd = new ChangePropertyValueCommand(tpr, property.getValue(), t.getText(), main);
                            cmd.execute();
                            UndoCollector.INSTANCE.add(cmd);
                            propertyPane2.getChildren().remove(2);
                            propertyPane2.getChildren().add(propertyValue);
                        // propertyPane2.setRight(propertyValue);
                        }
                    }
                };
                t.setOnKeyPressed(new EventHandler<KeyEvent>() {

                    @Override
                    public void handle(KeyEvent event) {
                        if (event.getCode() == KeyCode.ENTER) {
                            t.setText(t.getText());
                            propertyPane2.getChildren().remove(2);
                            propertyPane2.getChildren().add(propertyValue);
                        // propertyPane2.setRight(propertyValue);
                        }
                        if (event.getCode() == KeyCode.ESCAPE) {
                            propertyPane2.getChildren().remove(2);
                            propertyPane2.getChildren().add(propertyValue);
                        // propertyPane2.setRight(propertyValue);
                        }
                    }
                });
                t.focusedProperty().addListener(listener);
                Platform.runLater(() -> t.requestFocus());
                Platform.runLater(() -> t.selectAll());
                propertyPane2.getChildren().remove(2);
                propertyPane2.getChildren().add(t);
            // propertyPane2.setRight(t);
            }
        }
    });
}
Also used : KeyEvent(javafx.scene.input.KeyEvent) ChangePropertyValueCommand(controller.command.ChangePropertyValueCommand) MouseEvent(javafx.scene.input.MouseEvent) TextField(javafx.scene.control.TextField) EventHandler(javafx.event.EventHandler) ChangeListener(javafx.beans.value.ChangeListener)

Example 78 with TextField

use of javafx.scene.control.TextField in project uPMT by coco35700.

the class InterviewTreeViewController method renameInter.

public void renameInter() {
    renameInterview.setDisable(true);
    TextField textField = new TextField();
    textField.setText(interview.getName());
    textField.setMaxWidth(100);
    textField.requestFocus();
    textField.focusedProperty().addListener(new ChangeListener<Boolean>() {

        @Override
        public void changed(ObservableValue<? extends Boolean> arg0, Boolean oldPropertyValue, Boolean newPropertyValue) {
            if (!newPropertyValue) {
                nomEntretien.setText(textField.getText());
                interview.setName(textField.getText());
                interviewPane.setLeft(nomEntretien);
                renameInterview.setDisable(false);
            }
        }
    });
    textField.setOnKeyPressed(new EventHandler<KeyEvent>() {

        @Override
        public void handle(KeyEvent event) {
            if (event.getCode() == KeyCode.ENTER) {
                nomEntretien.setText(textField.getText());
                interview.setName(textField.getText());
                interviewPane.setLeft(nomEntretien);
                renameInterview.setDisable(true);
            }
            if (event.getCode() == KeyCode.ESCAPE) {
                interviewPane.setLeft(nomEntretien);
                renameInterview.setDisable(true);
            }
        }
    });
    interviewPane.setLeft(textField);
    Platform.runLater(() -> textField.requestFocus());
    Platform.runLater(() -> textField.selectAll());
}
Also used : KeyEvent(javafx.scene.input.KeyEvent) TextField(javafx.scene.control.TextField)

Example 79 with TextField

use of javafx.scene.control.TextField in project certmgr by hdecarne.

the class AbstractPeriodStringConverter method attach.

/**
 * Attach this converter to a {@link ComboBox}.
 *
 * @param comboBox The {@link ComboBox} to attach to.
 */
public void attach(ComboBox<T> comboBox) {
    comboBox.setConverter(this);
    if (comboBox.isEditable()) {
        TextField editor = comboBox.getEditor();
        editor.focusedProperty().addListener((p, o, n) -> onFocusedChanged(editor, n));
    }
}
Also used : TextField(javafx.scene.control.TextField)

Example 80 with TextField

use of javafx.scene.control.TextField in project S4T1TM2 by CSUS-CSC-131-Spring2018.

the class ProjectsScene method getScene.

@Override
public Pane getScene() {
    Pane scene = new StackPane();
    scene.setOpaqueInsets(new Insets(10));
    Pane taskNav = new Pane();
    taskNav.prefHeightProperty().bind(scene.heightProperty());
    taskNav.prefWidthProperty().bind(DoubleConstant.valueOf(150));
    // taskNav.setBackground(new Background(new BackgroundFill(Color.GREEN, null, null)));
    scene.getChildren().add(taskNav);
    TextField filterField = new JFXTextField();
    filterField.layoutXProperty().bind(DoubleConstant.valueOf(0));
    filterField.layoutYProperty().bind(DoubleConstant.valueOf(0));
    filterField.prefWidthProperty().bind(DoubleConstant.valueOf(200));
    filterField.setPromptText("Search");
    taskNav.getChildren().add(filterField);
    FilterableTreeItem<String> rootNode = new FilterableTreeItem<>("SAFsaf");
    JFXTreeView<String> treeView = new JFXTreeView<>(rootNode);
    treeView.setEditable(true);
    treeView.setShowRoot(false);
    rootNode.getInternalChildren().add(new FilterableTreeItem<String>("Sprint 1") {

        {
            this.getInternalChildren().add(new FilterableTreeItem<String>("Task A") {

                {
                    this.getInternalChildren().add(new FilterableTreeItem<String>("Sub-Task A") {

                        {
                        }
                    });
                    this.getInternalChildren().add(new FilterableTreeItem<String>("Sub-Task B") {

                        {
                        }
                    });
                }
            });
            this.getInternalChildren().add(new FilterableTreeItem<String>("Task B") {

                {
                    this.getInternalChildren().add(new FilterableTreeItem<String>("Sub-Task A") {

                        {
                        }
                    });
                    this.getInternalChildren().add(new FilterableTreeItem<String>("Sub-Task B") {

                        {
                        }
                    });
                }
            });
        }
    });
    rootNode.getInternalChildren().add(new FilterableTreeItem<String>("Sprint 2") {

        {
            this.getInternalChildren().add(new FilterableTreeItem<String>("Task A") {

                {
                    this.getInternalChildren().add(new FilterableTreeItem<String>("Sub-Task A") {

                        {
                        }
                    });
                    this.getInternalChildren().add(new FilterableTreeItem<String>("Sub-Task B") {

                        {
                        }
                    });
                }
            });
            this.getInternalChildren().add(new FilterableTreeItem<String>("Task B") {

                {
                    this.getInternalChildren().add(new FilterableTreeItem<String>("Sub-Task A") {

                        {
                        }
                    });
                    this.getInternalChildren().add(new FilterableTreeItem<String>("Sub-Task B") {

                        {
                        }
                    });
                }
            });
        }
    });
    rootNode.getInternalChildren().add(new FilterableTreeItem<String>("Sprint 2") {

        {
            this.getInternalChildren().add(new FilterableTreeItem<String>("Task A") {

                {
                    this.getInternalChildren().add(new FilterableTreeItem<String>("Sub-Task A") {

                        {
                        }
                    });
                    this.getInternalChildren().add(new FilterableTreeItem<String>("Sub-Task B") {

                        {
                        }
                    });
                }
            });
            this.getInternalChildren().add(new FilterableTreeItem<String>("Task B") {

                {
                    this.getInternalChildren().add(new FilterableTreeItem<String>("Sub-Task A") {

                        {
                        }
                    });
                    this.getInternalChildren().add(new FilterableTreeItem<String>("Sub-Task B") {

                        {
                        }
                    });
                }
            });
        }
    });
    // treeView.prefWidthProperty().bind(DoubleConstant.valueOf(200));
    treeView.layoutYProperty().bind(filterField.layoutYProperty().add(filterField.heightProperty()));
    treeView.layoutXProperty().bind(DoubleConstant.valueOf(0));
    treeView.prefWidthProperty().bind(DoubleConstant.valueOf(200));
    treeView.prefHeightProperty().bind(taskNav.heightProperty().subtract(filterField.heightProperty()));
    taskNav.getChildren().add(treeView);
    // define search predicate
    rootNode.predicateProperty().bind(Bindings.createObjectBinding(() -> {
        // predicate is reevaluated when filterfield is modified
        if (filterField.getText() == null || filterField.getText().isEmpty()) {
            return null;
        }
        return TreeViewDemo.TreeItemPredicate.create(actor -> actor.toLowerCase().contains(filterField.getText().toLowerCase()));
    }, filterField.textProperty()));
    return scene;
}
Also used : TextField(javafx.scene.control.TextField) StackPane(javafx.scene.layout.StackPane) TreeViewDemo(edu.csus.yaam.test.TreeViewDemo) Bindings(javafx.beans.binding.Bindings) Insets(javafx.geometry.Insets) DoubleConstant(com.sun.javafx.binding.DoubleConstant) NavAction(edu.csus.yaam.client.gui.nav.NavAction) FontAwesomeIcon(de.jensd.fx.glyphs.fontawesome.FontAwesomeIcon) FilterableTreeItem(edu.csus.yaam.test.TreeViewDemo.FilterableTreeItem) ProjectScene(edu.csus.yaam.client.gui.nav.ProjectScene) JFXTreeView(com.jfoenix.controls.JFXTreeView) JFXTextField(com.jfoenix.controls.JFXTextField) Pane(javafx.scene.layout.Pane) Insets(javafx.geometry.Insets) JFXTextField(com.jfoenix.controls.JFXTextField) FilterableTreeItem(edu.csus.yaam.test.TreeViewDemo.FilterableTreeItem) TextField(javafx.scene.control.TextField) JFXTextField(com.jfoenix.controls.JFXTextField) StackPane(javafx.scene.layout.StackPane) Pane(javafx.scene.layout.Pane) StackPane(javafx.scene.layout.StackPane) JFXTreeView(com.jfoenix.controls.JFXTreeView)

Aggregations

TextField (javafx.scene.control.TextField)224 Label (javafx.scene.control.Label)99 Button (javafx.scene.control.Button)71 Insets (javafx.geometry.Insets)62 HBox (javafx.scene.layout.HBox)46 GridPane (javafx.scene.layout.GridPane)44 Scene (javafx.scene.Scene)42 VBox (javafx.scene.layout.VBox)36 InputTextField (bisq.desktop.components.InputTextField)32 Node (javafx.scene.Node)30 Stage (javafx.stage.Stage)27 List (java.util.List)26 CheckBox (javafx.scene.control.CheckBox)24 ButtonType (javafx.scene.control.ButtonType)23 Tooltip (javafx.scene.control.Tooltip)23 StackPane (javafx.scene.layout.StackPane)22 ArrayList (java.util.ArrayList)21 Dialog (javafx.scene.control.Dialog)21 BorderPane (javafx.scene.layout.BorderPane)19 ImageView (javafx.scene.image.ImageView)18