• 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Specific size requirements with scrollbar

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a component that needs to maintain a certain height, even when the horizontal scrollbar of the JScrollPane that wraps it appears.

So, it needs to be 32 pixels high, PLUS whatever height of the horizontal scrollbar. Can I take this into account in my getPreferredSize() return? IO tried (32 + getInsets().height), but the insets come back as 0 and are unaffected by the scrollbar.

Any ideas?
 
Marshal
Posts: 27214
87
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sounds like a Swing question to me, but at any rate my idea would be to always show the horizontal scrollbar. Not only would this solve your problem, it would also prevent your component from suddenly resizing itself and possibly causing the entire layout to resize itself. (I am not a fan of "twitchy" Swing designs where component sizes change all the time.)
 
John Blanco
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yeah, it is Swing...sorry, didn't notice the specific forum. :-) Just writing back to say that I found my answer. It's not coding, it's framework. I used the Scrollable interface to specify the required dimensions in my custom component.

I wasn't familiar with this interface, and I'm a little dissapointed that "Java Swing" doesn't cover it. But, they did mention it...and the rest was a piece of cake.
 
I'm not dead! I feel happy! I'd like to go for a walk! I'll even read a tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic