• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Total Newbie question (adding items to TabbedPanes)

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Author
Posts: 986
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic