LeaveWorkPanel.java~9~
资源名称:Java.rar [点击查看]
上传用户:liming9091
上传日期:2014-10-27
资源大小:3376k
文件大小:2k
源码类别:
Java编程
开发平台:
Java
- package manpowersystem;
- /**
- * <p>Title: </p>
- * <p>Description: </p>
- * <p>Copyright: Copyright (c) 2003</p>
- * <p>Company: </p>
- * @author not attributable
- * @version 1.0
- */
- import java.io.*;
- import java.util.*;
- import java.awt.*;
- import java.awt.event.*;
- import javax.swing.*;
- import javax.swing.event.*;
- import javax.swing.border.*;
- import javax.swing.table.*;
- import java.util.*;
- import com.borland.jbcl.layout.*;
- public class OffWorkPanel extends TablePanel {
- String[] arrField = {"工 号", "姓 名", "下班时间", "备 注"};
- public OffWorkPanel() {
- tableModel = new DefaultTableModel( arrData, arrField );
- jRecordTable = new JTable( tableModel );
- jTableScrollPane.getViewport().add( jRecordTable, null );
- UpdateRecord(); //更新表格
- this.setTitle( "下班登记页面" );
- }
- public void AddRecord() {
- OnWorkRecordPane recordPane = new OnWorkRecordPane();
- recordPane.setSize( 630, 300 );
- recordPane.setLocation( 230, 100 );
- recordPane.setVisible( true );
- recordPane.setResizable( false );
- recordPane.validate();
- UpdateRecord(); //更新表格
- }
- public void DelRecord() {
- jTableScrollPane.getViewport().add( jRecordTable, null );
- intRow = jRecordTable.getSelectedRow();
- try {
- database.DeleteData( tableModel.getValueAt( intRow, 0 ).toString() );
- }
- catch ( Exception e ) {
- e.printStackTrace();
- }
- UpdateRecord(); //更新表格
- }
- public void UpdateRecord() {
- Object[][] arrTmp = {}; //设定表格的字段
- tableModel = new DefaultTableModel( arrTmp, arrField );
- jRecordTable = new JTable( tableModel );
- jTableScrollPane.getViewport().add( jRecordTable, null );
- try {
- RecordItem[] result = new RecordItem[ 100 ];
- for ( int j = 0; j < 100; j++ )
- result[ j ] = new RecordItem();
- result = database.AccessData();
- for ( int i = 0; i < result.length; i++ ) {
- Object newdata[] = {result[ i ].GetEmployeeID(),
- result[ i ].GetEmployeeName(),
- result[ i ].GetOffWorkTime(),
- result[ i ].GetDescribe()};
- tableModel.addRow( newdata );
- }
- }
- catch ( Exception e ) {
- e.printStackTrace();
- }
- }
- }