如果我有一组对象:
public class Party {
LinkedList<Guy> partyList = new LinkedList<Guy>();
public void addGuy(Guy c) {
partyList.add(c);
}
}
还有一个 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);
}
}
如何将内容添加到 tabbedPane“派对屏幕”,以便它为我的 LinkedList 中的每个项目显示一个 JLabel“名称”和一个垂直的 JSeparator?