This week's giveaway is in the Testing forum.
We're giving away four copies of TDD for a Shopping Website LiveProject and have Steven Solomon on-line!
See this thread for details.
Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • 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

Not Possible in Java ? : drop-up JComboBox

 
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Went through old post and saw the question raised more than once, and no solution !
Well I need my Combo Box list to drop Up instead of down !
Any Swing guru to help ?
 
Greenhorn
Posts: 28
Mac MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by raphael Bereh:
Well I need my Combo Box list to drop Up instead of down !



Here's a subclass of MetalComboBoxUI that pops up above the combo:



Install the UI in your combo with:


Now the problems:
1. If the popup will be off the screen, it is moved down. A better solution would be to allow it to drop down instead. See the implementation of BasicComboPopup.computePopupBounds for example code to do this.
2. This solution requires you to subclass a specific ComboBoxUI. I think it would have been better to delegate so as to make the solution applicable to any UI. The only way I see of getting acces to the popup in BasicComboBoxUI is subclassing or reflection. So I can't get the current popup to delegate to it.

Anyway, this solution is relatively simple and you can customize it as necessary.
 
raphael Bereh
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Looks greate,
Thanks Eric,
 
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yeah, it's really kool... And it's worthful to know such thing for me...
 
CLUCK LIKE A CHICKEN! Now look at this 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