Code example for JList

Methods: locationToIndex

0
      public void mouseClicked(MouseEvent e) {
	if ((e.getModifiers() & InputEvent.BUTTON1_MASK)
	    == InputEvent.BUTTON1_MASK) {
            if (    ((e.getModifiers() & InputEvent.SHIFT_DOWN_MASK) == 0)
                 && ((e.getModifiers() & InputEvent.CTRL_DOWN_MASK) == 0) ) {
              int index = m_List.locationToIndex(e.getPoint());
              if ((index != -1) && (m_SingleText != null)) {
                setSingle((String)m_Model.elementAt(index));
            } 
          } 
	} else { 
	  // if there are stored objects then assume that the storer 
	  // will handle popping up the text in a seperate frame 
	  if (m_HandleRightClicks) {
	    int index = m_List.locationToIndex(e.getPoint());
	    if (index != -1) {
	      String name = (String)m_Model.elementAt(index);
	      openFrame(name);
	    } 
	  }