Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JTabbedPane.getTabComponentAt(int) is not working

 
guenter porzer
Greenhorn
Posts: 2
Java Linux Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hallo,

I'm trying to iterate over all tabs in a JTabbedPane but somehow getTabComponentAt always resturns null.
I suppose I made a mistake but I can't find it.

here an example :



The output of this example is (see below) since all calls to getTabComponentAt return null ?


I have expexted after adding Components via addTab I could retrieve the Component via getTabComponentAt.

Any ideas ?

best regards
 
Rob Spoor
Sheriff
Pie
Posts: 20511
54
Chrome Eclipse IDE Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
getTabComponentAt returns the component that is used for rendering the tab itself. For the content of the tab, use getComponentAt instead.
 
guenter porzer
Greenhorn
Posts: 2
Java Linux Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks, works like a charm !

best regards
 
Rob Spoor
Sheriff
Pie
Posts: 20511
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic