title: How can I make some items in a JComboBox unselectable?
body: <p>How can I make some of my JComboBox Items unselectable? I tried this:</p>
  
  <pre><code>@Override
  public Component getListCellRendererComponent(JList list, Object value,
      int index. boolean isSelected, boolean cellHasFocus) {
  
      Component comp = super.getListCellRendererComponent(list, value, index,
          isSelected, cellHasFocus);
  
      if (not selectable conditions) {
          comp.setEnabled(false);
          comp.setFocusable(false);
      } else {
          comp.setEnabled(true);
          comp.setFocusable(true);
      }
  
      return comp;
  }
  </code></pre>
  
  <p>The items become gray, but are still selectable by the user.</p>