• 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

Regarding panel Revalidate Method

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The design for my application goes like this.
I have a scroll pane, and i have added a panel say mainPanel to it.
Now i am adding two panels say panel1 and panel2 to it using grid bag layout.
But the panel2 can increase its size dynamically, so i added a scroll pane and to it the panel2.

Now whenever i want to increase the size i am calling the panel2.setpreferredSize();
and then panel2.revalidate.

The problem i am facing here is,
Some times (very few times )it works perfectly with a scroll bar appearing only for panel2.
but most of the times te entire panel is getting a scroll bar. which is not required.

So can anyone help me out. Is this the problem with revalidate. or is there any alternatice
 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I beleive its better you remove the scroll pane that you have added as the root container. I mean remove the scrollpane before adding mainPanel .

cheers
Kiran
 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You will have to set the preferred width for the inner JScrollPane also. Otherwise, the GridBagLayout on the mainPanel allows the innner JScrollPane to increase as much as panel2's preferredSize. Try this

 
Aabha Varma
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes its working ..
thanks a lot.
 
The moustache of a titan! The ad of a flea:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic