bookmodel.java

来自「这是一个j2me开发的手机图书馆程序」· Java 代码 · 共 83 行

JAVA
83
字号
package model;
import ui.table.*;
import java.util.*;
import ui.Title;

public class BookModel implements TableModel{
    private Vector books = null;
    
    /** Creates a new instance of BookModel */
    public BookModel(Vector books) {
        this.books = books;
    }
    public int getColumnCount(){
        String[] book = (String[])books.elementAt(0);
        return book.length;
    }

    
    public int getRowCount(){
        return books.size();
    }

    
    public String getColumnHeaderText(int col){
        
        switch(col){
            case 0:
            {
                return Title.bookname;
                
            }
            case 1:
            {
                return Title.indexid;
                
            }
            case 2:
            {
                return Title.state;
                
            }
            case 3:
            {
                return Title.returndate;
                
            }
            case 4:
            {
                return Title.bookauthor;
                
            }
            case 5:
            {
                return Title.publisher;
            }
            case 6:
            {
                return Title.pubdate;
            }
            default:
            {
                return "";
            }
        }
    }

    
    public boolean hasColumnHeaders(){
        return true;
    }

    
    public String getValueAt(int row,int col){
        String[] book = (String[])books.elementAt(row);
        return book[col];
    }
    public String[] getValueAt(int row){
        String[] book = (String[])books.elementAt(row);
        return book;
    }
    
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?