Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8098613
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T22:07:33+00:00 2026-06-05T22:07:33+00:00

If I have a collection of objects: public class Party { LinkedList<Guy> partyList =

  • 0

If I have a collection of objects:

public class Party {
    LinkedList<Guy> partyList = new LinkedList<Guy>();

    public void addGuy(Guy c) {
        partyList.add(c);
    }
}

And a tabbedPane:

public class CharWindow
{
private JFrame  frame;

/**
 * Launch the application.
 */
public static void main(String[] args)
{
    EventQueue.invokeLater(new Runnable()
    {
        @Override
        public void run()
        {
            try
            {
                CharWindow window = new CharWindow();
                window.frame.setVisible(true);
            }
            catch (Exception e)
            {
                e.printStackTrace();
            }
        }
    });
}

/**
 * Create the application.
 */
public CharWindow()
{
    initialize();
}

/**
 * Initialize the contents of the frame.
 */
private void initialize()
{
    frame = new JFrame();
    frame.setBounds(100, 100, 727, 549);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JTabbedPane tabbedPane = new JTabbedPane(SwingConstants.TOP);
    frame.getContentPane().add(tabbedPane, BorderLayout.CENTER);

    JTabbedPane PartyScreen = new JTabbedPane(SwingConstants.TOP);
    tabbedPane.addTab("Party Screen", null, PartyScreen, null);

    JTabbedPane tabbedPane_2 = new JTabbedPane(SwingConstants.TOP);
    tabbedPane.addTab("New tab", null, tabbedPane_2, null);

    JTabbedPane tabbedPane_3 = new JTabbedPane(SwingConstants.TOP);
    tabbedPane.addTab("New tab", null, tabbedPane_3, null);
}
}

How would I add content to the tabbedPane “Party Screen” such that it displays a JLabel “Name” and a vertical JSeparator for each item in my LinkedList?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T22:07:34+00:00Added an answer on June 5, 2026 at 10:07 pm

    First, JTabbedPane is the widget that creates a new tab for each element panel. It is not the child of a tabbed interface. (Eg. JTabbedPane should hold a JPanel called partyScreen.)

    JTabbedPane tabbedPanel = new JTabbedPane(); // holds all tabs
    
    // this is how you add a tab:
    JPanel somePanel = new JPanel();
    tabbedPanel.addtab("Some Tab", somePanel);
    
    // this is how you'd add your party screen
    JPanel partyScreen = new JPanel();
    tabbedPanel.addTab("Party Screen", partyScreen);
    

    Remember, Java naming convention has a variable start with a lower case letter — so partyScreen is preferred to PartyScreen.

    Then iterate through each Guy object in Party and add the appropriate components. I have no idea why you’re using a LinkedList instead of a List, but I’ll assume you have a good reason not included in the code above.

    // myParty is an instance of Party; I assume you have some sort of accessor to 
    // the partyList
    LinkedList<Guy> partyList = myParty.getPartyList();
    ListIterator<Guy> it = partyList.listIterator();
    while( it.hasNext() ) {
        Guy g = it.next();
        partyScreen.add(new JLabel( g.getName() ));
        partyScreen.add(new JSeparator() );
    }
    

    Depending on how you want it to be arranged in the partyScreen panel, you’ll probably want to look into a Layout Manager.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say we have a collection of Person objects class Person { public string
I have an object that has a child collection: class Person { public string
I have a ComboBox bound to a collection of objects defined as this. public
Hello guys i have collection : public class ActionData { private int iD; public
I have two Collection objects, I want to associate each object of these two
In my application, I have three collection objects which store data. The data which
I have a collection of objects which describe an image-name, its size and it's
I have a collection of objects of the same type, let's call it DataItem
C#: I have a collection of objects . T has 2 properties. Property A
I'm looking to have a collection of objects that implement a certain interface, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.