Child: [r15] (diff)

Download this file

ListItem.java    62 lines (50 with data), 1.4 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*
* SPDXVersion: SPDX-1.1
*
* Creator: Person: Nuno Brito (nuno.brito@triplecheck.de)
*
* Creator: Organization: TripleCheck (contact@triplecheck.de)
*
* Created: 2013-09-20T00:00:00Z
*
* LicenseName: NOASSERTION
*
* FileName: ListItem.java
*
* FileType: SOURCE
*
* FileCopyrightText: <text> Copyright 2013 Nuno Brito, TripleCheck </text>
*
* FileComment: <text> The custom handler of nodes for lists </text>
*/
package GUI;
import java.io.File;
import javax.swing.Icon;
import javax.swing.ImageIcon;
/**
*
* @author Nuno Brito, 20th of September 2013 in Darmstadt, Germany.
*/
public class ListItem implements Comparable{
public Icon
icon = null; // the icon that will be used for rendering this item
public String
title = "";
public boolean // permit this item to be launched with a single click
singleClick = false;
// set of methods to be overriden
public void onDoubleClick(){}
public void onTripleClick() {}
public void setIcon(File file){
icon = new ImageIcon(file.getAbsolutePath());
}
@Override
public String toString(){
return title;
}
@Override
public int compareTo(Object o) {
ListItem product = (ListItem) o;
return this.toString().compareTo(product.toString());
}
}