Last change
on this file was 127, checked in by Wouter Pasman, 6 years ago |
#41 ROLL BACK of rev.126 . So this version is equal to rev. 125
|
File size:
788 bytes
|
Line | |
---|
1 | package genius.gui.panels;
|
---|
2 |
|
---|
3 | import java.util.ArrayList;
|
---|
4 |
|
---|
5 | import javax.swing.AbstractListModel;
|
---|
6 |
|
---|
7 | /**
|
---|
8 | * Extends the default ListModel by allowing it to be loaded afterwards with
|
---|
9 | * data.
|
---|
10 | *
|
---|
11 | * @author Mark Hendrikx (m.j.c.hendrikx@student.tudelft.nl)
|
---|
12 | * @version 05/12/11
|
---|
13 | */
|
---|
14 | public class ExtendedListModel<A> extends AbstractListModel<A> {
|
---|
15 | private static final long serialVersionUID = -8345719619830961700L;
|
---|
16 | ArrayList<A> items = new ArrayList<A>();
|
---|
17 |
|
---|
18 | public void setInitialContent(ArrayList<A> items) {
|
---|
19 | this.items = items;
|
---|
20 |
|
---|
21 | }
|
---|
22 |
|
---|
23 | public A getElementAt(int index) {
|
---|
24 | if (index >= 0) {
|
---|
25 | return items.get(index);
|
---|
26 | }
|
---|
27 | return null;
|
---|
28 | }
|
---|
29 |
|
---|
30 | public int getSize() {
|
---|
31 | return items.size();
|
---|
32 | }
|
---|
33 |
|
---|
34 | public void removeElementAt(int i) {
|
---|
35 | items.remove(i);
|
---|
36 | }
|
---|
37 | } |
---|
Note:
See
TracBrowser
for help on using the repository browser.