JTabbedPane on JInternalFrame

Hi!

I have some problems because I have a JInternalFrame into which I need to add a JTabbedPane with 2 tabs, so I did following:

JInternalFrame dialog = new JInternalFrame("My Dialog");
dialog.setLayout(null);
dialog.setVisible(true);
...
...
JTabbedPane tabs = new JTabbedPane();
JPanel pnl1 = new JPanel();
pnl1.setLayout(null);
pnl1.setVisible(true);

JTextField txt = new JTextField();
txt.setBounds( 10, 35, 150, 20 );
pnl1.add(txt);

JPanel pnl2 = new JPanel();
pnl2.setLayout(null);
pnl2.setVisible(true);

tabs.addTab("Tab1", null, pnl1);
tabs.addTab("Tab2", null, pnl1);
tabs.setVisible(true);

dialog.getContentPane().add(tabs);

Why JTabbedPane is not shown or at least I can't see it, not even tabs created,

thanks
accarvajalAsked:
Who is Participating?
 
objectsCommented:
You need to set your tabbed panes size (as you use no layout manager), or use a layout manager eg. BorderLayout.
0
 
accarvajalAuthor Commented:
How, using setBounds?
0
 
objectsCommented:
yes that will do it
0
 
accarvajalAuthor Commented:
ok thanks, let me try and I will answer you about it
0
 
accarvajalAuthor Commented:
YES! objects, that did it, points are you, thanks
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.