LeaveWorkPanel.java~16~
资源名称:Java.rar [点击查看]
上传用户:liming9091
上传日期:2014-10-27
资源大小:3376k
文件大小:3k
源码类别:
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 LeaveWorkPanel extends TablePanel {
- String[] arrField = {"工 号", "姓 名", "请假时间", "备 注"};
- public LeaveWorkPanel() {
- 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();
- if (intRow == -1)
- return;
- 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 ].GetLeaveWorkTime(),
- result[ i ].GetDescribe()};
- String strTmp = result[ i ].GetLeaveWorkTime();
- if ( (strTmp== null) || (strTmp.trim().length() == 0) )
- continue;
- tableModel.addRow( newdata );
- }
- }
- catch ( Exception e ) {
- e.printStackTrace();
- }
- }
- }