예제 #1
0
 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;
   }
 }
예제 #2
0
 public void mouseDragged(MouseEvent e) {
   if (scrollPressed) {
     return;
   }
   int y = e.getY();
   int idx = getItemIndex(y);
   if (checkIdx(idx)) {
     selectVisible(idx);
   }
 }
예제 #3
0
 public void mouseClicked(MouseEvent e) {
   if (getClient().contains(e.getPoint()) && e.getClickCount() == 2) {
     fireActionEvent(e.getWhen(), e.getModifiers());
   }
 }