JPanel size

  • Thread starter Sudarshan Raghavan
  • Start date
S

Sudarshan Raghavan

I need to get the size of a JPanel so that I can dynamically set the
size of the scrollpane that'll contain it. How do I get the dimensions
of a JPanel before it is actually displayed ??

-snr
 
I

Ike

The JScrollPane will size to the .setPrefferedSize of the component that the
JScrollPane resides in - the JPanel residing in your JScrollPane will thus
size to the JScrollPane automatically. What you need to set, size-wise, is
the PrefferedSize of the Component (which may be getContentPane()) that
holds the JScrollPane. //Ike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top