You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.1 KiB
53 lines
1.1 KiB
package com.tmj.view;
|
|
|
|
import java.util.List;
|
|
|
|
import javax.swing.table.AbstractTableModel;
|
|
|
|
import com.tmj.javaBean.Movietmj;
|
|
|
|
|
|
public class MovieTableModel extends AbstractTableModel{
|
|
|
|
private String[] columnNames= {"电影类型","电影编号","电影中文名","电影英文名"};
|
|
private List<Movietmj> movies=null;
|
|
|
|
public MovieTableModel(List<Movietmj> movies) {
|
|
this.movies=movies;
|
|
}
|
|
|
|
@Override
|
|
public int getRowCount() {
|
|
// TODO 自动生成的方法存根
|
|
return movies.size();
|
|
}
|
|
|
|
@Override
|
|
public int getColumnCount() {
|
|
// TODO 自动生成的方法存根
|
|
return columnNames.length;
|
|
}
|
|
|
|
@Override
|
|
public Object getValueAt(int rowIndex, int columnIndex) {
|
|
// TODO 自动生成的方法存根
|
|
Movietmj p=movies.get(rowIndex);
|
|
|
|
switch(columnIndex) {
|
|
case 0:
|
|
return p.getmovieidtmj();
|
|
case 1:
|
|
return p.getcategorytmj();
|
|
case 2:
|
|
return p.getcnametmj();
|
|
default:
|
|
return p.getenametmj();
|
|
}
|
|
}
|
|
|
|
public String getColumnName(int columnIndex) {
|
|
return columnNames[columnIndex];
|
|
}
|
|
|
|
}
|