import javax.swing.*;
import javax.swing.table.*;
import java.io.*;
import java.util.*;
public class selectC extends JFrame{
JFrame f=new JFrame("信用卡收入支出表查询");
Connection con;
Statement sta;
ResultSet rs;
String driver= "com.microsoft.jdbc.sqlserver.SQLServerDriver";
String url= "jdbc:microsoft:sqlserver://localhost:1433";
String title[]={"日期 "," 项目"," 金额 "," 收入/支出 "," 是否贷款 "," 还款日期 "};
Vector vector=new Vector();
AbstractTableModel tm;
JTable table;
JScrollPane scroll;
JButton btl;
TextField input1,input2,input3,input4,input5,input6;
String date1,date2;
String basename;
public selectC(String bn){
super("信用卡收入支出表");
setLayout(new FlowLayout());
basename=bn;
btl=new JButton("确定");
btl.addActionListener(new java.awt.event.ActionListener(){
public void actionPerformed(ActionEvent e){sel();
dispose();}
});
JLabel l=new JLabel("查找日期范围");
input1=new TextField(2);
JLabel year=new JLabel("年-");
input2=new TextField(2);
JLabel month=new JLabel("月-");
input3=new TextField(2);
JLabel day=new JLabel("日~");
JLabel dyear=new JLabel("年-");
input4=new TextField(2);
JLabel dmonth=new JLabel("月-");
input5=new TextField(2);
JLabel dday=new JLabel("日");
input6=new TextField(2);
add(l);
add(input1);
add(year);
add(input2);
add(month);
add(input3);
add(day);
add(input4);
add(dyear);
add(input5);
add(dmonth);
add(input6);
add(dday);
add("South", btl);
pack();
setSize(650,100);
setVisible(true);
}
public void sel()
{
initTable();
init();
}
public void init(){
f.setSize(500,500);
f.setLayout(new FlowLayout());
f.setVisible(true);
}
public void initTable(){
date1=input1.getText()+"-"+input2.getText()+"-"+input3.getText();
date2=input4.getText()+"-"+input5.getText()+"-"+input6.getText();
//---------------------------------------------------------------------------
tm=new AbstractTableModel(){
public int getColumnCount(){
return title.length;
}
public int getRowCount(){
return vector.size();
}
public Object getValueAt(int row,int column){
if(!vector.isEmpty()){
return ((Vector) vector.elementAt(row)).elementAt(column);
}else{
return null;
}
}
public void setValueAt(Object value,int row,int column){
}
public String getColumnName(int column){
return title[column];
}
//public Class getColumnClass(int c){
// return getValueAt(0,c).getClass();
// }
public boolean isCellEditable(int row,int column){
return false; } };
table=new JTable(tm);
table.setShowHorizontalLines(true);
table.setShowVerticalLines(true);
上一页 [1] [2] [3] [4] [5] [6] [7] 下一页