Mouse motion listener for JTable with JScrollpane

Hi All,

I have added mouse motion listener for JTable which is added in JScrollPane. But if i move the mouse, over the vertical/horizontal scroll bars, mouse motion listener doesn't works.

So it it required to add mousemotionlistener for JTable, JScrollPane, JScrollBar and etc.

Thanks in advance.

Regards,

Tamizhan

[355 byte] By [tamizhan_javaa] at [2007-11-26 22:44:56]
# 1
Is this a statement or do you have a question here?The scroll bars are not part of the table so you don't get the events on the scroll bars in the listener of the table.This is how it should work.
Rodney_McKaya at 2007-7-10 12:02:01 > top of Java-index,Desktop,Core GUI APIs...
# 2

Yes, The scroll bars are not part of the table.

But even i added the mouse motion listeneners to JScrollPane, it doesn't work for horizontal and vertical scroll bars. So i have added mouse listeners for horizontal and vertical scroll bars. But still mouse motion listener is not working for scroll bar buttons.

So is it required to all the components in JScrollPane? is there any other way to add mouse listener for all the child components in ScrollPane?

tamizhan_javaa at 2007-7-10 12:02:01 > top of Java-index,Desktop,Core GUI APIs...
# 3
Why do you want to add a mouse listener to the scroll bars?What are you trying to achieve?
Rodney_McKaya at 2007-7-10 12:02:01 > top of Java-index,Desktop,Core GUI APIs...
# 4

I am having one popup window which shows address information. This window contains JTable with JScrollPane and JButton components to show the details. While showing this information window, if the mouse cursor is over popupwindow, it should show the window otherwise it should hide the window after 30 seconds.

To achieve this, i have added mouse listener to JPanel, JTable, JButton and JScrollPane. so if the cursor is in any one of the component, it will not hide the window.

but for this i need to add listener to all the components in the JPanel. For JScrollPane i have to add horizontal, vertical and all the top corner buttons of Scroll bar.

Is this the only way to do this?

yessudhakara at 2007-7-10 12:02:01 > top of Java-index,Desktop,Core GUI APIs...
# 5
You can use a Timer and check if the mouse pointer location is inside the popup window.Use MouseInfo.getPointerInfo().getLocation() to get the location of the pointer on screen.
Rodney_McKaya at 2007-7-10 12:02:01 > top of Java-index,Desktop,Core GUI APIs...