Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

getRowForLocation(...) in JComboBox?  RSS feed

 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey there!
In JTree or JList etc. I have a method like "getRowForLocation(int x, int y)" or "rowAtLocation(Point p)".
Do you know how to find out the row-for-location in a JComboBox?
Thanks!
Praiser
 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Iam not sure I understood your question.
Are you trying to find out index of the element or a
element at a index in JComboBox?
 
Meyer Florian
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The methods e.getX() and e.getY() give me the current mouse position.
The method getRowForLocation(...) or rowAtLocation(...) give me the index of the row that the mouse cursor is over (not the selected row).
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!