When does a JTabbedPane component get its size?
问题 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, JTabbedPane tabbedPane = new JTabbedPane(); JPanel panel = new JPanel(); panel.setBackGround(Color.RED); // pretty colors! tabbedPane.add(panel); int newTabIndex = tabbedPane.indexOfComponent(panel); tabbedPane.setSelectedIndex(newTabIndex); Thank you in advance! Edit @mKorbel suggested setting the visibility of the