+ if (comboBox == null)
+ {
+ return textField.getText().trim();
+ }
+ Object item = comboBox.getEditor().getItem();
+ return item == null ? "" : item.toString().trim();
+ }
+
+ public JComponent getComponent()
+ {
+ return (comboBox == null ? textField : comboBox);
+ }
+
+ public void addActionListener(ActionListener actionListener)
+ {
+ if (comboBox == null)
+ {
+ textField.addActionListener(actionListener);
+ }
+ else
+ {
+ comboBox.addActionListener(actionListener);
+ }
+ }
+
+ public void addDocumentListener(DocumentListener listener)
+ {
+ textComponent.getDocument().addDocumentListener(listener);
+ }
+
+ public void addFocusListener(FocusListener focusListener)
+ {
+ textComponent.addFocusListener(focusListener);
+ }
+
+ public void addKeyListener(KeyListener kl)
+ {
+ textComponent.addKeyListener(kl);
+ }
+
+ public void addCaretListener(CaretListener caretListener)
+ {
+ textComponent.addCaretListener(caretListener);
+ }
+
+ public void setEditable(boolean b)
+ {
+ if (comboBox != null)
+ {
+ comboBox.setEditable(b);
+ }
+ }
+
+ public void setPrototypeDisplayValue(String string)
+ {
+ prototypeDisplayValue = string;
+ if (comboBox != null)
+ {
+ comboBox.setPrototypeDisplayValue(string);
+ }
+ }
+
+ public void setSelectedItem(String userInput)
+ {
+ if (comboBox != null)
+ {
+ comboBox.setSelectedItem(userInput);
+ }
+ }
+
+ public boolean isPopupVisible()
+ {
+ return (comboBox != null && comboBox.isPopupVisible());
+ }
+
+ public void addItem(String item)
+ {
+ if (comboBox != null)
+ {
+ comboBox.addItem(item);
+ }