資源簡介
人員管理系統(tǒng)+數(shù)據(jù)字典+講解

代碼片段和文件信息
package?com.family;
import?java.awt.BorderLayout;
import?java.awt.GridLayout;
import?java.awt.event.ActionEvent;
import?java.awt.event.ActionListener;
import?javax.swing.JButton;
import?javax.swing.JDialog;
import?javax.swing.Jframe;
import?javax.swing.JLabel;
import?javax.swing.JOptionPane;
import?javax.swing.JPanel;
import?javax.swing.JTextField;
public?class?Family_Add?extends?JDialog?implements?ActionListener
{
//定義需要的swing組件
JLabel?jl1jl2jl3jl4jl5jl6jl7jl8jl0;
JButton?jb1jb2;
JTextField?jtf1jtf2jtf3jtf4jtf5jtf6jtf7jtf8jtf0;
JPanel?jp1jp2jp3;
??public?Family_Add(Jframe?ownerString?titleboolean?modal)
????{
???? super(ownertitlemodal);
???? jl0=new?JLabel(“家庭編號“);
???? jl1=new?JLabel(“戶主“);
???? jl2=new?JLabel(“父親“);
???? jl3=new?JLabel(“母親“);
???? jl4=new?JLabel(“配偶“);
???? jl5=new?JLabel(“子女1“);
???? jl6=new?JLabel(“子女2“);
???? jl7=new?JLabel(“子女3“);
???? jl8=new?JLabel(“子女4“);
????
???? jtf1=new?JTextField();
???? jtf2=new?JTextField();
???? jtf3=new?JTextField();
???? jtf4=new?JTextField();
???? jtf5=new?JTextField();
???? jtf6=new?JTextField();
???? jtf7=new?JTextField();
???? jtf8=new?JTextField();
???? jtf0=new?JTextField();
????
???? ?jb1=new?JButton(“添加“);
???? ?jb1.addActionListener(this);
???? ?jb2=new?JButton(“取消“);
???? ?jb2.addActionListener(this);
???? ?
???? ?jp1=new?JPanel();
???? ?jp2=new?JPanel();
???? ?jp3=new?JPanel();
???? ?
???? ?//設(shè)置布局
???? ?jp1.setLayout(new?GridLayout(91));
???? ?jp2.setLayout(new?GridLayout(91));
???? ?
???? ?//添加組件
???? ?jp1.add(jl0);
???? ?jp1.add(jl1);
???? ?jp1.add(jl2);
???? ?jp1.add(jl3);
???? ?jp1.add(jl4);
???? ?jp1.add(jl5);
???? ?jp1.add(jl6);
???? ?jp1.add(jl7);
???? ?jp1.add(jl8);
???? ?
???? jp2.add(jtf0);
???? ?jp2.add(jtf1);
???? ?jp2.add(jtf2);
???? ?jp2.add(jtf3);
???? ?jp2.add(jtf4);
???? ?jp2.add(jtf5);
???? ?jp2.add(jtf6);
???? ?jp2.add(jtf7);
???? ?jp2.add(jtf8);
???? ?
???? ?
???? ?jp3.add(jb1);
???? ?jp3.add(jb2);
???? ?
???? ?this.add(jp1BorderLayout.WEST);
???? ?this.add(jp2BorderLayout.CENTER);
???? ?this.add(jp3BorderLayout.SOUTH);
???? ?
????
????
???? ?//展現(xiàn)
???? ?this.setSize(300200);
???? ?this.setVisible(true);
?????}
@Override
public?void?actionPerformed(ActionEvent?e)?{
//?TODO?Auto-generated?method?stub
if(e.getSource()==jb2)
{
this.dispose();
}
if(e.getSource()==jb1)
{
//希望添加
Family_Model?temp=new?Family_Model();
String?sql=“insert?into?Family?values?(?????????)“;
String[]?paras={jtf0.getText()jtf1.getText()jtf2.getText()jtf3.getText()jtf4.getText()jtf5.getText()jtf6.getText()jtf7.getText()jtf8.getText()};
if(!temp.updatePeople(sql?paras))
{
//提示
JOptionPane.showMessageDialog(this“對不起,添加失敗“);
????
}
//關(guān)閉對話框
this.dispose();
}
}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2012-08-02?08:26??Person__Manage___System\
?????文件?????????393??2012-08-02?08:26??Person__Manage___System\.classpath
?????文件?????????394??2012-08-02?08:25??Person__Manage___System\.project
?????目錄???????????0??2012-08-02?08:25??Person__Manage___System\.settings\
?????文件?????????629??2012-08-02?08:25??Person__Manage___System\.settings\org.eclipse.jdt.core.prefs
?????目錄???????????0??2012-08-02?08:26??Person__Manage___System\bin\
?????目錄???????????0??2012-08-05?16:57??Person__Manage___System\bin\com\
?????目錄???????????0??2012-08-05?00:52??Person__Manage___System\bin\com\family\
?????文件????????3540??2012-08-05?00:52??Person__Manage___System\bin\com\family\Family_Add.class
?????文件????????2584??2012-08-05?00:52??Person__Manage___System\bin\com\family\Family_Model.class
?????文件????????4778??2012-08-05?17:22??Person__Manage___System\bin\com\family\Family_System.class
?????文件????????4038??2012-08-05?00:52??Person__Manage___System\bin\com\family\Family_Update.class
?????目錄???????????0??2012-08-05?17:15??Person__Manage___System\bin\com\login\
?????文件????????2320??2012-08-06?21:48??Person__Manage___System\bin\com\login\Login.class
?????目錄???????????0??2012-08-06?20:41??Person__Manage___System\bin\com\outPeople\
?????文件????????3412??2012-08-06?20:36??Person__Manage___System\bin\com\outPeople\outPeople_Add.class
?????文件????????2403??2012-08-06?20:33??Person__Manage___System\bin\com\outPeople\outPeople_Model.class
?????文件????????5568??2012-08-06?20:56??Person__Manage___System\bin\com\outPeople\outPeople_System.class
?????文件????????3637??2012-08-06?21:42??Person__Manage___System\bin\com\outPeople\outPeople_Update.class
?????目錄???????????0??2012-08-05?16:11??Person__Manage___System\bin\com\people\
?????文件????????3444??2012-08-05?16:11??Person__Manage___System\bin\com\people\People_Add.class
?????文件????????2430??2012-08-05?16:11??Person__Manage___System\bin\com\people\People_Model.class
?????文件????????6653??2012-08-06?21:46??Person__Manage___System\bin\com\people\People_System.class
?????文件????????3856??2012-08-06?21:29??Person__Manage___System\bin\com\people\People_Update.class
?????目錄???????????0??2012-08-05?16:25??Person__Manage___System\bin\com\pets\
?????文件????????2971??2012-08-05?10:37??Person__Manage___System\bin\com\pets\Pets_Add.class
?????文件????????2214??2012-08-05?00:37??Person__Manage___System\bin\com\pets\Pets_Model.class
?????文件????????5089??2012-08-05?17:22??Person__Manage___System\bin\com\pets\Pets_System.class
?????文件????????3271??2012-08-05?16:38??Person__Manage___System\bin\com\pets\Pets_Update.class
?????目錄???????????0??2012-08-03?16:35??Person__Manage___System\bin\com\sqlhelper\
?????文件????????2640??2012-08-03?16:35??Person__Manage___System\bin\com\sqlhelper\SqlHelper.class
............此處省略33個文件信息
評論
共有 條評論