-
Bug
-
Resolution: Unresolved
-
P4
-
None
-
6u17
-
x86
-
windows_xp
FULL PRODUCT VERSION :
JDK 1.6.0_17 - b04
ADDITIONAL OS VERSION INFORMATION :
Windows XP sp2
A DESCRIPTION OF THE PROBLEM :
When you addMouseListener to JTable and using getSelectedColumn(), getSelectedRow()
the result after you release will be wrong in case of
- press and move to the right
- press and move to the down
ex prob1. when you press on position 1,1 and release on 1,2 result is 1,1
ex prob2. when you press on position 1,1 and release on 2,1 result is 1,1
ex prob3. when you press on position 1,1 and release on 2,2 result is 1,1
if move to the left and top is still fine
ex. when you press on position 1,1 and release on 0,1 result is 0,1
ex. when you press on position 1,1 and release on 1,0 result is 1,0
ex. when you press on position 1,1 and release on 0,0 result is 0,0
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Create class extends JFrame implements MouseListener
2. create jtable addmouselistener to it
3. concentrate in mousepress and mousereleased
mousePressed(MouseEvent e)
{
System.out.println(table.getSelectedColumn() +", "+ table.getSelectedRow());
}
mouseReleased(MouseEvent e)
{
System.out.println(table.getSelectedColumn() +", "+ table.getSelectedRow());
}
4. try to release on top, down, left, right
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
result will show the row,column when mouse press not on mouse released
* when released on left or/and down position from pressed
ACTUAL -
it should show the proper row,column when mouse released
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
/*
Author: Sruit Angkavanitsuk
*/
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class JTableBug extends JFrame implements MouseListener
{
JTable table = new JTable(5,5);
JTableBug()
{
add(table);
setVisible(true);
setSize(300,300);
table.addMouseListener(this);
}
public void mouseClicked(MouseEvent e){}
public void mousePressed(MouseEvent e)
{
System.out.println("Pressed:"+table.getSelectedRow() +","+ table.getSelectedColumn());
}
public void mouseReleased(MouseEvent e)
{
System.out.println("Released:"+table.getSelectedRow() +","+ table.getSelectedColumn());
}
public void mouseEntered(MouseEvent e){}
public void mouseExited(MouseEvent e){}
public static void main(String[] args)
{
new JTableBug();
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
fix ur algorithm : ]
JDK 1.6.0_17 - b04
ADDITIONAL OS VERSION INFORMATION :
Windows XP sp2
A DESCRIPTION OF THE PROBLEM :
When you addMouseListener to JTable and using getSelectedColumn(), getSelectedRow()
the result after you release will be wrong in case of
- press and move to the right
- press and move to the down
ex prob1. when you press on position 1,1 and release on 1,2 result is 1,1
ex prob2. when you press on position 1,1 and release on 2,1 result is 1,1
ex prob3. when you press on position 1,1 and release on 2,2 result is 1,1
if move to the left and top is still fine
ex. when you press on position 1,1 and release on 0,1 result is 0,1
ex. when you press on position 1,1 and release on 1,0 result is 1,0
ex. when you press on position 1,1 and release on 0,0 result is 0,0
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Create class extends JFrame implements MouseListener
2. create jtable addmouselistener to it
3. concentrate in mousepress and mousereleased
mousePressed(MouseEvent e)
{
System.out.println(table.getSelectedColumn() +", "+ table.getSelectedRow());
}
mouseReleased(MouseEvent e)
{
System.out.println(table.getSelectedColumn() +", "+ table.getSelectedRow());
}
4. try to release on top, down, left, right
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
result will show the row,column when mouse press not on mouse released
* when released on left or/and down position from pressed
ACTUAL -
it should show the proper row,column when mouse released
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
/*
Author: Sruit Angkavanitsuk
*/
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class JTableBug extends JFrame implements MouseListener
{
JTable table = new JTable(5,5);
JTableBug()
{
add(table);
setVisible(true);
setSize(300,300);
table.addMouseListener(this);
}
public void mouseClicked(MouseEvent e){}
public void mousePressed(MouseEvent e)
{
System.out.println("Pressed:"+table.getSelectedRow() +","+ table.getSelectedColumn());
}
public void mouseReleased(MouseEvent e)
{
System.out.println("Released:"+table.getSelectedRow() +","+ table.getSelectedColumn());
}
public void mouseEntered(MouseEvent e){}
public void mouseExited(MouseEvent e){}
public static void main(String[] args)
{
new JTableBug();
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
fix ur algorithm : ]