T
TL
Hi,
How can I get the dimensions of a JPanel before it's first painted the
first time?
I.e, I have a Form (JDialog or JFrame) which uses a BorderLayout, and
has 2 JPanels on it. The first JPanel has its height computed at
runtime (eg 90 pixels), and the other takes up the remainder of the
Form. I call getBounds() on the second JPanel (the last thing in the
constructor) and it returns me width,height=0,0. However if I call
getBounds() in the Forms paint method, it gives me 1024,631 (which is
what I want to know in the constructor).
So basically it seems that the dimensions of the second JPanel are not
set until the Form is rendered and painted for the first time.
I want to use getBounds because it takes into account not only my
first JPanel, but also the Forms title bar, windows taskbar (if
visible), etc. (which are also dependent on the active look & feel),
so saves me lots of work.
How do I do this...?
TIA
How can I get the dimensions of a JPanel before it's first painted the
first time?
I.e, I have a Form (JDialog or JFrame) which uses a BorderLayout, and
has 2 JPanels on it. The first JPanel has its height computed at
runtime (eg 90 pixels), and the other takes up the remainder of the
Form. I call getBounds() on the second JPanel (the last thing in the
constructor) and it returns me width,height=0,0. However if I call
getBounds() in the Forms paint method, it gives me 1024,631 (which is
what I want to know in the constructor).
So basically it seems that the dimensions of the second JPanel are not
set until the Form is rendered and painted for the first time.
I want to use getBounds because it takes into account not only my
first JPanel, but also the Forms title bar, windows taskbar (if
visible), etc. (which are also dependent on the active look & feel),
so saves me lots of work.
How do I do this...?
TIA