Java examples for Swing:JList
DefaultListModel remove Item
//package com.java2s; import javax.swing.DefaultListModel; public class Main { public static DefaultListModel<String> removeItem( DefaultListModel<String> listModel, int SelectedIndex) { // Check if selected index is in bounds. if (SelectedIndex >= 0) { // Remove the selected item. listModel.removeElementAt(SelectedIndex); }/* w ww. j a v a2s .c om*/ return listModel; } }