Point click = event.getPoint(); int index = BasicListUI.this.locationToIndex(list, click); if (index == -1) return;  BasicListUI.this.list.setSelectedIndex(index);
    public void mousePressed(MouseEvent event)    {      Point click = event.getPoint();      int index = BasicListUI.this.locationToIndex(list, click);      if (index == -1)        return;      BasicListUI.this.list.setSelectedIndex(index);    }