Java版學(xué)籍管理系統(tǒng)方案_第1頁
Java版學(xué)籍管理系統(tǒng)方案_第2頁
Java版學(xué)籍管理系統(tǒng)方案_第3頁
Java版學(xué)籍管理系統(tǒng)方案_第4頁
Java版學(xué)籍管理系統(tǒng)方案_第5頁
已閱讀5頁,還剩40頁未讀 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)

文檔簡介

1、.package學(xué)籍管理系統(tǒng);/* To change this template, choose Tools | Templates* and open the template in the editor.*/* author Administrator*/public class Delete extends JPanel implements ActionListener/*/private static final long serialVersionUID = 1L;Hashtable基本信息表 =null;.專業(yè)專注.JTextField學(xué)號 ,姓名 ,專業(yè) ,年級 ,出生 ;J

2、RadioButton男,女;JButton刪除 ;ButtonGroup group=null;FileInputStream inOne=null;ObjectInputStream inTwo=null;FileOutputStream outOne=null;ObjectOutputStream outTwo=null;File file=null;public Delete(File file)this.file=file;學(xué)號 =new JT extField(10);刪除 =new JButton("刪除 ");學(xué)號 .addActionListener(th

3、is);刪除 .addActionListener(this);姓名 =new JT extField(10);姓名 .setEditable(false);專業(yè) =new JT extField(10);專業(yè) .setEditable(false);年級 =new JT extField(10);年級 .setEditable(false);.專業(yè)專注.出生 =new JT extField(10);出生 .setEditable(false);男 =new JRadioButton(" 男",false);女 =new JRadioButton(" 女&quo

4、t;,false); group=new ButtonGroup(); group.add( 男 );group.add( 女 );Box box1=Box.createHorizontalBox();box1.add(new JLabel("輸入要刪除的學(xué)號:",JLabel.CENTER);box1.add( 學(xué)號 );box1.add( 刪除 );Box box2=Box.createHorizontalBox();box2.add(new JLabel("姓名 :",JLabel.CENTER);box2.add( 姓名 );Box box3=B

5、ox.createHorizontalBox();box3.add(new JLabel("性別 :",JLabel.CENTER);box3.add( 男 );box3.add( 女 );Box box4=Box.createHorizontalBox();box4.add(new JLabel("專業(yè) :",JLabel.CENTER);box4.add( 專業(yè) );Box box5=Box.createHorizontalBox();.專業(yè)專注.box5.add(new JLabel("年級 :",JLabel.CENTER);

6、box5.add( 年級 );Box box6=Box.createHorizontalBox();box6.add(new JLabel("出生 :",JLabel.CENTER);box6.add( 出生 );Box boxH=Box.createVerticalBox();boxH.add(box1);boxH.add(box2);boxH.add(box3);boxH.add(box4);boxH.add(box5);boxH.add(box6);boxH.add(Box.createVerticalGlue();JPanel pCenter=new JPanel(

7、);pCenter.add(boxH);setLayout(new BorderLayout();add(pCenter,BorderLayout.CENTER);validate();public void actionPerformed(ActionEvent e)if(e.getSource()=刪除 |e.getSource()=學(xué)號 ).專業(yè)專注.String number=""number=學(xué)號 .getText();if(number.length()>0)try inOne=new FileInputStream(file);inTwo=new Obj

8、ectInputStream(inOne);基本信息表 =(Hashtable)inTwo.readObject();inOne.close();inTwo.close();catch(Exception ee)if( 基本信息表 .containsKey(number)Student stu=(Student)基本信息表 .get(number);姓名 .setText(stu.getName();專業(yè) .setText(stu.getDisciping();年級 .setText(stu.getGrade();.專業(yè)專注.出生 .setText(stu.getBorth();if(stu.

9、getSex().equals("男 ")男.setSelected(true);else女.setSelected(true);String m="確定要刪除該學(xué)號及全部信息嗎?"intok=JOptionPane.showConfirmDialog(this,m,"確認(rèn)",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE);if(ok=JOptionPane.YES_OPTION)基本信息表 .remove(number);tryoutOne=new FileOutput

10、Stream(file);outTwo=new ObjectOutputStream(outOne);outTwo.writeObject(基本信息表 );.專業(yè)專注.outTwo.close();outOne.close();學(xué)號 .setText(null);姓名 .setText(null);專業(yè) .setText(null);年級 .setText(null);出生 .setText(null);catch(Exception ee)else if(ok=JOptionPane.NO_OPTION)學(xué)號 .setText(null);姓名 .setText(null);專業(yè) .setT

11、ext(null);年級 .setText(null);出生 .setText(null);.專業(yè)專注.elseString warning="該學(xué)號不存在 !"JOptionPane.showMessageDialog(this,warning,"警告",JOptionPane.WARNING_MESSAGE);elseString warning="必須要輸入學(xué)號!"JOptionPane.showMessageDialog(this,warning,"警告",JOptionPane.WARNING_MESSA

12、GE);.專業(yè)專注.package學(xué)籍管理系統(tǒng);/* To change this template, choose Tools | Templates* and open the template in the editor.*/* author Administrator*/public class Inquest extends JDialog implements ActionListener/*.專業(yè)專注.*/private static final long serialVersionUID = 1L;Hashtable基本信息表 =null;JTextField學(xué)號 ,姓名 ,專

13、業(yè) ,年級 ,出生 ;JRadioButton男,女;JButton查詢 ;ButtonGroup group=null;FileInputStream inOne=null;ObjectInputStream inTwo=null;File file=null;public Inquest(JFrame f,File file)super(f," 查詢對話框 ",false);this.file=file;學(xué)號 =new JT extField(10);查詢 =new JButton("查詢 ");學(xué)號 .addActionListener(this)

14、;查詢 .addActionListener(this);姓名 =new JT extField(10);姓名 .setEditable(false);專業(yè) =new JT extField(10);.專業(yè)專注.專業(yè) .setEditable(false);年級 =new JT extField(10);年級 .setEditable(false);出生 =new JT extField(10);出生 .setEditable(false);男 =new JRadioButton(" 男",false);女 =new JRadioButton(" 女",

15、false); group=new ButtonGroup();group.add(男 );group.add(女 );Box box1=Box.createHorizontalBox();box1.add(new JLabel("輸入要查詢的學(xué)號:",JLabel.CENTER);box1.add( 學(xué)號 );box1.add( 查詢 );Box box2=Box.createHorizontalBox();box2.add(new JLabel("姓名 :",JLabel.CENTER);box2.add( 姓名 );Box box3=Box.cre

16、ateHorizontalBox();box3.add(new JLabel("性別 :",JLabel.CENTER);box3.add( 男 );box3.add( 女 );Box box4=Box.createHorizontalBox();.專業(yè)專注.box4.add(new JLabel("專業(yè) :",JLabel.CENTER);box4.add( 專業(yè) );Box box5=Box.createHorizontalBox();box5.add(new JLabel("年級 :",JLabel.CENTER);box5.a

17、dd( 年級 );Box box6=Box.createHorizontalBox();box6.add(new JLabel("出生 :",JLabel.CENTER);box6.add( 出生 );Box boxH=Box.createVerticalBox();boxH.add(box1);boxH.add(box2);boxH.add(box3);boxH.add(box4);boxH.add(box5);boxH.add(box6);boxH.add(Box.createVerticalGlue();JPanel pCenter=new JPanel();pCen

18、ter.add(boxH);Container con=getContentPane();con.add(pCenter,BorderLayout.CENTER);con.validate();setVisible(false);.專業(yè)專注.setBounds(100,200,360,270);addWindowListener(new WindowAdapter() public void windowClosing(WindowEvent e)setVisible(false););public void actionPerformed(ActionEvent e)姓名 .setText(

19、null);專業(yè) .setText(null);年級 .setText(null);出生 .setText(null);if(e.getSource()=查詢 |e.getSource()=學(xué)號 )String number=""number=學(xué)號 .getText();if(number.length()>0).專業(yè)專注.try inOne=new FileInputStream(file);inTwo=new ObjectInputStream(inOne);基本信息表 =(Hashtable)inTwo.readObject();inOne.close();in

20、Two.close();catch(Exception ee)if( 基本信息表 .containsKey(number)Student stu=(Student)基本信息表 .get(number);姓名 .setText(stu.getName();專業(yè) .setText(stu.getDisciping();年級 .setText(stu.getGrade();出生 .setText(stu.getBorth();if(stu.getSex().equals("男 ")男.setSelected(true);else.專業(yè)專注.女.setSelected(true);

21、elseString warning="該學(xué)號不存在 !"JOptionPane.showMessageDialog(this,warning,"警告",JOptionPane.WARNING_MESSAGE);elseString warning="必須要輸入學(xué)號!"JOptionPane.showMessageDialog(this,warning,"警告",JOptionPane.WARNING_MESSAGE);.專業(yè)專注.package學(xué)籍管理系統(tǒng);/* To change this template,

22、choose Tools | Templates* and open the template in the editor.*/* author Administrator*/.專業(yè)專注.public class ModifySituation extends JPanel implements ActionListener/*/private static final long serialVersionUID = 1L;Hashtable基本信息表 =null;JTextField學(xué)號 ,姓名 ,專業(yè) ,年級 ,出生 ;JRadioButton男,女;ButtonGroup group=n

23、ull;JButton開始修改 ,錄入修改 ,重置 ;FileInputStream inOne=null;ObjectInputStream inTwo=null;FileOutputStream outOne=null;ObjectOutputStream outTwo=null;File file=null;public ModifySituation(File file)this.file=file;學(xué)號 =new JT extField(10);姓名 =new JT extField(10);專業(yè) =new JT extField(10);.專業(yè)專注.年級 =new JT extFi

24、eld(10);出生 =new JT extField(10);group=new ButtonGroup();男 =new JRadioButton(" 男",true);女 =new JRadioButton(" 女",false); group.add( 男 );group.add( 女 );開始修改 =new JButton("開始修改 ");錄入修改 =new JButton("錄入修改 ");錄入修改 .setEnabled(false);重置 =new JButton("重置 ")

25、;學(xué)號 .addActionListener(this);開始修改 .addActionListener(this);錄入修改 .addActionListener(this);重置 .addActionListener(this);Box box1=Box.createHorizontalBox();box1.add(new JLabel("輸入要修改信息的學(xué)號:",JLabel.CENTER);box1.add( 學(xué)號 );box1.add( 開始修改 );Box box2=Box.createHorizontalBox();box2.add(new JLabel(&q

26、uot;(新 )姓名 :",JLabel.CENTER);box2.add( 姓名 );.專業(yè)專注.Box box3=Box.createHorizontalBox();box3.add(new JLabel("(新 )性別 :",JLabel.CENTER);box3.add( 男 );box3.add( 女 );Box box4=Box.createHorizontalBox();box4.add(new JLabel("(新 )專業(yè) :",JLabel.CENTER);box4.add( 專業(yè) );Box box5=Box.createH

27、orizontalBox();box5.add(new JLabel("(新 )年級 :",JLabel.CENTER);box5.add( 年級 );Box box6=Box.createHorizontalBox();box6.add(new JLabel("(新 )出生 :",JLabel.CENTER);box6.add( 出生 );Box boxH=Box.createVerticalBox();boxH.add(box1);boxH.add(box2);boxH.add(box3);boxH.add(box4);boxH.add(box5);

28、boxH.add(box6);boxH.add(Box.createVerticalGlue();JPanel pCenter=new JPanel();.專業(yè)專注.pCenter.add(boxH);setLayout(new BorderLayout();add(pCenter,BorderLayout.CENTER);JPanel pSouth=new JPanel();pSouth.add( 錄入修改 );pSouth.add( 重置 );add(pSouth,BorderLayout.SOUTH);validate();public void actionPerformed(Acti

29、onEvent e)if(e.getSource()=開始修改 |e.getSource()=學(xué)號 )String number=""number=學(xué)號 .getText();if(number.length()>0)try inOne=new FileInputStream(file);inTwo=new ObjectInputStream(inOne);基本信息表 =(Hashtable)inTwo.readObject();.專業(yè)專注.inOne.close();inTwo.close();catch(Exception ee)if( 基本信息表 .contai

30、nsKey(number)錄入修改 .setEnabled(true);Student stu=(Student)基本信息表 .get(number);姓名 .setText(stu.getName();專業(yè) .setText(stu.getDisciping();年級 .setText(stu.getGrade();出生 .setText(stu.getBorth();if(stu.getSex().equals("男 ")男.setSelected(true);else女.setSelected(true);.專業(yè)專注.else錄入修改 .setEnabled(fals

31、e);String warning="該學(xué)號不存在 !"JOptionPane.showMessageDialog(this,warning,"警告",JOptionPane.WARNING_MESSAGE);學(xué)號 .setText(null);姓名 .setText(null);專業(yè) .setText(null);年級 .setText(null);出生 .setText(null);else錄入修改 .setEnabled(false);String warning="必須要輸入學(xué)號!"JOptionPane.showMessag

32、eDialog(this,warning,"警告.專業(yè)專注.",JOptionPane.WARNING_MESSAGE);學(xué)號 .setText(null);姓名 .setText(null);專業(yè) .setText(null);年級 .setText(null);出生 .setText(null);else if(e.getSource()=錄入修改 )String number=""number=學(xué)號 .getText();if(number.length()>0)try inOne=new FileInputStream(file);inTw

33、o=new ObjectInputStream(inOne);基本信息表 =(Hashtable)inTwo.readObject();inOne.close();inTwo.close();catch(Exception ee).專業(yè)專注.if( 基本信息表 .containsKey(number)Stringquestion="該生基本信息已存在,您想修改他(她 ) 的基本信息嗎?"JOptionPane.showMessageDialog(this,question,"警告",JOptionPane.QUESTION_MESSAGE);String

34、 m="基本信息將被修改!"intok=JOptionPane.showConfirmDialog(this,m,"確認(rèn)",JOptionPane.YES_NO_OPTION,JOptionPane.INFORMATION_MESSAGE);if(ok=JOptionPane.YES_OPTION)String name=姓名 .getText();String discipling=專業(yè) .getText();String grade=年級 .getText();String borth=出生 .getText();String sex=null;.專

35、業(yè)專注.if(男 .isSelected()sex= 男.getText();elsesex= 女.getText();Student學(xué)生 =new Student();學(xué)生 .setNumber(number);學(xué)生 .setName(name);學(xué)生 .setDiscipling(discipling);學(xué)生 .setGrade(grade);學(xué)生 .setBorth(borth);學(xué)生 .setSex(sex);tryoutOne=new FileOutputStream(file);outTwo=new ObjectOutputStream(outOne);基本信息表 .put(num

36、ber, 學(xué)生 );outTwo.writeObject(基本信息表 );outTwo.close();.專業(yè)專注.outOne.close();學(xué)號 .setText(null);姓名 .setText(null);專業(yè) .setText(null);年級 .setText(null);出生 .setText(null);catch(Exception ee)錄入修改 .setEnabled(false);else if(ok=JOptionPane.NO_OPTION)錄入修改 .setEnabled(true);elseString warning="該學(xué)號沒有基本信息,不能修

37、改 !".專業(yè)專注.JOptionPane.showMessageDialog(this,warning,"警告",JOptionPane.WARNING_MESSAGE);錄入修改 .setEnabled(false);elseString warning="必須要輸入學(xué)號!"JOptionPane.showMessageDialog(this,warning,"警告",JOptionPane.WARNING_MESSAGE);錄入修改 .setEnabled(false);if(e.getSource()=重置 )學(xué)號

38、.setText(null);姓名 .setText(null);專業(yè) .setText(null);年級 .setText(null);出生 .setText(null);.專業(yè)專注.package學(xué)籍管理系統(tǒng);/* To change this template, choose Tools | Templates* and open the template in the editor.*/* author Administrator*/*/private static final long serialVersionUID = 1L;.專業(yè)專注.String number,name,di

39、scipling,grade,borth,sex;public Student()public void setNumber(String number)this.number=number;public String getNumber()return number;public void setName(String name)=name;public String getName()return name;public void setDiscipling(String discipling).專業(yè)專注.this.discipling=discipling;public String getDisciping()return discipling;public void setGrade(String grade)this.grade=grade;public String getGrade()return grade;public void setBorth(String borth)this.borth=borth;public String getBorth()return borth;.專業(yè)專注.public

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論