This week's book giveaway is in the Agile forum.
We're giving away four copies of Head First Agile and have Andrew Stellman & Jennifer Greene on-line!
See this thread for details.
Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Total Newbie question (adding items to TabbedPanes)  RSS feed

 
Anwar Dalati
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all

I'm pretty new to Java and Swing and I'm having quite a problem wrapping my head around the layout concept. Specifically (at the moment) I'm trying to create a JTabbedPane and add objects to one of the Tabs. It works fine when I just add one object (like a JTextField or even a JTable), but I'm stuck at adding more than one object. If I understand correctly, you cannot add more than one object directly to the tab, so I have tried to create a JPanel and adding items to it, but it's not really working. Any hint on how to do this would be much appreciated.

Thanks,

Anwar
 
Brian Cole
Author
Ranch Hand
Posts: 949
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anwar Dalati wrote:If I understand correctly, you cannot add more than one object directly to the tab, so I have tried to create a JPanel and adding items to it, but it's not really working.


That is the correct thing to do. How is it not working for you?
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> Any hint on how to do this would be much appreciated.

if you search for the phrase (include quote marks)
"new JTabbedPane"
you should find plenty of sample code to study.
 
Anwar Dalati
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!

Brian Cole wrote:That is the correct thing to do. How is it not working for you?


Dunno - I think I just needed some confirmation.

When I sat down today and gave the code a bit of tidying up, it suddenly worked. Thanks!

- Anwar
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!