public void mousePressed(MouseEvent e) { if (e.getButton() != MouseEvent.BUTTON1) { return; } Point pt = e.getPoint(); if (getClient().contains(pt)) { if (e.getClickCount() > 1) { // don't select/deselect on // double-click return; } int idx = getItemIndex(e.getY()); if (checkIdx(idx)) { requestFocus(); boolean selected = isIndexSelected(idx); int sel = selected ? ItemEvent.DESELECTED : ItemEvent.SELECTED; if (!selected) { select(idx); } else { deselect(idx); } fireItemEvent(sel); } } else if (vAdjustable.getBounds().contains(pt) || hAdjustable.getBounds().contains(pt)) { scrollPressed = true; } }
public void mouseDragged(MouseEvent e) { if (scrollPressed) { return; } int y = e.getY(); int idx = getItemIndex(y); if (checkIdx(idx)) { selectVisible(idx); } }
public void mouseClicked(MouseEvent e) { if (getClient().contains(e.getPoint()) && e.getClickCount() == 2) { fireActionEvent(e.getWhen(), e.getModifiers()); } }