File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes getRowForLocation(...) in JComboBox? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "getRowForLocation(...) in JComboBox?" Watch "getRowForLocation(...) in JComboBox?" New topic

getRowForLocation(...) in JComboBox?

Meyer Florian
Ranch Hand

Joined: Oct 20, 2003
Posts: 62
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?
Krishna Mohan
Ranch Hand

Joined: May 30, 2003
Posts: 44
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?

Programming is Fun.
Meyer Florian
Ranch Hand

Joined: Oct 20, 2003
Posts: 62
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).
I agree. Here's the link:
subject: getRowForLocation(...) in JComboBox?
It's not a secret anymore!