2

I use JTable, and have a MouseMotionAdapter listens to the mouse, and coloring the line of the mouse at any given moment.

addMouseMotionListener(new MouseMotionAdapter() {
        @Override           
        public void mouseMoved(MouseEvent e)
        {
            JTable aTable =  (JTable)e.getSource();             
            int row = aTable.rowAtPoint(e.getPoint());
            if(m_cursorRow != row){
                m_cursorRow = row;
                aTable.repaint();
            }
        }
    }); 

The problem is, when I move the mouse out of the table, the MouseMotionAdapter is not called, because the mouse is no longer over the JTable...

Is there another event I can use to paint the table again when the mouse is getting out of the JTable borders?

mKorbel
  • 109,525
  • 20
  • 134
  • 319
user1028741
  • 2,745
  • 6
  • 34
  • 68

1 Answers1

3

Is there another event I can use to paint the table again when the mouse is getting out of the JTable borders?

You can use the mouseExited() event of the MouseListener.

camickr
  • 321,443
  • 19
  • 166
  • 288