I have the following code:
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);
the thing is this:
container.getTabComponentAt(0)
returns null. Another weird thing:
container.getSelectedIndex()
returns 0. The logical thing, which I think should happen, is to have a link to the created window. Why am I getting null? What am I doing wrong?
source
share