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