In my main I loop over each League
as below:
for (League l : t.getLeagues()) {
LeaguePanel leaguePanel = new LeaguePanel(l);
roundTabs.addTab(l.getName(), leaguePanel);
}
This should then create a JPanel
and add it to the tab.
public class LeaguePanel extends JPanel {
private League league;
private JComboBox roundComboBox;
LeaguePanel(League l) {
league = l;
JPanel leagePanel = new JPanel();
leagePanel.add(new JLabel("Tournament Information"));
}
However, the tab gets created but nothing appears within it
Any ideas why?
You want to add things to your LeaguePanel
object, not to a new JPanel
:
JPanel leagePanel = new JPanel();
leagePanel.add(new JLabel("Tournament Information"));
becomes
this.add(new JLabel("Tournament Information"));
Because it's your LeaguePanel
that you add to the tabbed pane .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.