I need to know the size of a JPanel when I add it to a JTabbedPane to compute other values. If I call the add(Component) method, when does the Component get its size?

For example,
Java Code:
JTabbedPane tabbedPane = new JTabbedPane();
JPanel panel = new JPanel();
panel.setBackGround(Color.RED); // pretty colors!

int newTabIndex = tabbedPane.indexOfComponent(panel);
Thank you in advance!