java手动录入代码 java怎么手动输入字符串( 三 )


jLabel2 = new JLabel();
jLabel2.setBounds(new Rectangle(16, 108, 39, 18));
jLabel2.setText("专业:");
jLabel1 = new JLabel();
jLabel1.setBounds(new Rectangle(16, 66, 39, 18));
jLabel1.setText("性别:");
jLabel = new JLabel();
jLabel.setBounds(new Rectangle(16, 24, 39, 18));
jLabel.setText("姓名:");
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.add(jLabel, null);
jContentPane.add(jLabel1, null);
jContentPane.add(jLabel2, null);
jContentPane.add(jLabel3, null);
jContentPane.add(getJTextField(), null);
jContentPane.add(getJRadioButton(), null);
jContentPane.add(getJRadioButton1(), null);
mybg.add(jRadioButton);
mybg.add(jRadioButton1);
jContentPane.add(getJComboBox(), null);
jContentPane.add(getJComboBox1(), null);
jContentPane.add(getJButton(), null);
jContentPane.add(getJButton1(), null);
jContentPane.add(getJTextArea(), null);
}
return jContentPane;
}
/**
* This method initializes jTextField
*
* @return javax.swing.JTextField
*/
private JTextField getJTextField() {
if (jTextField == null) {
jTextField = new JTextField();
jTextField.setBounds(new Rectangle(61, 24, 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, 62, 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, 62, 38, 26));
jRadioButton1.setText("女");
}
return jRadioButton1;
}
/**
* This method initializes jComboBox
*
* @return javax.swing.JComboBox
*/
private JComboBox getJComboBox() {
if (jComboBox == null) {
String[] strcb={"计算机","电子","工商"};
jComboBox = new JComboBox(strcb);
jComboBox.setBounds(new Rectangle(62, 108, 93, 18));
}
return jComboBox;
}
/**
* This method initializes jComboBox1
*
* @return javax.swing.JComboBox
*/
private JComboBox getJComboBox1() {
if (jComboBox1 == null) {
String[] strcb2={"大专","本科","硕士","博士"};
jComboBox1 = new JComboBox(strcb2);
jComboBox1.setBounds(new Rectangle(92, 150, 125, 18));
}
return jComboBox1;
}
/**
* This method initializes jButton
*
* @return javax.swing.JButton
*/
private JButton getJButton() {
if (jButton == null) {
jButton = new JButton();
jButton.setBounds(new Rectangle(66, 181, 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(158, 181, 60, 28));

推荐阅读