Code example for JList

Methods: addListSelectionListener

0
        editButton.setEnabled(false);
        deleteButton.setEnabled(false);
    } 
 
    public void addListSelectionListener(ListSelectionListener listSelectionListener) {
        list.addListSelectionListener(listSelectionListener);
    } 
 
    public void setModel(ListModel<E> listModel) {
        model = listModel;
        list.setModel(model);
    } 
 
    class SmallButton extends JButton {
 
        public SmallButton() { 
            setMargin(new Insets(0, 0, 0, 0));
        } 
 
    } 
Connect your IDE to all the code out there  Get Codota for Java