JComboBox not showing arrow

java, jcombobox, layout, swing

Solution

It doesn't appear to be the issue you were suffering from, but I found this post due to the same resulting issue of the arrow disappearing.

In my case it was due to me mistakenly using `.removeAll()` on the `JComboBox` rather than `.removeAllItems()` when I was attempting to empty and then reuse the `JComboBox` after a refresh of the data I was using. Just thought I'd include it as an answer in case someone else comes across this thread for similar reasons.

Problem

I have been searching this site and google for a solution to my problem, and I can't find anything. I think it's supposed to just work; however, it doesn't. The arrow icon for my JComboBox doesn't show up, and I can't find anywhere to set its visibility to true. Here's my code: ``` public class Driver implements ActionListener { private JTextField userIDField; private JTextField[] documentIDField; private JComboBox repository, environment; private JButton close, clear, submit; private JFrame window; public Driver() { window = makeWindow(); makeContents(window); window.repaint(); } private JFrame makeWindow() { JFrame window = new JFrame(""); window.setSize(500,300); window.setLocation(50,50); window.getContentPane().setLayout(null); window.setResizable(false); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); window.setVisible(true); return window; } private void makeContents(JFrame w) { makeDropDowns(w); w.repaint(); } private void makeDropDowns(JFrame w) { String[] repositoryArray = {"Click to select", "NSA", "Finance", "Test"}; repository = new JComboBox(repositoryArray); repository.setSelectedIndex(0); repository.addActionListener(this); repository.setSize(150,20); repository.setLocation(175,165); repository.setEditable(false); w.add(repository); String[] environmentArray = {"Click to select", "Dev", "Test", "Qual"}; environment = new JComboBox(environmentArray); environment.setSelectedIndex(0); environment.addActionListener(this); environment.setSize(150,20); environment.setLocation(175,195); //environment.setEditable(false); w.add(environment,0); } public void actionPerformed(ActionEvent e) { String repositoryID = "null", environmentID = "null"; if (e.getSource() == repository) { repositoryID = (String)repository.getSelectedItem(); } if(e.getSource() == environment) { environmentID = (String)environment.getSelectedItem(); } } } ``` Here's a link to a picture of the problem: If anyone could help that would be awesome.

Original source