zoukankan      html  css  js  c++  java
  • java学生管理系统(GUI)第二个java文件(接上面的java程序,被调用的窗口)

    第二个被调用的窗口程序:

    /* 
    author:YuGuichun 
    fuction:student information manage 
    time:2011.5.28 
    */ 
    import javax.swing.*; 
     
    import java.awt.*; 
    import java.awt.event.*; 
    import java.util.Iterator; 
    import java.util.Vector; 
    public class SmainFrame extends JFrame  
    {  
          private JTextField number1,number2,number3,number4; 
          private ok ok1; 
          private cancel cancel1; 
           
          public SmainFrame() 
          { 
              
             super("学生成绩查询系统"); 
             setSize(300,200); 
            // setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 
             setVisible(true); 
             Container pane=getContentPane(); 
             FlowLayout flo=new FlowLayout(); 
             pane.setLayout(flo); 
              
              
             JLabel snumber1=new JLabel("输入姓名:",JLabel.CENTER); 
              number1=new JTextField(15); 
             JLabel sumber2=new JLabel("输入学号:",JLabel.CENTER); 
              number2=new JTextField(15); 
             JLabel snumber3=new JLabel("输入性别:",JLabel.CENTER); 
              number3=new JTextField(15); 
             JLabel snumber4=new JLabel("出生日期:",JLabel.CENTER); 
             number4=new JTextField(15); 
              
             JButton ok = new JButton("确定"); 
             JButton cancel = new JButton("取消"); 
              
             pane.add(snumber1); 
             pane.add(number1); 
             pane.add(sumber2); 
             pane.add(number2); 
             pane.add(snumber3); 
             pane.add(number3); 
             pane.add(snumber4); 
             pane.add(number4); 
              
             pane.add(ok); 
             pane.add(cancel); 
             ok ok2=new ok(); 
             cancel cancel2=new cancel(); 
             ok.addActionListener(ok2); 
             cancel.addActionListener(cancel2); 
                 
             setContentPane(pane); 
             setVisible(true); 
         } 
           
         private class ok implements ActionListener 
         { 
             public void actionPerformed(ActionEvent e) 
             { 
             String name=number1.getText(); 
             String number=number2.getText(); 
             String sex=number3.getText(); 
             String brithdate=number4.getText(); 
            // Work7_8 A=new Work7_8(); 
             Student s1=new Student(); 
             s1.setAll(name,Integer.parseInt(number),sex,Integer.parseInt(brithdate)); 
             number1.setText(null); 
             number2.setText(null); 
             number3.setText(null); 
             number4.setText(null); 
             allVector V=new allVector(); 
             V.addVector(s1);//这里应该会出错的,等下改改 
              
              
            /*if(V.vector.isEmpty()) 
                JOptionPane.showMessageDialog(null, "vector is empty"); 
            else  
                
                    String out="name    sex      num      age"+"\n"; 
                    Iterator<Student> items=V.vector.iterator(); 
                    while(items.hasNext()) 
                    
                        Student s2=items.next(); 
                    ] ]>

  • 相关阅读:
    Eclipse用法和技巧二十六:浅谈快捷键
    Eclipse用法和技巧二十五:eclipse图标的含义
    Eclipse用法和技巧二十四:当git遇上eclipse
    Eclipse用法和技巧二十三:查看JDK源码
    Eclipse用法和技巧二十二:快速调整字体大小
    Eclipse用法和技巧二十一:工程的展示途径
    94. Binary Tree Inorder Traversal
    110. Balanced Binary Tree
    595. Big Countries
    720. Longest Word in Dictionary(important!!!about sort)
  • 原文地址:https://www.cnblogs.com/cchun/p/2520105.html
Copyright © 2011-2022 走看看