• Post Reply Bookmark Topic Watch Topic
  • New Topic

When does a JTabbedPane component get its size?

 
Josh Rees-Jones
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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,



Thank you in advance!
 
Piet Souris
Rancher
Posts: 1635
36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Josh,

for me, the actual sizes and locations of components have always been kind of a black box.
It is up to the Layout managers to determine this. I only know that when
you use


that all sizes are known.

After that, you can query the size of every panel. Then you can get on
adding components, in which case you may call the revalidate methods.

Maybe someone with a lot more expertise can help you better. If you want
to keep everything in your own hands, then maybe you could use no layout
manager at all, at least for the panel in question.

Greetings,
Piet
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!