• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JTabbedPane problems - not loading correctly

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Andy Lukavich
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Mark Newton
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic