⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 downloadtablemodel.java

📁 MyDownloader 是一款使用 http 协议(RFC 1867)用于下载一个或多个文件到本地的简单易用的收费 Java 程序.使用托拽操作,你可以在一个页面内下载多个文件.在下载文件的过程当中
💻 JAVA
字号:
/*
 * Copyright 2007 JavaAtWork All rights reserved.
 * Use is subject to license terms.
 */
package com.javaatwork.mydownloader;

import java.util.List;

import javax.swing.table.AbstractTableModel;

import com.javaatwork.mydownloader.utils.LocaleManager;

/**
 * Class for showing the contents in the table.
 * 
 * @author Johannes Postma
 */
public class DownloadTableModel extends AbstractTableModel {

	private static final long serialVersionUID = 3179596630550679418L;
	private String[] columnNames = new String[1];
	private List files = null;
	
	/**
	 * Creates a new DownloadTableModel.
	 * 
	 * @param files To files to show.
	 */
	public DownloadTableModel(List files) {
		this.files = files;
		columnNames[0] = LocaleManager.getInstance().getString("filename");
	}
	
	/**
	 * Returns the number of columns.
	 * 
	 * @return The number of columns.
	 */
	public int getColumnCount() {
		return columnNames.length;
	}
	
	/**
	 * Returns the number of rows.
	 * 
	 * @return The number of rows.
	 */
	public int getRowCount() {
		return files.size();
	}

	/**
	 * Returns the column name.
	 * 
	 * @param col The particular column.
	 * @return The column name.
	 */
	public String getColumnName(int col) {
		return columnNames[col];
	}
	
	/**
	 * Returns the object of a cell in a table.
	 * 
	 * @param row The row.
	 * @param col The column.
	 * @return The object to be displayed.
	 */
	public Object getValueAt(int row, int col) {
		return (DownloadFile) files.get(row);
	}

	/**
	 * Returns the class of a column. This class is needed to
	 * determine the celleditor.
	 * 
	 * @param col The column.
	 * @return The class.
	 */
	public Class getColumnClass(int col) {
		return getValueAt(0, col).getClass();
	}

	/**
	 * Returns true if a cell is editable.
	 * 
	 * @param row The row.
	 * @param col The column.
	 * @return True if a cell is editable.
	 */
	public boolean isCellEditable(int row, int col) {
		
		return false;
	}
}

⌨️ 快捷键说明

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