• 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

JScrollPane problem

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello
I have a funny situation.
I have a panel onto which I am putting a JScrollPanel. The JScrollPanel occupies about 70% of the total parent panel and is positioned in the middle of the parent panel.
into the scroll panel i add some light weight components. so basically i have a scrollable control ui.
now when the light weight components are created i find an outline of them in a region outside the scroll panel. in fact the hidden part of the scroll panel shows outline of the components which it contains.
can u tell me whats the reason for this behaviour.
awaiting a quick reply
sat
 
Ranch Hand
Posts: 319
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Posting your code can be helpful for us to see whatz going wrong.
Sudharsan
 
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
how are you adding the components to the JScrollPane?
What you should do: Add all the components to a JPanel and add this JPanel to the JScrollPane. Be sure not to mix up swing and awt - this is often a reason for "funny behaviour".
Set the preferred size of the viewport:
scrollPane.getViewport().setPreferredSize(Dimension);
What LayoutManagement are you using in the parent component of the scrollpane? I would suggest to add the scrollpane either to a BorderLayout with the CENTER constraint, or to use GridBagLayout and to specify weightx and weighty both as 1.
chantal
 
Satheesh Thekku Veethil
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your response.
I was adding it wrongly. Its working now and with "no funny behavior"
 
I'm still in control here. LOOK at this tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic