jTextArea1.append(jComboBox1.getSelectedItem().toString()+"的"+jTextField1.getText()+"您好!\n"+
"您提交的个人信息如下\n"+"性别"+
a+"\n喜欢的明星"+
c+d+e+f+g+h+"\n"
里面核心内容如上
关于单选按钮,使用if判断
String a;
if(jRadioButton1.isSelected()){//单选框内容获取,好牛比
a=jRadioButton1.getText();
}
else{
a=jRadioButton2.getText();
}
但是有一个更简单的语句
jRadioButton1.isSelected()?jRadioButton1.getText():jRadioButton2.getText()
关于多选按钮,本来是可以使用数组批量判断,但是使用不来,于是使用笨方法,这是一种遗憾
String c="";
String d="";
String e="";
String f="";
String g="";
String h="";
if(jCheckBox1.isSelected()){//没有办法,实在找不出数组方法
c=jCheckBox1.getText();
}
if(jCheckBox2.isSelected()){
d=jCheckBox2.getText();
}
if(jCheckBox3.isSelected()){
e=jCheckBox3.getText();
}
if(jCheckBox4.isSelected()){
f=jCheckBox4.getText();
}
if(jCheckBox5.isSelected()){
g=jCheckBox5.getText();
}
if(jCheckBox6.isSelected()){
h=jCheckBox6.getText();
}