Results 1 to 4 of 4
  1. #1
    viswanadh7 is offline Member
    Join Date
    Mar 2009
    Posts
    10
    Rep Power
    0

    Default Question on JTabbedPane.setComponentAt(index,component)

    Hi All,

    I have a JTabbedPane and i have 4 panels.So when i tried to use
    JTabbedPane.setComponentAt(int index,JComponent component) i mam able to place only one panel onto it,but i want to put all the 4 panels at the same index in setComponentAt.Any way to do it???


    regards,
    Viswanadh

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    How do you want to place the 4 panels? My guess is that you'll likely want to create a JPanel to act as a container panel, set its layout with either a single layout manager that will work for you, or perhaps you'll need several nested container JPanels each with a different layout, and then add your 4 JPanels into the containers to be able to see them all. Then add the main container panel onto the JTabbedPane, but this could be wrong as I'm not 100% sure if this solves your problem.

  3. #3
    viswanadh7 is offline Member
    Join Date
    Mar 2009
    Posts
    10
    Rep Power
    0

    Smile

    Hi,

    Thanks for the reply.But can i get an example or a small code snippet to clearly understand the quote what you have said.

    Thanks in advance.

    regards,
    Viswanadh

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    You must be just starting out in Swing, and so I'll give you more than just a small example; here's a complete tutorial on Swing: Lesson: Using Swing Components (The Java™ Tutorials > Creating a GUI with JFC/Swing)

    For this, I suggest reading the section on layout managers first. You can find this here: Lesson: Laying Out Components Within a Container (The Java™ Tutorials > Creating a GUI with JFC/Swing)

    Best of luck.

Similar Threads

  1. Traversing a JTabbedPane
    By Inks in forum AWT / Swing
    Replies: 12
    Last Post: 03-11-2009, 05:15 AM
  2. How to use JTabbedPane
    By Java Tip in forum javax.swing
    Replies: 0
    Last Post: 06-27-2008, 07:50 PM
  3. Adding Tabs to JTabbedPane
    By blackstone in forum AWT / Swing
    Replies: 2
    Last Post: 11-14-2007, 03:15 PM
  4. Help with JTabbedPane
    By lenny in forum SWT / JFace
    Replies: 1
    Last Post: 08-07-2007, 06:18 AM
  5. Same component on all JTabbedPane
    By java_novice in forum AWT / Swing
    Replies: 4
    Last Post: 08-06-2007, 09:09 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •