Example usage for javax.swing.event ListDataEvent ListDataEvent

List of usage examples for javax.swing.event ListDataEvent ListDataEvent

Introduction

In this page you can find the example usage for javax.swing.event ListDataEvent ListDataEvent.

Prototype

public ListDataEvent(Object source, int type, int index0, int index1) 

Source Link

Document

Constructs a ListDataEvent object.

Usage

From source file:put.semantic.fcanew.ui.FilesListModel.java

public void add(File[] files) {
    if (files == null || files.length == 0) {
        return;/*from ww  w. jav  a 2 s  .  c o  m*/
    }
    int begin = data.size();
    data.addAll(Arrays.asList(files));
    int end = data.size() - 1;
    ListDataEvent e = new ListDataEvent(this, ListDataEvent.INTERVAL_ADDED, begin, end);
    for (ListDataListener l : listeners) {
        l.intervalAdded(e);
    }
}

From source file:put.semantic.fcanew.ui.FilesListModel.java

public void remove(int index) {
    data.remove(index);//  w w w . ja v a  2s.  c o m
    ListDataEvent e = new ListDataEvent(this, ListDataEvent.INTERVAL_REMOVED, index, index);
    for (ListDataListener l : listeners) {
        l.intervalAdded(e);
    }
}

From source file:put.semantic.fcanew.ui.FilesListModel.java

public void clear() {
    if (!data.isEmpty()) {
        ListDataEvent e = new ListDataEvent(this, ListDataEvent.INTERVAL_REMOVED, 0, data.size() - 1);
        data.clear();/*from w w  w .j  a v a  2 s  .  c om*/
        for (ListDataListener l : listeners) {
            l.intervalRemoved(e);
        }
    }
}