/** * Default constructor, The label and the Text field are left empty. */ public JLabeledChoice() { super(); choiceList = new JComboBox<>(); withButtons = false; init(); }
public JLabeledChoice(String pLabel, boolean editable) { super(); choiceList = new JComboBox<>(); mLabel.setText(pLabel); choiceList.setEditable(editable); withButtons = false; init(); }
/** * Constructs a combo-box with the label displaying the passed text. * * @param pLabel - the text to display in the label. * @param items - the items to display in the Combo box * @param editable - the box is made editable * @param withButtons - if true, then Add and Delete buttons are created. * */ public JLabeledChoice(String pLabel, String[] items, boolean editable, boolean withButtons) { super(); mLabel.setText(pLabel); choiceList = new JComboBox<>(items); choiceList.setEditable(editable); this.withButtons = withButtons; init(); }