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

📄 ordertablemodel.java

📁 一个用java实现 的飞机订票系统,超级好用....
💻 JAVA
字号:
package com.zhu.server;import java.util.*;import javax.swing.table.AbstractTableModel;import com.zhu.entity.*;/* *  @author zhutingfa */public class OrderTableModel extends AbstractTableModel{	ArrayList s;	public OrderTableModel(ArrayList s){		this.s=s;		Collections.sort(s, new OrderDateComparetor());	}	public String getColumnName(int arg0) {		switch(arg0){			case 0: return "乘客姓名";			case 1: return "乘客身份证号";			case 2: return "起始地";			case 3: return "目的地";			case 4: return "航班号";			case 5: return "日期";			case 6: return "星期";			case 7: return "价格";			case 8: return "舱位等级";			case 9: return "机票类型";			case 10: return "奖励的积分";			default: return null;		}	}	public int getColumnCount() {		return 11;	}	public int getRowCount() {		return s.size();	}	public Object getValueAt(int row, int col) {		OrderItem item=(OrderItem)s.get(row);		Flight ft=(Flight)item.getFlight();		FlightSchedular fcs=ft.getSch();		if(row<0 || row>s.size())			return null;		switch(col){		case 0: return item.getPassengerName();		case 1: return item.getPassengerId();		case 2: return fcs.getFromAddress();		case 3: return fcs.getToAddress();		case 4: return fcs.getFlightNumber();		case 5: return ft.getDate().simpleString();		case 6: return week(ft.getDate());		case 7: return fcs.getPrice()*ft.getPriceOff();		case 8: return item.getF_class();		case 9: return item.getT_type();		case 10: return item.getScore();		default: return null;		}	}	private String week(MyDate d){		switch(d.getWeekDay()){		case 1: return "星期日";		case 2: return "星期一"; 		case 3: return "星期二";		case 4: return "星期三";		case 5: return "星期四";		case 6: return "星期五";		case 7: return "星期六";		default:return null;		}	}	class OrderDateComparetor implements  Comparator{		public int compare(Object o1, Object o2) {		      OrderItem i1=(OrderItem)o1;		      OrderItem i2=(OrderItem)o2;			   return (i1.getFlight().getDate()).compareTo(i2.getFlight().getDate());		}	}}

⌨️ 快捷键说明

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