title: Extending Swing JComboBox to remove unwanted border
body: <p>I spent the last few hours looking for a solution or at least a decent guide about this issue, but found nothing.</p>
  
  <p>I'm implementing a custom Swing Look and Feel for a small GUI of mine. Up until now I've been using the <code>UIManager.put("key", values);</code> method to good success, but I got stuck when it came to properly modify JComboBoxes.</p>
  
  <p>Using <a href="http://nadeausoftware.com/articles/2008/11/all_ui_defaults_names_common_java_look_and_feels_windows_mac_os_x_and_linux#TextComponent" rel="nofollow noreferrer">this list</a> I managed to get my jComboBoxes really close to what I want them to look like:</p>
  
  <p><img src="https://i.stack.imgur.com/qdvrX.png" alt="modified JComboBox"></p>
  
  <p>I have two issues with this, a major and a minor one:</p>
  
  <ul>
  <li><p>Major</p>
  
  <p><img src="https://i.stack.imgur.com/UtCq0.png" alt="enter image description here"></p>
  
  <p>I want the blue shown border gone.</p></li>
  <li><p>Minor</p>
  
  <p><img src="https://i.stack.imgur.com/a5SUR.png" alt="enter image description here"></p>
  
  <p>I'd really like the black shown border gone.</p></li>
  </ul>
  
  <p>Apparently no <code>key</code> in the <code>UIDefaults</code> has anything to do with either two borders: they seem somehow hardcoded in the Look and Feel I'm modifying (which should be Metal). I resorted to manually extending the ComboBoxRenderer and managed to come up with this:</p>
  
  <pre><code>package exec.laf.theme;
  
  import java.awt.*;
  import javax.swing.*;
  import javax.swing.plaf.basic.BasicComboBoxRenderer;
  
  
  public class ComboBoxRenderer extends BasicComboBoxRenderer {
      private Color background;
      private Color selectionBackground;
  
      public ComboBoxRenderer() {
          super();
  
          background = UIManager.getColor("ComboBox.background");
          selectionBackground = UIManager.getColor("ComboBox.selectionBackground");
      }
  
      public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
          setText((String) value);
  
          if (isSelected) setBackground(selectionBackground);
          else setBackground(background);
  
          return this;
      }
  }
  </code></pre>
  
  <p>Where I specify this Renderer every time I create a JComboBox like so:</p>
  
  <pre><code>aComboBox.setRenderer(new ComboBoxRenderer());
  </code></pre>
  
  <p>obtaining the same look as the non-extended JComboBox.</p>
  
  <p>The problem is that with this extension I can't find a way of touching those borders. Adding <code>setBorder(new EmptyBorder(0, 0, 0, 0));</code> accomplishes nothing, since it simply adds a border to the listed items.</p>
  
  <p>I checked the source code for <code>javax.swing.plaf.basic.BasicComboBoxRenderer</code> to see if any borders were applied there, but found nothing (the only border there is the one applied to the listed items, that I can override as shown above.</p>
  
  <p><em>What am I supposed to do? Am I extending the wrong class, or am I missing something else?</em></p>