-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMovieData.java
More file actions
67 lines (51 loc) · 1.25 KB
/
MovieData.java
File metadata and controls
67 lines (51 loc) · 1.25 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
62
63
64
65
66
67
package databaseOfMovies;
import java.util.List;
import javax.swing.table.AbstractTableModel;
public class MovieData extends AbstractTableModel {
private static final long serialVersionUID = 1L;
public List<Object[]> movies;
public String[] columns = {"Name", "Director", "Year", "Type"};
int r,c;
@Override
public int getColumnCount() {
// TODO Auto-generated method stub
return 4;
}
@Override
public int getRowCount() {
// TODO Auto-generated method stub
return movies.size();
}
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
// TODO Auto-generated method stub
return movies.get(rowIndex)[columnIndex];
}
public String getColumnName(int index)
{
return columns[index];
}
public boolean isCellEditable(int rowIndex, int columnIndex)
{
boolean t=false;
if(columnIndex>=0) {
t = true;
}
return t;
}
public void setValueAt(Object aValue, int rowIndex, int columnIndex)
{
movies.get(rowIndex)[columnIndex]=aValue;
}
public void addMovie(String name, String director,String year, String type)
{
Object[] temp = {name, director, year, type};
movies.add(temp);
fireTableDataChanged();
}
public void deleteMovie(int index)
{
movies.remove(index);
fireTableDataChanged();
}
}