JComboBox

I am planning to implement the following:
I will have a JComboBox with a list of items. Depending on the item selected, I want to display a JPanel inside a JPanel.

If possible, please provide some sample code. Thanks!
dshrenikAsked:
Who is Participating?
 
for_yanCommented:
I guess, then you can use CardLayout


another option you can make cusrtom JPnale and redarw it in the paint() method
0
 
for_yanCommented:

What is JPanel insde JPanel?

I'd rather use JTabbedPane for that
in the acitonPerformed  method slected
the tab which you want depebnding in selected item
0
 
for_yanCommented:
But even better select tab directly and do not deopned on JComboBox
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

 
dshrenikAuthor Commented:
I can. But I have recieved specific instruction not to use a JTabbedPane.

0
 
for_yanCommented:
Waht is the difference between your JPanel views?
0
 
for_yanCommented:
You can of course add and remove components on JPanel - but that usually causes some pain - I'm alwaays trying to avoid it
and create ans show all components in constructor, then change their properties in the events
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.