convenience factory method for JavaFX ComboBoxes containing Strings - Java JavaFX

Java examples for JavaFX:ComboBox

Description

convenience factory method for JavaFX ComboBoxes containing Strings

Demo Code


import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.event.EventHandler;
import javafx.scene.control.Cell;
import javafx.scene.control.ComboBox;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
import javafx.util.StringConverter;
import javafx.util.converter.DefaultStringConverter;

public class Main{
    public static void main(String[] argv) throws Exception{
        System.out.println(create());
    }//from ww  w  .  j a va2s .  co m
    /** convenience factory method for ComboBoxes containing Strings **/
    public static <C extends Cell<String>> ComboBoxCellHelper<C, String> create() {
        final WidgetActivationListener<C, ComboBox<String>, String> adapter = new WidgetActivationAdapter<>();
        return create(adapter);
    }
    /** convenience factory method for ComboBoxes containing Strings **/
    public static <C extends Cell<String>> ComboBoxCellHelper<C, String> create(
            WidgetActivationListener<C, ComboBox<String>, String> listener) {
        return new ComboBoxCellHelper<>(new DefaultStringConverter(),
                listener);
    }
}

Related Tutorials