Here you can find the source of removeSelectionFromList(JList fileList)
Parameter | Description |
---|---|
fileList | a parameter |
public static void removeSelectionFromList(JList fileList)
//package com.java2s; //License from project: Open Source License import javax.swing.DefaultListModel; import javax.swing.JList; public class Main { /**/*www. j a v a 2 s . c om*/ * Removes the selected entry from the given list. If nothing is selected, * nothing will be removed. * * @param fileList */ public static void removeSelectionFromList(JList fileList) { if (fileList.getSelectedIndex() > -1) { ((DefaultListModel) fileList.getModel()).remove(fileList.getSelectedIndex()); } } }