当前位置:编程学习 > JAVA >>

求大师相助啊!修改一下录入信息的程序代码,不知道怎么引用各种控件啊

帮忙修改一下代码吧。。。实在不会了。。。
要实现学生信息录入功能,最顶一层要有登录、添加、查询、删除、更新、退出菜单选项,下面的编号、姓名、生日、住址、简历后面是文本框,婚否后面是个单选的按钮框
import java.awt.BorderLayout;


import javax.swing.*;

import java.awt.Dimension;

import java.awt.Rectangle;

public class MyLuRu extends JFrame {

 private static final long serialVersionUID = 1L;

 private JPanel jContentPane = null;


 private JLabel jLabel0 = null;
 
 private JLabel jLabel = null;

 private JLabel jLabel1 = null;

private JLabel jLabel4 = null;
 
 private JLabel jLabel5 = null;
 
 private JLabel jLabel2 = null;

 private JLabel jLabel6= null;
 private JLabel jLabel7 = null;
 private JTextField jTextField = null;

 private JRadioButton jRadioButton = null;

 private JRadioButton jRadioButton1 = null;
 private JRadioButton jRadioButton2=null;

 private JComboBox jComboBox = null;

 private JComboBox jComboBox1 = null;

 private JButton jButton = null;

 private JButton jButton1 = null;
 private JButton jButton2 = null;
 private JButton jButton3= null;
 

 private JTextArea jTextArea = null;

 private ButtonGroup mybg=new ButtonGroup();

 /**

  * This is the default constructor

  */

 public MyLuRu() {

  super();

  initialize();

 }

 /**

  * This method initializes this

  * 

  * @return void

  */

 private void initialize() {

  this.setSize(400, 600);

  this.setContentPane(getJContentPane());

  this.setTitle("录入");

  this.addWindowListener(new java.awt.event.WindowAdapter() {

   public void windowClosing(java.awt.event.WindowEvent e) {

    System.exit(0);

   }

  });

  this.setVisible(true);

 }

 /**

  * This method initializes jContentPane

  * 

  * @return javax.swing.JPanel

  */

 private JPanel getJContentPane() {

  if (jContentPane == null) {

  jLabel7 = new JLabel();

   jLabel7.setBounds(new Rectangle(16, 318, 39, 18));

   jLabel7.setText("简历:");
   jLabel6 = new JLabel();

   jLabel6.setBounds(new Rectangle(16, 276, 39, 18));

   jLabel6.setText("住址:");

   jLabel2 = new JLabel();

   jLabel2.setBounds(new Rectangle(16, 234, 39, 18));

   jLabel2.setText("籍贯:");
   
   jLabel5 = new JLabel();

   jLabel5.setBounds(new Rectangle(16,192, 39, 18));

   jLabel5.setText("婚否:");
   
   jLabel4 = new JLabel();

   jLabel4.setBounds(new Rectangle(16, 150, 39, 18));

   jLabel4.setText("生日:");

   jLabel1 = new JLabel();

   jLabel1.setBounds(new Rectangle(16, 108, 39, 18));

   jLabel1.setText("性别:");

   jLabel = new JLabel();

   jLabel.setBounds(new Rectangle(16, 66, 39, 18));

   jLabel.setText("姓名:");
   
   jLabel0 = new JLabel();

   jLabel0.setBounds(new Rectangle(16, 24, 39, 18));

   jLabel0.setText("编号:");

   jContentPane = new JPanel();

   jContentPane.setLayout(null);

   jContentPane.add(jLabel0, null);
   jContentPane.add(jLabel, null);

   jContentPane.add(jLabel1, null);

   jContentPane.add(jLabel2, null);

   jContentPane.add(jLabel4, null);
   jContentPane.add(jLabel5, null);
   jContentPane.add(jLabel6, null);
   jContentPane.add(jLabel7, null);
   

   jContentPane.add(getJTextField(), null);
   jContentPane.add(getJTextField0(), null);
   jContentPane.add(getJTextField4(), null);
   jContentPane.add(getJTextField6(), null);
   jContentPane.add(getJRadioButton(), null);

   jContentPane.add(getJRadioButton1(), null);
   

   mybg.add(jRadioButton);

   mybg.add(jRadioButton1);

   jContentPane.add(getJComboBox(), null);

   jContentPane.add(getJComboBox(), null);

   jContentPane.add(getJButton(), null);

   jContentPane.add(getJButton1(), null);

   jContentPane.add(getJTextArea(), null);   

  }

  return jContentPane;

 }

 private JTextField getJTextField0() {

  if (jTextField == null) {

   jTextField = new JTextField();

   jTextField.setBounds(new Rectangle(61, 24, 180, 18));

  }

  return jTextField;

 }
 
 private JTextField getJTextField() {

  if (jTextField == null) {

   jTextField = new JTextField();

   jTextField.setBounds(new Rectangle(61, 66, 180, 18));

  }

  return jTextField;

 }

 /**

  * This method initializes jRadioButton 

  *  

  * @return javax.swing.JRadioButton 

  */

 private JRadioButton getJRadioButton() {

  if (jRadioButton == null) {

   jRadioButton = new JRadioButton();

   jRadioButton.setBounds(new Rectangle(61, 108, 38, 26));

   jRadioButton.setText("男");

  }

  return jRadioButton;

 }

 /**

  * This method initializes jRadioButton1 

  *  

  * @return javax.swing.JRadioButton 

  */

 private JRadioButton getJRadioButton1() {

  if (jRadioButton1 == null) {

   jRadioButton1 = new JRadioButton();

   jRadioButton1.setBounds(new Rectangle(117, 108, 38, 26));

   jRadioButton1.setText("女");

  }

  return jRadioButton1;

 }

 /**

  * This method initializes jComboBox 

  *  

  * @return javax.swing.JComboBox 

  */

 private JTextField getJTextField4() {

  if (jTextField == null) {

   jTextField = new JTextField();

   jTextField.setBounds(new Rectangle(61, 150, 180, 18));

  }

  return jTextField;

 }
 
 private JRadioButton getJRadioButton2() {

  if (jRadioButton2 == null) {

   jRadioButton2 = new JRadioButton();

   jRadioButton2.setBounds(new Rectangle(62, 192, 38, 26));

   jRadioButton2.setText("");

  }

  return jRadioButton2;

 }
 
 private JComboBox getJComboBox() {

  if (jComboBox == null) {

   String[] strcb={"北京","上海","南京"};

   jComboBox = new JComboBox(strcb);

   jComboBox.setBounds(new Rectangle(62, 234, 93, 18));

  }

  return jComboBox;

 }

 /**

  * This method initializes jComboBox1 

  *  

  * @return javax.swing.JComboBox 

  */



 /**

  * This method initializes jButton 

  *  

  * @return javax.swing.JButton 

  */
 private JTextField getJTextField6() {

  if (jTextField == null) {

   jTextField = new JTextField();

   jTextField.setBounds(new Rectangle(61, 276, 180, 18));

  }

  return jTextField;

 }
 
 private JButton getJButton() {

  if (jButton == null) {

   jButton = new JButton();

   jButton.setBounds(new Rectangle(16, 481, 60, 28));

   jButton.setText("上一条");

   jButton.addActionListener(new java.awt.event.ActionListener() {

    public void actionPerformed(java.awt.event.ActionEvent e) {

     String strname=jTextField.getText();

     String strsex="男";

     if(jRadioButton1.isSelected()){

      strsex="女";

     }

     String strzy=jComboBox.getSelectedItem().toString();

     String strwh=jComboBox1.getSelectedItem().toString();

     jTextArea.setText("姓名:"+strname+"\r\n"+"性别:"+strsex+"\r\n"+"专业:"+strzy+"\r\n"+"文化:"+strwh);

    }

   });

  }

  return jButton;

 }

 /**

  * This method initializes jButton1 

  *  

  * @return javax.swing.JButton 

  */

 private JButton getJButton1() {

  if (jButton1 == null) {

   jButton1 = new JButton();

   jButton1.setBounds(new Rectangle(108, 481, 60, 28));

   jButton1.setText("下一条");

   jButton1.addActionListener(new java.awt.event.ActionListener() {

    public void actionPerformed(java.awt.event.ActionEvent e) {

     System.exit(0);

    }

   });

  }

  return jButton1;

 }
 
 private JButton getJButton2() {

  if (jButton2 == null) {

   jButton2 = new JButton();

   jButton2.setBounds(new Rectangle(200, 481, 60, 28));

   jButton2.setText("第一条");

   jButton2.addActionListener(new java.awt.event.ActionListener() {

    public void actionPerformed(java.awt.event.ActionEvent e) {

     System.exit(0);

    }

   });

  }

  return jButton2;

 }

 private JButton getJButton3() {

  if (jButton3 == null) {

   jButton3 = new JButton();

   jButton3.setBounds(new Rectangle(292, 481, 60, 28));

   jButton3.setText("末一条");

   jButton3.addActionListener(new java.awt.event.ActionListener() {

    public void actionPerformed(java.awt.event.ActionEvent e) {

     System.exit(0);

    }

   });

  }

  return jButton3;

 }
 /**

  * This method initializes jTextArea 

  *  

  * @return javax.swing.JTextArea 

  */

 private JTextArea getJTextArea() {

  if (jTextArea == null) {

   jTextArea = new JTextArea();

   jTextArea.setBounds(new Rectangle(60, 350, 229, 130));

  }

  return jTextArea;

 }

 public static void main(String args[]){

  new MyLuRu();

 }

补充:Java ,  Java相关
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,