Here you can find the source of addDoubleClickEvent(JList list)
public static void addDoubleClickEvent(JList list)
//package com.java2s; /*/* w ww . j a v a 2 s . c o m*/ * GeoTools - The Open Source Java GIS Toolkit * http://geotools.org * * (C) 2003-2008, Open Source Geospatial Foundation (OSGeo) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. */ import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import javax.swing.JList; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; public class Main { public static void addDoubleClickEvent(JList list) { list.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { JList source = (JList) e.getSource(); if (e.getClickCount() == 2) { ListSelectionListener[] listeners = source.getListSelectionListeners(); for (int i = 0; i < listeners.length; i++) { listeners[i].valueChanged(new ListSelectionEvent(source, source.getSelectedIndex(), source.getSelectedIndex(), false)); } } } }); } }