Rob Prime wrote:You only add the combo box if you have at least one result. My guess is you have 0 results.
Hi! Thanks for your reply. I have single stepped through the code. It went inside the if statement and the do while loop.
I even created a dummy model.addElement(new Item(1, "2010")) and shifted the creation of the JCombobox, getContentPane, add and setContentPane outside the 'if' statement but I sill do not see it in the JFrame.
Alan Blass wrote:Hi! Thanks for your replies. I cannot access the SSCCE website.
Yep, it's down. This one might work though: Alternative SSCCE link It is quite a useful construct since if you create a decent SSCCE, it would let us easily see your problem first hand, test your code, alter your code, and find a solution for your problem. My experience has been that posting a decent SSCCE is often your best way of getting a decent fast solution here.
I saw an example using FlowLayout and I have tried this:
How should I make the combobox appear without using FlowLayout? Please help, thanks.
Use the other layouts.
There are several to choose from, and often we use multiple different layouts by nesting JPanels, each using its own layout.
The reason you can't solve this is because you still don't know how to simplify the problem and understand the basics of how Swing works.
Your question as about adding a combo box to a frame. Thats it.
I do not use and IDE so I do not have acess to your org.desktop.application package.
I do not have access to your ResourceMap.
Please explain how those classes/packages are relevant to your original question?
As a hint to your solution. Don't use the IDE to build the GUI. By default the IDE uses a GroupLayout to add components to the GUI. Therefore it is extremely difficult to add another component later, because you need to specify all the constraints when you attempt to add the component.
Instead design the GUI yourself using the appropriate combination of layout managers. Then you can generally just add the component to the panel and revalidate() the panel. I can't give any more specific advice than that.
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop