m_tab.addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent e) {
if(e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 2)
{
bSelect = true;
m_tab.changeSelection(m_tab.getSelectedRow(),m_tab.getSelectedColumn(),false,true);
}
if(e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 1)
{
m_tab.clearSelection();
bSelect = false;
}
}
});
m_tab.addFocusListener(new FocusAdapter() {
public void focusGained(FocusEvent e) {
if(!bSelect)
m_tab.clearSelection();
}
});
m_tab.addMouseListener(new MouseAdapter()
{
public void mousePressed(MouseEvent e)
{
if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 1) // wenn Klick auf eine zeile
m_tab.clearSelection();
}
});
int indexSelectedRow = -1;
m_tab.addMouseListener(new MouseAdapter()
{
public void mousePressed(MouseEvent e)
{
if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() > 1)
indexSelectedRow = m_tab.getSelectedRow();
}
if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 1) // wenn Klick auf eine zeile
m_tab.setRowSelectionInterval(indexSelectedRow, indexSelectedRow);
}
});
if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 1) {
e.consume();
}