私は次のコードを持っています:
JTabbedPane container;
...
AWindow page = WinUtils.buildWindow();
boolean existing = checkIfExists(page); // in this code, this will always be false
if(!existing)
{
String tabName = page.getLoadedFileLocation().getName();
container.addTab(page.getLoadedFileLocation().getName(), page);
}
Component comp = container.getTabComponentAt(0);
int sel = container.getSelectedIndex();
container.setSelectedComponent(page);
事は:
container.getTabComponentAt(0)
を返しますnull
。他の奇妙なことは:
container.getSelectedIndex()
を返します0
。私が起こるべきだと思う論理的なことは、作成されたウィンドウへの参照を持つことです。なぜ私は受け取っているのnull
ですか?私は何が間違っているのですか?