I think i don't have something set correctly, but when I try to use JTabbedPanes it never loads correctly. If I have 3 tabs, tab 3 loads up first and I have to select all the tabs at least once before it works correctly.
Here is an example of what i mean. I used this program written by Dave Marshall to see where i was messing up, but i get the same problem when i run it.m Any help would be great!
[ January 22, 2008: Message edited by: Andy Lukavich ]
Works fine for me - what do you mean when you say, "it never loads correctly". What are you expecting to see, versus what you actually see?
PS - [code] tags around any code that you post make it much easier to read.
Joined: Nov 23, 2007
When the program loads, I want Tab 1 to be displayed. However when I load the program, Tab 3 loads instead. I then proceed to select Tab 1 (but tab 3 is displayed), then Tab 2(but tab 3 is displayed), then Tab 3. Once I select all three of them, when i select tab 1 again it loads with the correct information.
Joined: Jan 31, 2006
Interesting... I copied and pasted the code exactly, and it works fine for me - shows tab 1, exactly as you expect, and the tabs work properly too.
My only suggestions are adding the tabs in the opposite order - perhaps Tab 3 is selected because it was the last one you added? Also, have you tried only adding one tab, then two, to see if that shows anything obvious that could be wrong? Finally - I assume you have read the API for JTabbedPane, and this page from the Java Tutorial?
[Edit: PS - thanks for adding the code tags ] [ January 23, 2008: Message edited by: David Payne ]