Package jltk.gui

Class ComboBox


  • public class ComboBox
    extends Control
    A Combobox holds different entries. One entry can be select. events: itemSelected
    Version:
    10.4.2022
    Author:
    ms
    • Field Detail

      • fxComboBox

        protected javafx.scene.control.ComboBox fxComboBox
    • Constructor Detail

      • ComboBox

        public ComboBox​(double pLeft,
                        double pTop,
                        double pWidth,
                        double pHeight)
        Create the ComboBox. Put it on the window and set the actionlistener.
        Parameters:
        pLeft - The horizontal coordinate
        pTop - The vertical coordinate
        pWidth - The width of the combo box
        pHeight - The height of the combo box
      • ComboBox

        public ComboBox​(Window pWindow,
                        double pLeft,
                        double pTop,
                        double pWidth,
                        double pHeight)
        Create the combo box
        Parameters:
        pLeft - The horizontal coordinate
        pTop - The vertical coordinate
        pWidth - The width of the combo box
        pHeight - The height of the combo box
        pWindow - The window, the combo box should be placed
        pText - The label of the combo box
    • Method Detail

      • append

        public void append​(String pText)
        Append pText to the Combobox
        Parameters:
        pText - The object to be append.
      • append

        public void append​(Object pObject)
        Append pObject to the Combobox
        Parameters:
        pObject - The object to be append.
      • add

        public void add​(int pIndex,
                        String pText)
        Insert pText at the specified position in this combobox. Shifts the item currently at that position (if any) and any subsequent item to the bottom (adds one to their indices, first item has index 0).
        Parameters:
        pText - The text to be add.
      • add

        public void add​(int pIndex,
                        Object pObject)
        Insert pObject at the specified position in this combobox. Shifts the item currently at that position (if any) and any subsequent item to the bottom (adds one to their indices, first item has index 0).
        Parameters:
        pObject - The object to add.
      • set

        public void set​(int pIndex,
                        String pText)
        Replace the item at the specified position in this combobox with pText (first item has index 0).
        Parameters:
        pText - The text to be set.
      • set

        public void set​(int pIndex,
                        Object pObject)
        Replace the item at the specified position in this combobox with pObject (first item has index 0).
        Parameters:
        pText - The object to be set.
      • remove

        public void remove​(int pIndex)
        Remove the item at the specified index (first item has index 0).
        Parameters:
        pIndex - the Index of the item, should be removed.
      • clear

        public void clear()
        Remove all entries from the combobox
      • select

        public void select​(int pIndex)
        Selects (highlights) the item specified by pIndex
        Parameters:
        pIndex -
      • deselect

        public void deselect​(int pIndex)
        Deselects the item specified by pIndex
        Parameters:
        pIndex -
      • clearSelection

        public void clearSelection()
        Clears the selection of all selected indices.
      • isSelected

        public boolean isSelected​(int pIndex)
        Returns true, if the given index is currently selected, otherwise false.
        Parameters:
        pIndex - The index to check as to whether it is currently selected or not
        Returns:
        True if the given index is selected, false otherwise
      • getSelectedIndex

        public int getSelectedIndex()
        Returns the index of the selected item (first item has index 0).
        Returns:
        The index of the selected item
      • getSelectedItem

        public Object getSelectedItem()
        Returns the selected item as object.
        Returns:
        The selected item
      • getSize

        public int getSize()
        Returns the number of items in this combobox.
        Returns:
        The number of items.
      • getSelectedItemAsText

        public String getSelectedItemAsText()
        Returns the selected item as string.
        Returns:
        The string representation of the item.
      • setOnItemSelected

        public void setOnItemSelected​(String pMethodName)
        Sets the name of the method, which should be invoke, if an item of the combobox is selected.