Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getRowForLocation(...) in JComboBox?

 
Meyer Florian
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
 
Krishna Mohan
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