I am adding a label to a JTable and adding mouseMotionListener event to the label.The label moves across the table on mouseDragged event.The table contains more than 50 columns and only 15 columns will be visible at any point of time.Now if I want to move the label to the other side of the same row I can't move the label without moving the scroll bar manually.Is it possible to move the scrollbar automatically simply on dragging the label?
JTable table = new JTable(model);
JLabel label = new JLabel();
label.setBounds(100,50,80,20);
table.add(label);
label.addMouseMotionLister(new MouseMotionListener()
{
public void mouseDragged(MouseEvent arg0)
{
label.setBounds(label.getX()+arg0.getX(),Y,width,height);
}