While creating a JFrame and adding some components I noticed that if I create a instance of a JComboBox between setting the JFrame visible and adding a button, the button disappears.
I start of by creating a JFrame:
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(200, 200);
Then I add set the frame visible and add a JButton:
frame.setVisible(true);
frame.add(new JButton("text"));
It works as expected and displays one big button:

BUT, if I create one instance of a JComboBox in between those lines:
frame.setVisible(true);
new JComboBox();
frame.add(new JButton("text"));
And now the buttons is gone..

I expect no change at all, since I’m only creating a instance and not assigning it to anything.
Why does the button disappears?
Also, if move new JComboBox(); above frame.setVisible(true);, the button goes visible again.
Once you display the UI, it should not be modified from any thread except of the EDT. In the first case you had some “luck”, and it worked. In the second case probably the time of creation of the JComboBox was long enough to prevent you from modifying the UI from a thread that is not the EDT.
What you should do, is invoking that code on the EDT: