Search in sources :

Example 1 with BasicComboBoxEditor

use of javax.swing.plaf.basic.BasicComboBoxEditor in project intellij-community by JetBrains.

the class TargetOptionsComponent method createTargetOptionsCombo.

private static ComboBox createTargetOptionsCombo() {
    final ComboBox combo = new ComboBox(new TargetLevelComboboxModel());
    //combo.setRenderer(new DefaultListCellRenderer() {
    //  @Override
    //  public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
    //    try {
    //      return super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
    //    }
    //    finally {
    //      //if ("".equals(value)) {
    //      //  setText(COMPILER_DEFAULT);
    //      //}
    //    }
    //  }
    //});
    combo.setEditable(true);
    combo.setEditor(new BasicComboBoxEditor() {

        @Override
        protected JTextField createEditorComponent() {
            HintTextField editor = new HintTextField(COMPILER_DEFAULT, 12);
            editor.setBorder(null);
            return editor;
        }
    });
    return combo;
}
Also used : BasicComboBoxEditor(javax.swing.plaf.basic.BasicComboBoxEditor) ComboBox(com.intellij.openapi.ui.ComboBox)

Aggregations

ComboBox (com.intellij.openapi.ui.ComboBox)1 BasicComboBoxEditor (javax.swing.plaf.basic.BasicComboBoxEditor)1