Package javafx.scene.control

Examples of javafx.scene.control.TextField


* Time: 23:28
*/
public class StringPropertyDelegate implements NodeFactory<PropertyElementController<String>> {

    public Node createNode(final PropertyElementController<String> controller) throws NodeCreationException {
        final TextField text = new TextField();
        String value = controller.getValue();
        if (value != null) {
            text.setText(value);
        }
        text.textProperty().addListener(new ChangeListener<String>() {
            public void changed(ObservableValue<? extends String> observableValue, String s, String s1) {
                controller.setValue(s1);
            }
        });
        controller.addListener(new ChangeListener<String>() {
            public void changed(ObservableValue<? extends String> observableValue, String s, String s1) {
                if (s1 != null) {
                    text.setText(s1);
                } else {
                    text.setText("");
                }
            }
        });
        return text;
    }
View Full Code Here


    public AbstractNumberPropertyDelegate(FormatProvider formatProvider) {
        this.formatProvider = formatProvider;
    }

    public Node createNode(final PropertyElementController<T> controller) {
        final TextField textBox = new TextField();
        textBox.textProperty().addListener(new ChangeListener<String>() {

            public void changed(ObservableValue<? extends String> observableValue, String s, String s1) {
                if (textBox.getText().trim().length() > 0) {
                    try {
                        Number parsed = parse(formatProvider.getFormat(controller.getElement()), textBox.getText());
                        controller.setValue((T) parsed);
                    } catch (ParseException e) {
                        e.printStackTrace();
                    }
                }
            }
        });
        if (controller.getValue() != null) {
            textBox.textProperty().setValue(formatProvider.getFormat(controller.getElement()).format(controller.getValue()));
        }
        controller.addListener(new ChangeListener() {
            public void changed(ObservableValue observableValue, Object o, Object o1) {
               textBox.textProperty().setValue(formatProvider.getFormat(controller.getElement()).format(controller.getValue()));
            }
        });
        return textBox;
    }
View Full Code Here

        Menu item1 = new Menu("test submenu");
        MenuItem subMenuItem1 = new MenuItem("Sub Menu Item 1");
        MenuItem subMenuItem2 = new MenuItem("Sub Menu Item 2");
        MenuItem subMenuItem3 = new MenuItem("Sub Menu Item 3");
        item1.getItems().addAll(subMenuItem1, subMenuItem2, subMenuItem3);
        TextField tf1 = new TextField("Textfield");
        ContextMenu cm = new ContextMenu(new MenuItem("test"), item1, new MenuItem("test"));
        tf1.setContextMenu(cm);
        textfieldBox1.getChildren().add(tf1);
        TextField tf2 = new TextField();
        textfieldBox1.getChildren().add(tf2);
        HBox textfieldBox2 = new HBox();
        textfieldBox2.setSpacing(10);
        textfieldBox2.setPadding(new Insets(10));
        TextField tf3 = new TextField("disabled Textfield");
        tf3.setDisable(true);
        tf3.setEditable(false);
        textfieldBox2.getChildren().add(tf3);
        TextField tf4 = new TextField();
        tf4.setPromptText("prompt text");
        textfieldBox2.getChildren().add(tf4);
        txts.getChildren().add(textfieldBox2);
        HBox textfieldBox3 = new HBox();
        textfieldBox3.setSpacing(10);
        textfieldBox3.setPadding(new Insets(10));
        TextField tf5 = new TextField("non-editable textfield");
        tf5.setEditable(false);
        textfieldBox3.getChildren().add(tf5);
        PasswordField pw1 = new PasswordField();
        pw1.setText("password");
        textfieldBox3.getChildren().add(pw1);
        txts.getChildren().add(textfieldBox3);
View Full Code Here

        HBox separator = new HBox();
        separator.setPrefSize(15, 1);
        Button btnAll = new Button("Alle einblenden");
        HBox separator2 = new HBox();
        separator2.setPrefSize(279, 1);
        TextField search = new TextField();
        AquaFx.createTextFieldStyler().setType(TextFieldType.SEARCH).style(search);
        toolBar.getItems().addAll(tbBack, tbForward, separator, btnAll, separator2, search);

        pane.setTop(toolBar);
View Full Code Here

        AquaFx.createCheckBoxStyler().setSizeVariant(ControlSizeVariant.REGULAR).style(cb5);
        grid.add(cb5, 3, 2);
        RadioButton rb5 = new RadioButton("RadioButton");
        AquaFx.createRadioButtonStyler().setSizeVariant(ControlSizeVariant.REGULAR).style(rb5);
        grid.add(rb5, 4, 2);
        TextField tf5 = new TextField("TextField");
        AquaFx.createTextFieldStyler().setSizeVariant(ControlSizeVariant.REGULAR).style(tf5);
        grid.add(tf5, 5, 2);
        ComboBox<String> ecombo5 = new ComboBox<String>();
        ecombo5.setItems(items);
        ecombo5.setEditable(true);
        ecombo5.setPromptText("select");
        AquaFx.createComboBoxStyler().setSizeVariant(ControlSizeVariant.REGULAR).style(ecombo5);
        grid.add(ecombo5, 6, 2);
        ComboBox<String> combo5 = new ComboBox<String>();
        combo5.setItems(items);
        combo5.setPromptText("select");
        AquaFx.createComboBoxStyler().setSizeVariant(ControlSizeVariant.REGULAR).style(combo5);
        grid.add(combo5, 7, 2);
        ChoiceBox<String> choice5 = new ChoiceBox<String>();
        choice5.setItems(items);
        choice5.getSelectionModel().selectFirst();
        AquaFx.createChoiceBoxStyler().setSizeVariant(ControlSizeVariant.REGULAR).style(choice5);
        grid.add(choice5, 8, 2);

        Label labelb6 = new Label("small:");
        AquaFx.createLabelStyler().setSizeVariant(ControlSizeVariant.SMALL).style(labelb6);
        grid.add(labelb6, 0, 3);
        Button b6 = new Button("Button");
        AquaFx.createButtonStyler().setSizeVariant(ControlSizeVariant.SMALL).style(b6);
        grid.add(b6, 1, 3);
        ToggleButton tb6 = new ToggleButton("ToggleButton");
        AquaFx.createToggleButtonStyler().setSizeVariant(ControlSizeVariant.SMALL).style(tb6);
        grid.add(tb6, 2, 3);
        CheckBox cb6 = new CheckBox("CheckBox");
        cb6.setSelected(true);
        // cb6.setDisable(true);
        AquaFx.createCheckBoxStyler().setSizeVariant(ControlSizeVariant.SMALL).style(cb6);
        grid.add(cb6, 3, 3);
        RadioButton rb6 = new RadioButton("RadioButton");
        AquaFx.createRadioButtonStyler().setSizeVariant(ControlSizeVariant.SMALL).style(rb6);
        grid.add(rb6, 4, 3);
        TextField tf6 = new TextField("TextField");
        AquaFx.createTextFieldStyler().setSizeVariant(ControlSizeVariant.SMALL).style(tf6);
        grid.add(tf6, 5, 3);
        ComboBox<String> ecombo6 = new ComboBox<String>();
        ecombo6.setItems(items);
        ecombo6.setEditable(true);
        ecombo6.setPromptText("select");
        AquaFx.createComboBoxStyler().setSizeVariant(ControlSizeVariant.SMALL).style(ecombo6);
        grid.add(ecombo6, 6, 3);
        ComboBox<String> combo6 = new ComboBox<String>();
        combo6.setItems(items);
        combo6.setPromptText("select");
        AquaFx.createComboBoxStyler().setSizeVariant(ControlSizeVariant.SMALL).style(combo6);
        grid.add(combo6, 7, 3);
        ChoiceBox<String> choice6 = new ChoiceBox<String>();
        choice6.setItems(items);
        choice6.getSelectionModel().selectFirst();
        AquaFx.createChoiceBoxStyler().setSizeVariant(ControlSizeVariant.SMALL).style(choice6);
        grid.add(choice6, 8, 3);

        Label labelb7 = new Label("mini:");
        AquaFx.createLabelStyler().setSizeVariant(ControlSizeVariant.MINI).style(labelb7);
        grid.add(labelb7, 0, 4);
        Button b7 = new Button("Button");
        AquaFx.createButtonStyler().setSizeVariant(ControlSizeVariant.MINI).style(b7);
        grid.add(b7, 1, 4);
        ToggleButton tb7 = new ToggleButton("ToggleButton");
        AquaFx.createToggleButtonStyler().setSizeVariant(ControlSizeVariant.MINI).style(tb7);
        grid.add(tb7, 2, 4);
        CheckBox cb7 = new CheckBox("CheckBox");
        cb7.setIndeterminate(true);
        // cb7.setDisable(true);
        AquaFx.createCheckBoxStyler().setSizeVariant(ControlSizeVariant.MINI).style(cb7);
        grid.add(cb7, 3, 4);
        RadioButton rb7 = new RadioButton("RadioButton");
        AquaFx.createRadioButtonStyler().setSizeVariant(ControlSizeVariant.MINI).style(rb7);
        grid.add(rb7, 4, 4);
        TextField tf7 = new TextField("TextField");
        AquaFx.createTextFieldStyler().setSizeVariant(ControlSizeVariant.MINI).style(tf7);
        grid.add(tf7, 5, 4);
        ComboBox<String> ecombo7 = new ComboBox<String>();
        ecombo7.setItems(items);
        ecombo7.setEditable(true);
View Full Code Here

        RadioButton rb5 = new RadioButton("RadioButton");
        AquaFx.resizeControl(rb5, ControlSizeVariant.REGULAR);
        hbox.getChildren().add(rb5);

        TextField tf5 = new TextField("TextField");
        AquaFx.resizeControl(tf5, ControlSizeVariant.REGULAR);
        hbox.getChildren().add(tf5);

        ComboBox<String> ecombo5 = new ComboBox<String>();
        ecombo5.setItems(items);
View Full Code Here

        HBox separator = new HBox();
        separator.setPrefSize(15, 1);
        Button btnAll = new Button("Alle einblenden");
        HBox separator2 = new HBox();
        separator2.setPrefSize(279, 1);
        TextField search = new TextField();
        AquaFx.createTextFieldStyler().setType(TextFieldType.SEARCH).style(search);
        toolBar.getItems().addAll(tbBack, tbForward, separator, btnAll, separator2, search);

        mainBox.getChildren().add(toolBar);
        /*
 
View Full Code Here

        TitledPane gridTitlePane = new TitledPane();
        GridPane grid = new GridPane();
        grid.setVgap(4);
        grid.setPadding(new Insets(5, 5, 5, 5));
        grid.add(new Label("To: "), 0, 0);
        grid.add(new TextField(), 1, 0);
        grid.add(new Label("Cc: "), 0, 1);
        grid.add(new TextField(), 1, 1);
        grid.add(new Label("Subject: "), 0, 2);
        grid.add(new TextField(), 1, 2);       
        grid.add(new Label("Attachment: "), 0, 3);
        grid.add(label,1, 3);
        gridTitlePane.setText("Grid");
        gridTitlePane.setContent(grid);
       
View Full Code Here

    public AbstractNumberPropertyDelegate(FormatProvider formatProvider) {
        this.formatProvider = formatProvider;
    }

    public DisposableNode createNode(final PropertyElementController<T> controller) {
        final TextField textBox = new TextField();
        final InvalidationListener textBoxListener = createTextBoxListener(controller, textBox);
        textBox.textProperty().addListener(textBoxListener);
        if (controller.getValue() != null) {
            textBox.textProperty().setValue(formatProvider.getFormat(controller.getElement()).format(controller.getValue()));
        }
        final ChangeListener controllerListener = createControllerListener(textBox, controller);
        controller.addListener(controllerListener);
        textBox.promptTextProperty().bind(controller.getPromptText());

        return new DisposableNodeWrapper(textBox, new Callback<Node, Void>() {
            public Void call(Node node) {
                controller.removeListener(controllerListener);
                textBox.textProperty().removeListener(textBoxListener);
                return null;
            }
        });
    }
View Full Code Here

* Time: 23:28
*/
public class StringPropertyDelegate implements NodeFactory<PropertyElementController<String>> {

    public DisposableNode createNode(final PropertyElementController<String> controller) throws NodeCreationException {
        final TextField text = new TextField();
        String value = controller.getValue();
        if (value != null) {
            text.setText(value);
        }
        final ChangeListener textPropertyListener = new ChangeListener<String>() {
            public void changed(ObservableValue<? extends String> observableValue, String s, String s1) {
                controller.setValue(s1);
            }
        };
        text.textProperty().addListener(textPropertyListener);
        final ChangeListener<String> controllerListener = new ChangeListener<String>() {
            public void changed(ObservableValue<? extends String> observableValue, String s, String s1) {
                if (s1 != null) {
                    if (!text.getText().equals(s1)) {
                        text.setText(s1);
                    }
                } else {
                    text.setText("");
                }
            }
        };
        controller.addListener(controllerListener);

        // TODO Try/Catch will be removed once 2.0.2 is released (http://javafx-jira.kenai.com/browse/RT-17280)
        try {
            text.promptTextProperty().bind(controller.getPromptText());
        } catch (Exception e) {
        }

        return new DisposableNodeWrapper(text, new Callback<Node, Void>() {
            public Void call(Node node) {
                text.textProperty().removeListener(textPropertyListener);
                controller.removeListener(controllerListener);
                return null;
            }
        });
    }
View Full Code Here

TOP

Related Classes of javafx.scene.control.TextField

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.