< prev index next >

modules/javafx.controls/src/main/java/javafx/scene/control/ChoiceBox.java

Print this page




  43 import javafx.scene.AccessibleRole;
  44 import javafx.util.StringConverter;
  45 import javafx.css.PseudoClass;
  46 
  47 import javafx.scene.control.skin.ChoiceBoxSkin;
  48 
  49 import javafx.beans.DefaultProperty;
  50 
  51 /**
  52  * The ChoiceBox is used for presenting the user with a relatively small set of
  53  * predefined choices from which they may choose. The ChoiceBox, when "showing",
  54  * will display to the user these choices and allow them to pick exactly one
  55  * choice. When not showing, the current choice is displayed.
  56  * <p>
  57  * By default, the ChoiceBox has no item selected unless otherwise specified.
  58  * Although the ChoiceBox will only allow a user to select from the predefined
  59  * list, it is possible for the developer to specify the selected item to be
  60  * something other than what is available in the predefined list. This is
  61  * required for several important use cases.
  62  * <p>
  63  * It means configuration of the ChoiceBox is order independent. You
  64  * may either specify the items and then the selected item, or you may
  65  * specify the selected item and then the items. Either way will function
  66  * correctly.
  67  * <p>
  68  * ChoiceBox item selection is handled by
  69  * {@link javafx.scene.control.SelectionModel SelectionModel}
  70  * As with ListView and ComboBox, it is possible to modify the
  71  * {@link javafx.scene.control.SelectionModel SelectionModel} that is used,
  72  * although this is likely to be rarely changed. ChoiceBox supports only a
  73  * single selection model, hence the default used is a {@link SingleSelectionModel}.
  74  *
  75  * <p>
  76  * Example:
  77  * <pre> ChoiceBox cb = new ChoiceBox();
  78  * cb.getItems().addAll("item1", "item2", "item3");</pre>
  79  *
  80  * <img src="doc-files/ChoiceBox.png" alt="Image of the ChoiceBox control">
  81  *
  82  * @since JavaFX 2.0
  83  */




  43 import javafx.scene.AccessibleRole;
  44 import javafx.util.StringConverter;
  45 import javafx.css.PseudoClass;
  46 
  47 import javafx.scene.control.skin.ChoiceBoxSkin;
  48 
  49 import javafx.beans.DefaultProperty;
  50 
  51 /**
  52  * The ChoiceBox is used for presenting the user with a relatively small set of
  53  * predefined choices from which they may choose. The ChoiceBox, when "showing",
  54  * will display to the user these choices and allow them to pick exactly one
  55  * choice. When not showing, the current choice is displayed.
  56  * <p>
  57  * By default, the ChoiceBox has no item selected unless otherwise specified.
  58  * Although the ChoiceBox will only allow a user to select from the predefined
  59  * list, it is possible for the developer to specify the selected item to be
  60  * something other than what is available in the predefined list. This is
  61  * required for several important use cases.
  62  * <p>
  63  * This means that configuration of the ChoiceBox is order independent. You
  64  * may either specify the items and then the selected item, or you may
  65  * specify the selected item and then the items. Either way will function
  66  * correctly.
  67  * <p>
  68  * ChoiceBox item selection is handled by
  69  * {@link javafx.scene.control.SelectionModel SelectionModel}
  70  * As with ListView and ComboBox, it is possible to modify the
  71  * {@link javafx.scene.control.SelectionModel SelectionModel} that is used,
  72  * although this is likely to be rarely changed. ChoiceBox supports only a
  73  * single selection model, hence the default used is a {@link SingleSelectionModel}.
  74  *
  75  * <p>
  76  * Example:
  77  * <pre> ChoiceBox cb = new ChoiceBox();
  78  * cb.getItems().addAll("item1", "item2", "item3");</pre>
  79  *
  80  * <img src="doc-files/ChoiceBox.png" alt="Image of the ChoiceBox control">
  81  *
  82  * @since JavaFX 2.0
  83  */


< prev index next >