用JavaSwing写一个小学生用的四则运算自测程序
来源:互联网 发布:暖气片不热 知乎 编辑:程序博客网 时间:2024/04/28 15:34
在下目前某理工科学校在读大二学生一枚,自学Java至今半年。因为学校程序设计实践周的缘故第一次完整写了一个个人感觉算是有点实际用处的程序。
由此进入登陆界面(写完之后感觉有点多此一举)
package examSystem;public class MainInterface {public static void main(String[] args) {UserLogin.login();}}
初始用户名:abc
初始密码 :123
package examSystem;import java.awt.Container;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JOptionPane;import javax.swing.JPasswordField;import javax.swing.JTextField;import javax.swing.UIManager;import javax.swing.plaf.FontUIResource;import java.awt.Font;public class UserLogin {/**登录跳转方法**/public static void login() { JFrame f = new JFrame("四则运算自测系统"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setVisible(true); //设置窗口的大小和位置 f.setSize(500,316); f.setLocation(420,120); Container container = f.getContentPane();container.setLayout(null);JLabel label_userName = new JLabel("用户名: ");label_userName.setFont(new Font("宋体", Font.PLAIN, 30));label_userName.setBounds(54, 15, 137, 45);container.add(label_userName);JTextField textField_userName = new JTextField();textField_userName.setFont(new Font("宋体", Font.PLAIN, 26));textField_userName.setBounds(195, 21, 223, 29);container.add(textField_userName);JLabel label_password = new JLabel("密码 : ");label_password.setFont(new Font("宋体", Font.PLAIN, 30));label_password.setBounds(54, 63, 126, 29);container.add(label_password);JPasswordField passwordField_password = new JPasswordField();passwordField_password.setFont(new Font("宋体", Font.PLAIN, 26));passwordField_password.setBounds(195, 63, 223, 29);container.add(passwordField_password);//登录按钮 设定用户名:abc;密码:123JButton button_log = new JButton("登录");button_log.setFont(new Font("宋体", Font.PLAIN, 26));button_log.setBounds(107, 149, 100, 59);container.add(button_log);button_log.addActionListener(new ActionListener() {@Overridepublic void actionPerformed(ActionEvent arg0) {//用户名或密码为空情况if (textField_userName.getText().trim().length() == 0 || new String(passwordField_password.getPassword()).trim().length() == 0) {OptionPane.showMessage("用户名和密码不能为空");return;}//用户名与密码符合if (textField_userName.getText().trim().equals("abc")&&new String(passwordField_password.getPassword()).trim().equals("123")) {f.dispose(); //关闭当前登录界面Settings.settings(); //跳转到设置界面return;}//用户名和密码错误情况else { OptionPane.showMessage("用户名或密码错误"); return;}}});JButton button_reset = new JButton("重置");button_reset.setFont(new Font("宋体", Font.PLAIN, 26));button_reset.setBounds(292, 149, 100, 59);container.add(button_reset);button_reset.addActionListener(new ActionListener() {@Overridepublic void actionPerformed(ActionEvent e) {textField_userName.setText("");passwordField_password.setText("");}});} //void loginpublic static void main(String[] args) {login();}}
报错提示:
系统自带的那个optionPane字太小,设置了一气发现还是不管用于是就自己写了一个用于报错的界面
package examSystem;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JButton;import java.awt.Font;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;public class OptionPane {public static void showMessage(String message) {JFrame f = new JFrame("出错信息");f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setVisible(true); f.getContentPane().setLayout(null); JLabel label_message = new JLabel(message); label_message.setFont(new Font("宋体", Font.PLAIN, 30)); label_message.setBounds(82, 75, 445, 92); f.getContentPane().add(label_message); JButton button_confirm = new JButton("确认"); button_confirm.setFont(new Font("宋体", Font.PLAIN, 40)); button_confirm.setBounds(-12, 220, 609, 84); f.getContentPane().add(button_confirm); f.setBounds(50, 50, 608, 360); button_confirm.addActionListener(new ActionListener() {@Overridepublic void actionPerformed(ActionEvent e) {f.dispose();}}); }public static void main(String[] args) { showMessage("");}}
设置界面:
设置难度以及每种题型的数量
package examSystem;import java.awt.Container;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JLabel;import java.awt.Font;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.JComboBox;import javax.swing.DefaultComboBoxModel;import javax.swing.JTextField;import javax.swing.JTextArea;import java.awt.Color;public class Settings {protected static String m_modeOption; //难度模式protected static int m_blankAmount; //填空题数protected static int m_choiceAmount; //选择题数protected static int m_judgeAmount; //判断题数private static JTextField textField_notice;/**设置界面**/public static void settings() {JFrame f = new JFrame("设置");f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setVisible(true); f.getContentPane().setLayout(null); f.setBounds(50, 50, 800, 500); Container container = f.getContentPane(); JLabel label_mode = new JLabel("难度"); label_mode.setFont(new Font("宋体", Font.PLAIN, 30)); label_mode.setEnabled(false); label_mode.setBounds(79, 84, 67, 59); container.add(label_mode); //难度选择 JComboBox comboBox_mode = new JComboBox(); comboBox_mode.setFont(new Font("宋体", Font.PLAIN, 30)); String [] modeOption = {" ", "简单", "困难"}; comboBox_mode.setModel(new DefaultComboBoxModel(modeOption)); comboBox_mode.setBounds(56, 158, 109, 47); container.add(comboBox_mode); JLabel lable_blank = new JLabel("填空题"); lable_blank.setFont(new Font("宋体", Font.PLAIN, 25)); lable_blank.setBounds(295, 105, 81, 21); container.add(lable_blank); JLabel label_choice = new JLabel("选择题"); label_choice.setFont(new Font("宋体", Font.PLAIN, 25)); label_choice.setBounds(295, 216, 81, 21); container.add(label_choice); JLabel label_judge = new JLabel("判断题"); label_judge.setFont(new Font("宋体", Font.PLAIN, 25)); label_judge.setBounds(295, 325, 81, 21); container.add(label_judge); JLabel label_amount = new JLabel("题目数量"); label_amount.setFont(new Font("宋体", Font.PLAIN, 25)); label_amount.setBounds(430, 41, 100, 27); container.add(label_amount); //题目数量选择 String [] amountOption = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10"}; JComboBox comboBox_balnk = new JComboBox(); comboBox_balnk.setFont(new Font("宋体", Font.PLAIN, 25)); comboBox_balnk.setEditable(false); comboBox_balnk.setModel(new DefaultComboBoxModel(amountOption)); comboBox_balnk.setBounds(421, 99, 109, 27); container.add(comboBox_balnk); JComboBox comboBox_choice = new JComboBox(); comboBox_choice.setFont(new Font("宋体", Font.PLAIN, 25)); comboBox_choice.setEditable(false); comboBox_choice.setModel(new DefaultComboBoxModel(amountOption)); comboBox_choice.setBounds(421, 215, 109, 27); container.add(comboBox_choice); JComboBox comboBox_judge = new JComboBox(); comboBox_judge.setFont(new Font("宋体", Font.PLAIN, 25)); comboBox_judge.setEditable(false); comboBox_judge.setModel(new DefaultComboBoxModel(amountOption)); comboBox_judge.setBounds(421, 324, 109, 27); container.add(comboBox_judge); JButton button_confirm = new JButton("确认"); button_confirm.setFont(new Font("宋体", Font.PLAIN, 25)); button_confirm.setBounds(0, 397, 400, 47); button_confirm.addActionListener(new ActionListener() {@Overridepublic void actionPerformed(ActionEvent arg0) {m_modeOption = (String) comboBox_mode.getSelectedItem(); //获得难度模式m_blankAmount = Integer.parseInt(comboBox_balnk.getSelectedItem().toString()); //获得填空题数量m_choiceAmount = Integer.parseInt(comboBox_choice.getSelectedItem().toString()); //获得选择题数量m_judgeAmount = Integer.parseInt(comboBox_judge.getSelectedItem().toString()); //获得判断题数量f.dispose();if (comboBox_mode.getSelectedItem().equals("简单")) {EasyFillBlank.doFillBlank(); //跳转至简单填空题页面}if (comboBox_mode.getSelectedItem().equals("困难")) {HardFillBlank.doFillBlank(); //跳转至困难填空题页面}return ;}}); container.add(button_confirm); JButton button_reset = new JButton("重置"); button_reset.setFont(new Font("宋体", Font.PLAIN, 25)); button_reset.setBounds(389, 397, 400, 47); button_reset.addActionListener(new ActionListener() {@Overridepublic void actionPerformed(ActionEvent e) {comboBox_mode.setSelectedItem(" ");comboBox_balnk.setSelectedItem("0");comboBox_choice.setSelectedItem("0");comboBox_judge.setSelectedItem("0");}}); container.add(button_reset); JTextArea textArea_notice2 = new JTextArea("注意:\n 请务必点击\n 完提交后再\n 进入下一题"); textArea_notice2.setBackground(Color.WHITE); textArea_notice2.setFont(new Font("Monospaced", Font.PLAIN, 28)); textArea_notice2.setEditable(false); textArea_notice2.setBounds(555, 90, 174, 203); f.getContentPane().add(textArea_notice2); } //void settings() public static void main(String[] args) {settings();}}//class Settings
简单填空题:
每道题分三个textField模块,题目显示、答题、对错实时显示
package examSystem;import javax.swing.JFrame;import javax.swing.JTextField;import javax.swing.JButton;import java.awt.Font;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.text.DecimalFormat;import java.util.Random;public class EasyFillBlank { protected static int m_score = 0; //填空题得分 protected static int m_totalBlank = Settings.m_blankAmount; //填空题总分 protected static JTextField textField_question0;protected static JTextField textField_answer0;protected static JTextField textField_question1;protected static JTextField textField_answer1;protected static JTextField textField_question2;protected static JTextField textField_answer2;protected static JTextField textField_question3;protected static JTextField textField_answer3;protected static JTextField textField_question4;protected static JTextField textField_answer4;protected static JTextField textField_question5;protected static JTextField textField_answer5;protected static JTextField textField_question6;protected static JTextField textField_answer6;protected static JTextField textField_question7;protected static JTextField textField_answer7;protected static JTextField textField_question8;protected static JTextField textField_answer8;protected static JTextField textField_question9;protected static JTextField textField_answer9;protected static JButton button_submit;protected static JButton button_redo;protected static JTextField textField_feedback;protected static JTextField textField_judge0;protected static JTextField textField_judge1;protected static JTextField textField_judge2;protected static JTextField textField_judge3;protected static JTextField textField_judge4;protected static JTextField textField_judge5;protected static JTextField textField_judge6;protected static JTextField textField_judge7;protected static JTextField textField_judge8;protected static JTextField textField_judge9;protected static JButton button_next;protected static int m_right0;protected static int m_right1;protected static int m_right2;protected static int m_right3;protected static int m_right4;protected static int m_right5;protected static int m_right6;protected static int m_right7;protected static int m_right8;protected static int m_right9;public static void doFillBlank() {JFrame f = new JFrame("填空题");f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setVisible(true); f.getContentPane().setLayout(null); f.setBounds(50, 50, 858, 516); /************************ 题干所用随机数 *******************************/ Random random = new Random(); //int number = random.nextInt(max)%(max-min+1) + min int x0 = random.nextInt(10)%(11); //x0为0到10之间的整数 int y0 = random.nextInt(10)%(11); //y0为0到10之间的整数 int x1 = random.nextInt(100)%(81) + 20; //x1为20到100之间的整数 int y1 = random.nextInt(100)%(81) + 20; //y1为20到100之间的整数 int x2 = random.nextInt(1000)%(901) + 100; //x2为100到1000之间的整数 int y2 = random.nextInt(1000)%(901) + 100; //y2为100到1000之间的整数 int x3 = random.nextInt(20)%(11) + 10; //x3为10到20之间的整数 int y3 = random.nextInt(10)%(11); //y3为0到10之间的整数 int x4 = random.nextInt(50)%(51) + 50; //x4为50到100之间的整数 int y4 = random.nextInt(30)%(31) + 20; //y4为20到50之间的整数 int x5 = random.nextInt(10)%(11); //x5为0到10之间的整数 int y5 = random.nextInt(10)%(11); //y5为0到10之间的整数 int x6 = random.nextInt(100)%(81) + 20 - 1; //x6为20到99之间的整数 int y6 = random.nextInt(100)%(81) + 20 - 1; //y6为20到99之间的整数 int x7 = random.nextInt(100)%(81) + 20 - 1; //x7为20到99之间的整数 int y7 = random.nextInt(100)%(81) + 20 - 1; //y7为20到99之间的整数 int x8 = random.nextInt(10)%(10) + 1; //x8为1到10之间的整数 int times8 = random.nextInt(10)%(10) + 1; //times8代表1到10倍 int y8 = x8 * times8; //y8为x8的整数倍 int x9 = random.nextInt(20)%(11) + 10; //x9为10到20之间的整数 int times9 = random.nextInt(30)%(21) + 10; //times9代表10到30倍 int y9 = x9 * times9; //y9为x9的整数倍 /************************ 问题栏 *******************************/ textField_question0 = new JTextField(); textField_question0.setText(" " + String.valueOf(x0) + " + " + String.valueOf(y0) + " = "); textField_question0.setFont(new Font("宋体", Font.PLAIN, 30)); textField_question0.setEditable(false); textField_question0.setBounds(15, 45, 171, 41); textField_question0.setColumns(1); f.getContentPane().add(textField_question0); textField_question1 = new JTextField(); textField_question1.setText(String.valueOf(x1) + " + " + String.valueOf(y1) + " = "); textField_question1.setFont(new Font("宋体", Font.PLAIN, 30)); textField_question1.setEditable(false); textField_question1.setColumns(1); textField_question1.setBounds(15, 115, 171, 41); f.getContentPane().add(textField_question1); textField_question2 = new JTextField(); textField_question2.setText(String.valueOf(x2) + "+" + String.valueOf(y2) + " = "); textField_question2.setFont(new Font("宋体", Font.PLAIN, 30)); textField_question2.setEditable(false); textField_question2.setColumns(1); textField_question2.setBounds(15, 185, 171, 41); f.getContentPane().add(textField_question2); textField_question3 = new JTextField(); textField_question3.setText(" " + String.valueOf(x3) + " - " + String.valueOf(y3) + " = "); textField_question3.setFont(new Font("宋体", Font.PLAIN, 30)); textField_question3.setEditable(false); textField_question3.setColumns(1); textField_question3.setBounds(15, 255, 171, 41); f.getContentPane().add(textField_question3); textField_question4 = new JTextField(); textField_question4.setText(String.valueOf(x4) + " - " + String.valueOf(y4) + " = "); textField_question4.setFont(new Font("宋体", Font.PLAIN, 30)); textField_question4.setEditable(false); textField_question4.setColumns(1); textField_question4.setBounds(15, 325, 171, 41); f.getContentPane().add(textField_question4); textField_question5 = new JTextField(); textField_question5.setText(" " + String.valueOf(x5) + " × " + String.valueOf(y5) + " = "); textField_question5.setFont(new Font("宋体", Font.PLAIN, 30)); textField_question5.setEditable(false); textField_question5.setColumns(1); textField_question5.setBounds(414, 45, 171, 41); f.getContentPane().add(textField_question5); textField_question6 = new JTextField(); textField_question6.setText(String.valueOf(x6) + " × " + String.valueOf(y6) + " = "); textField_question6.setFont(new Font("宋体", Font.PLAIN, 30)); textField_question6.setEditable(false); textField_question6.setColumns(1); textField_question6.setBounds(414, 115, 171, 41); f.getContentPane().add(textField_question6); textField_question7 = new JTextField(); textField_question7.setText(String.valueOf(x7) + " × " + String.valueOf(y7) + " = "); textField_question7.setFont(new Font("宋体", Font.PLAIN, 30)); textField_question7.setEditable(false); textField_question7.setColumns(1); textField_question7.setBounds(414, 185, 171, 41); f.getContentPane().add(textField_question7); textField_question8 = new JTextField(); textField_question8.setText(" " + String.valueOf(y8) + " ÷ " + String.valueOf(x8) + " = "); textField_question8.setFont(new Font("宋体", Font.PLAIN, 30)); textField_question8.setEditable(false); textField_question8.setColumns(1); textField_question8.setBounds(414, 255, 171, 41); f.getContentPane().add(textField_question8); textField_question9 = new JTextField(); textField_question9.setText(" " + String.valueOf(y9) + "÷" + String.valueOf(x9) + " = "); textField_question9.setFont(new Font("宋体", Font.PLAIN, 30)); textField_question9.setEditable(false); textField_question9.setColumns(1); textField_question9.setBounds(414, 325, 171, 41); f.getContentPane().add(textField_question9); /************************ 问题栏 *******************************/ /************************ 答题栏 *******************************/ textField_answer0 = new JTextField(); textField_answer0.setFont(new Font("宋体", Font.PLAIN, 30)); textField_answer0.setBounds(184, 45, 141, 41); f.getContentPane().add(textField_answer0); textField_answer0.setColumns(1); textField_answer1 = new JTextField(); textField_answer1.setFont(new Font("宋体", Font.PLAIN, 30)); textField_answer1.setColumns(1); textField_answer1.setBounds(184, 115, 141, 41); f.getContentPane().add(textField_answer1); textField_answer2 = new JTextField(); textField_answer2.setFont(new Font("宋体", Font.PLAIN, 30)); textField_answer2.setColumns(1); textField_answer2.setBounds(184, 185, 141, 41); f.getContentPane().add(textField_answer2); textField_answer3 = new JTextField(); textField_answer3.setFont(new Font("宋体", Font.PLAIN, 30)); textField_answer3.setColumns(1); textField_answer3.setBounds(184, 255, 141, 41); f.getContentPane().add(textField_answer3); textField_answer4 = new JTextField(); textField_answer4.setFont(new Font("宋体", Font.PLAIN, 30)); textField_answer4.setColumns(1); textField_answer4.setBounds(184, 325, 141, 41); f.getContentPane().add(textField_answer4); textField_answer5 = new JTextField(); textField_answer5.setFont(new Font("宋体", Font.PLAIN, 30)); textField_answer5.setColumns(1); textField_answer5.setBounds(583, 45, 141, 41); f.getContentPane().add(textField_answer5); textField_answer6 = new JTextField(); textField_answer6.setFont(new Font("宋体", Font.PLAIN, 30)); textField_answer6.setColumns(1); textField_answer6.setBounds(583, 115, 141, 41); f.getContentPane().add(textField_answer6); textField_answer7 = new JTextField(); textField_answer7.setFont(new Font("宋体", Font.PLAIN, 30)); textField_answer7.setColumns(1); textField_answer7.setBounds(583, 185, 141, 41); f.getContentPane().add(textField_answer7); textField_answer8 = new JTextField(); textField_answer8.setFont(new Font("宋体", Font.PLAIN, 30)); textField_answer8.setColumns(1); textField_answer8.setBounds(583, 255, 141, 41); f.getContentPane().add(textField_answer8); textField_answer9 = new JTextField(); textField_answer9.setFont(new Font("宋体", Font.PLAIN, 30)); textField_answer9.setColumns(1); textField_answer9.setBounds(583, 325, 141, 41); f.getContentPane().add(textField_answer9); /************************ 答题栏 *******************************/ /************************ 判断框 *******************************/ textField_judge0 = new JTextField(); textField_judge0.setFont(new Font("宋体", Font.PLAIN, 25)); textField_judge0.setEditable(false); textField_judge0.setBounds(324, 45, 41, 41); f.getContentPane().add(textField_judge0); textField_judge0.setColumns(10); textField_judge1 = new JTextField(); textField_judge1.setFont(new Font("宋体", Font.PLAIN, 25)); textField_judge1.setEditable(false); textField_judge1.setColumns(10); textField_judge1.setBounds(324, 115, 41, 41); f.getContentPane().add(textField_judge1); textField_judge2 = new JTextField(); textField_judge2.setFont(new Font("宋体", Font.PLAIN, 25)); textField_judge2.setEditable(false); textField_judge2.setColumns(10); textField_judge2.setBounds(324, 185, 41, 41); f.getContentPane().add(textField_judge2); textField_judge3 = new JTextField(); textField_judge3.setFont(new Font("宋体", Font.PLAIN, 25)); textField_judge3.setEditable(false); textField_judge3.setColumns(10); textField_judge3.setBounds(324, 255, 41, 41); f.getContentPane().add(textField_judge3); textField_judge4 = new JTextField(); textField_judge4.setFont(new Font("宋体", Font.PLAIN, 25)); textField_judge4.setEditable(false); textField_judge4.setColumns(10); textField_judge4.setBounds(324, 325, 41, 41); f.getContentPane().add(textField_judge4); textField_judge5 = new JTextField(); textField_judge5.setFont(new Font("宋体", Font.PLAIN, 25)); textField_judge5.setEditable(false); textField_judge5.setColumns(10); textField_judge5.setBounds(723, 45, 41, 41); f.getContentPane().add(textField_judge5); textField_judge6 = new JTextField(); textField_judge6.setFont(new Font("宋体", Font.PLAIN, 25)); textField_judge6.setEditable(false); textField_judge6.setColumns(10); textField_judge6.setBounds(723, 115, 41, 41); f.getContentPane().add(textField_judge6); textField_judge7 = new JTextField(); textField_judge7.setFont(new Font("宋体", Font.PLAIN, 25)); textField_judge7.setEditable(false); textField_judge7.setColumns(10); textField_judge7.setBounds(723, 185, 41, 41); f.getContentPane().add(textField_judge7); textField_judge8 = new JTextField(); textField_judge8.setFont(new Font("宋体", Font.PLAIN, 25)); textField_judge8.setEditable(false); textField_judge8.setColumns(10); textField_judge8.setBounds(723, 255, 41, 41); f.getContentPane().add(textField_judge8); textField_judge9 = new JTextField(); textField_judge9.setFont(new Font("宋体", Font.PLAIN, 25)); textField_judge9.setEditable(false); textField_judge9.setColumns(10); textField_judge9.setBounds(723, 325, 41, 41); f.getContentPane().add(textField_judge9); /************************ 判断框 *******************************/ /**根据题量掩盖一定题目**/ switch (m_totalBlank) {case 0:f.dispose();EasyChoice.doChoice();break;case 1:textField_question9.setVisible(false);textField_answer9.setVisible(false);textField_judge9.setVisible(false);textField_question8.setVisible(false);textField_answer8.setVisible(false);textField_judge8.setVisible(false);textField_question7.setVisible(false);textField_answer7.setVisible(false);textField_judge7.setVisible(false);textField_question6.setVisible(false);textField_answer6.setVisible(false);textField_judge6.setVisible(false);textField_question5.setVisible(false);textField_answer5.setVisible(false);textField_judge5.setVisible(false);textField_question4.setVisible(false);textField_answer4.setVisible(false);textField_judge4.setVisible(false);textField_question3.setVisible(false);textField_answer3.setVisible(false);textField_judge3.setVisible(false);textField_question2.setVisible(false);textField_answer2.setVisible(false);textField_judge2.setVisible(false);textField_question1.setVisible(false);textField_answer1.setVisible(false);textField_judge1.setVisible(false);break;case 2:textField_question9.setVisible(false);textField_answer9.setVisible(false);textField_judge9.setVisible(false);textField_question8.setVisible(false);textField_answer8.setVisible(false);textField_judge8.setVisible(false);textField_question7.setVisible(false);textField_answer7.setVisible(false);textField_judge7.setVisible(false);textField_question6.setVisible(false);textField_answer6.setVisible(false);textField_judge6.setVisible(false);textField_question4.setVisible(false);textField_answer4.setVisible(false);textField_judge4.setVisible(false);textField_question3.setVisible(false);textField_answer3.setVisible(false);textField_judge3.setVisible(false);textField_question2.setVisible(false);textField_answer2.setVisible(false);textField_judge2.setVisible(false);textField_question1.setVisible(false);textField_answer1.setVisible(false);textField_judge1.setVisible(false);break;case 3:textField_question9.setVisible(false);textField_answer9.setVisible(false);textField_judge9.setVisible(false);textField_question8.setVisible(false);textField_answer8.setVisible(false);textField_judge8.setVisible(false);textField_question7.setVisible(false);textField_answer7.setVisible(false);textField_judge7.setVisible(false);textField_question6.setVisible(false);textField_answer6.setVisible(false);textField_judge6.setVisible(false);textField_question4.setVisible(false);textField_answer4.setVisible(false);textField_judge4.setVisible(false);textField_question3.setVisible(false);textField_answer3.setVisible(false);textField_judge3.setVisible(false);textField_question2.setVisible(false);textField_answer2.setVisible(false);textField_judge2.setVisible(false);break;case 4:textField_question9.setVisible(false);textField_answer9.setVisible(false);textField_judge9.setVisible(false);textField_question8.setVisible(false);textField_answer8.setVisible(false);textField_judge8.setVisible(false);textField_question7.setVisible(false);textField_answer7.setVisible(false);textField_judge7.setVisible(false);textField_question4.setVisible(false);textField_answer4.setVisible(false);textField_judge4.setVisible(false);textField_question3.setVisible(false);textField_answer3.setVisible(false);textField_judge3.setVisible(false);textField_question2.setVisible(false);textField_answer2.setVisible(false);textField_judge2.setVisible(false);break;case 5:textField_question9.setVisible(false);textField_answer9.setVisible(false);textField_judge9.setVisible(false);textField_question8.setVisible(false);textField_answer8.setVisible(false);textField_judge8.setVisible(false);textField_question7.setVisible(false);textField_answer7.setVisible(false);textField_judge7.setVisible(false);textField_question4.setVisible(false);textField_answer4.setVisible(false);textField_judge4.setVisible(false);textField_question3.setVisible(false);textField_answer3.setVisible(false);textField_judge3.setVisible(false);break;case 6:textField_question9.setVisible(false);textField_answer9.setVisible(false);textField_judge9.setVisible(false);textField_question8.setVisible(false);textField_answer8.setVisible(false);textField_judge8.setVisible(false);textField_question4.setVisible(false);textField_answer4.setVisible(false);textField_judge4.setVisible(false);textField_question3.setVisible(false);textField_answer3.setVisible(false);textField_judge3.setVisible(false);break;case 7:textField_question9.setVisible(false);textField_answer9.setVisible(false);textField_judge9.setVisible(false);textField_question8.setVisible(false);textField_answer8.setVisible(false);textField_judge8.setVisible(false);textField_question4.setVisible(false);textField_answer4.setVisible(false);textField_judge4.setVisible(false);break;case 8:textField_question9.setVisible(false);textField_answer9.setVisible(false);textField_judge9.setVisible(false);textField_question4.setVisible(false);textField_answer4.setVisible(false);textField_judge4.setVisible(false);break;case 9:textField_question9.setVisible(false);textField_answer9.setVisible(false);textField_judge9.setVisible(false);break; case 10:break;} //提交并判定分数 button_submit = new JButton("提交"); button_submit.setFont(new Font("宋体", Font.PLAIN, 30)); button_submit.setBounds(25, 385, 102, 48); button_submit.addActionListener(new ActionListener() { //对了则分数加一分且判断框中显示“√”,错了则不加分且判断框中显示“×”@Overridepublic void actionPerformed(ActionEvent e) {m_score = 0; //便于反复提交,每次提交则得分先清零然后再统计新的得分,避免正确率累加if (textField_answer0.getText().equals(String.valueOf(x0+y0))) {m_score ++; textField_judge0.setText("√"); }else {textField_judge0.setText("×");}m_right0 = x0 + y0;if (textField_answer1.getText().equals(String.valueOf(x1+y1))) {m_score ++; textField_judge1.setText("√"); }else {textField_judge1.setText("×");}m_right1 = x1 + y1;if (textField_answer2.getText().equals(String.valueOf(x2+y2))) {m_score ++; textField_judge2.setText("√"); }else {textField_judge2.setText("×");}m_right2 = x2 + y2;if (textField_answer3.getText().equals(String.valueOf(x3-y3))) {m_score ++; textField_judge3.setText("√"); }else {textField_judge3.setText("×");}m_right3 = x3 - y3;if (textField_answer4.getText().equals(String.valueOf(x4-y4))) {m_score ++; textField_judge4.setText("√"); }else {textField_judge4.setText("×");}m_right4 = x4- y4;if (textField_answer5.getText().equals(String.valueOf(x5*y5))) {m_score ++; textField_judge5.setText("√"); }else {textField_judge5.setText("×");}m_right5 = x5 * y5;if (textField_answer6.getText().equals(String.valueOf(x6*y6))) {m_score ++; textField_judge6.setText("√"); }else {textField_judge6.setText("×");}m_right6 = x6 * y6;if (textField_answer7.getText().equals(String.valueOf(x7*y7))) {m_score ++; textField_judge7.setText("√"); }else {textField_judge7.setText("×");}m_right7 = x7 * y7;if (textField_answer8.getText().equals(String.valueOf(times8))) {m_score ++; textField_judge8.setText("√"); }else {textField_judge8.setText("×");}m_right8 = times8;if (textField_answer9.getText().equals(String.valueOf(times9))) {m_score ++; textField_judge9.setText("√"); }else {textField_judge9.setText("×");}m_right9 = times9;double temp1 = (double)m_score / (double)m_totalBlank * 100;DecimalFormat df = new DecimalFormat("#.00"); //正确率只保留小数点后两位 String accuracy = df.format(temp1);textField_feedback.setText(" 填空题正确率: " + accuracy + "%");}}); f.getContentPane().add(button_submit); //重写操作 button_redo = new JButton("重做"); button_redo.setFont(new Font("宋体", Font.PLAIN, 30)); button_redo.setBounds(153, 385, 102, 48); button_redo.addActionListener(new ActionListener() {@Override //所有答题区域和判断区域清空public void actionPerformed(ActionEvent e) {textField_answer0.setText("");textField_answer1.setText("");textField_answer2.setText("");textField_answer3.setText("");textField_answer4.setText("");textField_answer5.setText("");textField_answer6.setText("");textField_answer7.setText("");textField_answer8.setText("");textField_answer9.setText("");textField_judge0.setText("");textField_judge1.setText("");textField_judge2.setText("");textField_judge3.setText("");textField_judge4.setText("");textField_judge5.setText("");textField_judge6.setText("");textField_judge7.setText("");textField_judge8.setText("");textField_judge9.setText("");textField_feedback.setText("");m_score = 0; //得分归零}}); f.getContentPane().add(button_redo); textField_feedback = new JTextField(); textField_feedback.setFont(new Font("宋体", Font.PLAIN, 30)); textField_feedback.setBounds(440, 385, 381, 64); textField_feedback.setEditable(false); f.getContentPane().add(textField_feedback); textField_feedback.setColumns(1); //点击进入选择题 button_next = new JButton("下一题"); button_next.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { f.dispose(); EasyChoice.doChoice(); } }); button_next.setFont(new Font("宋体", Font.PLAIN, 30)); button_next.setBounds(284, 385, 141, 48); f.getContentPane().add(button_next); } //doFillBlank public static void main(String[] args) {doFillBlank();}}
简单选择题:
package examSystem;import javax.swing.JFrame;import javax.swing.JPanel;import javax.swing.JTextField;import javax.swing.JRadioButton;import java.awt.Font;import javax.swing.JLabel;import javax.swing.SwingConstants;import javax.swing.JButton;import java.awt.event.ActionListener;import java.text.DecimalFormat;import java.util.Random;import java.awt.event.ActionEvent;public class EasyChoice {protected static int m_score = 0; //选择题得分 protected static int m_totalChoice = Settings.m_choiceAmount; //选择题总分 protected static JTextField textField_question1;protected static JTextField textField_question2;protected static JTextField textField_judge1;protected static JTextField textField_judge2;protected static JTextField textField_question3;protected static JTextField textField_judge3;protected static JTextField textField_question4;protected static JTextField textField_judge4;protected static JTextField textField_question5;protected static JTextField textField_judge5;protected static JTextField textField_question6;protected static JTextField textField_judge6;protected static JTextField textField_question7;protected static JTextField textField_judge7;protected static JTextField textField_question8;protected static JTextField textField_judge8;protected static JTextField textField_question9;protected static JTextField textField_judge9;protected static JTextField textField_question10;protected static JTextField textField_judge10;protected static JTextField textField_feedback;protected static int m_right1;protected static int m_right2;protected static int m_right3;protected static int m_right4;protected static int m_right5;protected static int m_right6;protected static int m_right7;protected static int m_right8;protected static int m_right9;protected static int m_right10;protected static String m_rightOption1;protected static String m_rightOption2;protected static String m_rightOption3;protected static String m_rightOption4;protected static String m_rightOption5;protected static String m_rightOption6;protected static String m_rightOption7;protected static String m_rightOption8;protected static String m_rightOption9;protected static String m_rightOption10;public static void doChoice() { JFrame f = new JFrame("选择题");f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setVisible(true); f.getContentPane().setLayout(null); /************************ 题干所用随机数 *******************************/ Random random = new Random(); //int number = random.nextInt(max)%(max-min+1) + min int x1 = random.nextInt(10)%(11); //x1为0到10之间的整数 int y1 = random.nextInt(10)%(11); //y1为0到10之间的整数 m_right1 = x1 + y1; int x2 = random.nextInt(10)%(11); //x2为0到10之间的整数 int y2 = random.nextInt(10)%(11); //y2为0到10之间的整数 m_right2 = x2 + y2; int x3 = random.nextInt(10)%(11); //x3为0到10之间的整数 int y3 = random.nextInt(10)%(11); //y3为0到10之间的整数 m_right3 = x3 + y3; int x4 = random.nextInt(20)%(11) + 10; //x4为10到20之间的整数 int y4 = random.nextInt(10)%(11); //y4为0到10之间的整数 m_right4 = x4 - y4; int x5 = random.nextInt(100)%(51) + 50; //x5为50到100之间的整数 int y5 = random.nextInt(50)%(31) + 20; //y5为20到50之间的整数 m_right5 = x5 - y5; int x6 = random.nextInt(10)%(11); //x6为0到10之间的整数 int y6 = random.nextInt(10)%(11); //y6为0到10之间的整数 m_right6 = x6 * y6; int x7 = random.nextInt(10)%(11); //x7为0到10之间的整数 int y7 = random.nextInt(10)%(11); //y7为0到10之间的整数 m_right7 = x7 * y7; int x8 = random.nextInt(10)%(11); //x8为0到10之间的整数 int y8 = random.nextInt(10)%(11); //y8为0到10之间的整数 m_right8 = x8 * y8; int x9 = random.nextInt(10)%(10) + 1; //x9为1到10之间的整数 int times9 = random.nextInt(10)%(10) + 1; //times9代表1到10倍 int y9 = x9 * times9; //y8为x8的整数倍 m_right9 = times9; int x10 = random.nextInt(20)%(11) + 10; //x10为10到20之间的整数 int times10 = random.nextInt(30)%(21) + 10; //times10代表10到30倍 int y10 = x10 * times10; //y10为x10的整数倍 m_right10 = times10; /**************************第一题*********************************/ JPanel panel_1 = new JPanel(); panel_1.setBounds(0, 0, 857, 86); f.getContentPane().add(panel_1); panel_1.setLayout(null); textField_question1 = new JTextField(" " + String.valueOf(x1) + " + " + String.valueOf(y1) + " = "); textField_question1.setFont(new Font("宋体", Font.PLAIN, 30)); textField_question1.setEditable(false); textField_question1.setBounds(15, 24, 216, 47); panel_1.add(textField_question1); textField_question1.setColumns(10); JRadioButton radioButton_A1 = new JRadioButton("A. "); radioButton_A1.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_A1.setBounds(275, 31, 100, 29); panel_1.add(radioButton_A1); JRadioButton radioButton_B1 = new JRadioButton("B. "); radioButton_B1.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_B1.setBounds(375, 31, 93, 29); panel_1.add(radioButton_B1); JRadioButton radioButton_C1 = new JRadioButton("C. "); radioButton_C1.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_C1.setBounds(475, 31, 93, 29); panel_1.add(radioButton_C1); JRadioButton radioButton_D1 = new JRadioButton("D. "); radioButton_D1.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_D1.setBounds(575, 31, 123, 29); panel_1.add(radioButton_D1); m_rightOption1 = randomSetRight(radioButton_A1, radioButton_B1, radioButton_C1, radioButton_D1, m_right1); textField_judge1 = new JTextField(); textField_judge1.setFont(new Font("宋体", Font.PLAIN, 40)); textField_judge1.setEditable(false); textField_judge1.setBounds(720, 15, 50, 50); panel_1.add(textField_judge1); textField_judge1.setColumns(10); JLabel lable_number1 = new JLabel("\u2460"); lable_number1.setFont(new Font("宋体", Font.PLAIN, 30)); lable_number1.setHorizontalAlignment(SwingConstants.TRAILING); lable_number1.setBounds(785, 23, 40, 40); panel_1.add(lable_number1); /**************************第一题*********************************/ /**************************第二题*********************************/ JPanel panel_2 = new JPanel(); panel_2.setLayout(null); panel_2.setBounds(0, 80, 857, 86); f.getContentPane().add(panel_2); textField_question2 = new JTextField(" " + String.valueOf(x2) + " + " + String.valueOf(y2) + " = "); textField_question2.setFont(new Font("宋体", Font.PLAIN, 30)); textField_question2.setEditable(false); textField_question2.setColumns(10); textField_question2.setBounds(15, 24, 216, 47); panel_2.add(textField_question2); JRadioButton radioButton_A2 = new JRadioButton("A. "); radioButton_A2.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_A2.setBounds(275, 31, 99, 29); panel_2.add(radioButton_A2); JRadioButton radioButton_B2 = new JRadioButton("B. "); radioButton_B2.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_B2.setBounds(375, 31, 104, 29); panel_2.add(radioButton_B2); JRadioButton radioButton_C2 = new JRadioButton("C. "); radioButton_C2.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_C2.setBounds(475, 31, 99, 29); panel_2.add(radioButton_C2); JRadioButton radioButton_D2 = new JRadioButton("D. "); radioButton_D2.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_D2.setBounds(575, 31, 117, 29); panel_2.add(radioButton_D2); m_rightOption2 = randomSetRight(radioButton_A2, radioButton_B2, radioButton_C2, radioButton_D2, m_right2); textField_judge2 = new JTextField(); textField_judge2.setFont(new Font("宋体", Font.PLAIN, 40)); textField_judge2.setEditable(false); textField_judge2.setColumns(10); textField_judge2.setBounds(720, 15, 50, 50); panel_2.add(textField_judge2); JLabel label_number2 = new JLabel("\u2461"); label_number2.setHorizontalAlignment(SwingConstants.TRAILING); label_number2.setFont(new Font("宋体", Font.PLAIN, 30)); label_number2.setBounds(785, 23, 40, 40); panel_2.add(label_number2); /**************************第二题*********************************/ /**************************第三题*********************************/ JPanel panel_3 = new JPanel(); panel_3.setLayout(null); panel_3.setBounds(0, 160, 857, 86); f.getContentPane().add(panel_3); textField_question3 = new JTextField(" " + String.valueOf(x3) + " + " + String.valueOf(y3) + " = "); textField_question3.setFont(new Font("宋体", Font.PLAIN, 30)); textField_question3.setEditable(false); textField_question3.setColumns(10); textField_question3.setBounds(15, 20, 216, 47); panel_3.add(textField_question3); JRadioButton radioButton_A3 = new JRadioButton("A. "); radioButton_A3.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_A3.setBounds(275, 31, 100, 29); panel_3.add(radioButton_A3); JRadioButton radioButton_B3 = new JRadioButton("B. "); radioButton_B3.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_B3.setBounds(375, 31, 93, 29); panel_3.add(radioButton_B3); JRadioButton radioButton_C3 = new JRadioButton("C. "); radioButton_C3.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_C3.setBounds(475, 31, 93, 29); panel_3.add(radioButton_C3); JRadioButton radioButton_D3 = new JRadioButton("D. "); radioButton_D3.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_D3.setBounds(575, 31, 123, 29); panel_3.add(radioButton_D3); m_rightOption3 = randomSetRight(radioButton_A3, radioButton_B3, radioButton_C3, radioButton_D3, m_right3); textField_judge3 = new JTextField(); textField_judge3.setFont(new Font("宋体", Font.PLAIN, 40)); textField_judge3.setEditable(false); textField_judge3.setColumns(10); textField_judge3.setBounds(720, 15, 50, 50); panel_3.add(textField_judge3); JLabel label_number3 = new JLabel("\u2462"); label_number3.setHorizontalAlignment(SwingConstants.TRAILING); label_number3.setFont(new Font("宋体", Font.PLAIN, 30)); label_number3.setBounds(785, 23, 40, 40); panel_3.add(label_number3); /**************************第三题*********************************/ /**************************第四题*********************************/ JPanel panel_4 = new JPanel(); panel_4.setLayout(null); panel_4.setBounds(0, 240, 857, 86); f.getContentPane().add(panel_4); textField_question4 = new JTextField(" " + String.valueOf(x4) + " - " + String.valueOf(y4) + " = "); textField_question4.setFont(new Font("宋体", Font.PLAIN, 30)); textField_question4.setEditable(false); textField_question4.setColumns(10); textField_question4.setBounds(15, 24, 216, 47); panel_4.add(textField_question4); JRadioButton radioButton_A4 = new JRadioButton("A. "); radioButton_A4.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_A4.setBounds(275, 31, 100, 29); panel_4.add(radioButton_A4); JRadioButton radioButton_B4 = new JRadioButton("B. "); radioButton_B4.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_B4.setBounds(375, 31, 93, 29); panel_4.add(radioButton_B4); JRadioButton radioButton_C4 = new JRadioButton("C. "); radioButton_C4.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_C4.setBounds(475, 31, 93, 29); panel_4.add(radioButton_C4); JRadioButton radioButton_D4 = new JRadioButton("D. "); radioButton_D4.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_D4.setBounds(575, 31, 123, 29); panel_4.add(radioButton_D4); m_rightOption4 = randomSetRight(radioButton_A4, radioButton_B4, radioButton_C4, radioButton_D4, m_right4); textField_judge4 = new JTextField(); textField_judge4.setFont(new Font("宋体", Font.PLAIN, 40)); textField_judge4.setEditable(false); textField_judge4.setColumns(10); textField_judge4.setBounds(720, 15, 50, 50); panel_4.add(textField_judge4); JLabel label_number4 = new JLabel("\u2463"); label_number4.setHorizontalAlignment(SwingConstants.TRAILING); label_number4.setFont(new Font("宋体", Font.PLAIN, 30)); label_number4.setBounds(785, 23, 40, 40); panel_4.add(label_number4); /**************************第四题*********************************/ /**************************第五题*********************************/ JPanel panel_5 = new JPanel(); panel_5.setLayout(null); panel_5.setBounds(0, 320, 857, 86); f.getContentPane().add(panel_5); textField_question5 = new JTextField(" " + String.valueOf(x5) + " - " + String.valueOf(y5) + " = "); textField_question5.setFont(new Font("宋体", Font.PLAIN, 29)); textField_question5.setEditable(false); textField_question5.setColumns(10); textField_question5.setBounds(15, 24, 216, 47); panel_5.add(textField_question5); JRadioButton radioButton_A5 = new JRadioButton("A. "); radioButton_A5.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_A5.setBounds(275, 31, 100, 29); panel_5.add(radioButton_A5); JRadioButton radioButton_B5 = new JRadioButton("B. "); radioButton_B5.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_B5.setBounds(375, 31, 93, 29); panel_5.add(radioButton_B5); JRadioButton radioButton_C5 = new JRadioButton("C. "); radioButton_C5.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_C5.setBounds(475, 31, 93, 29); panel_5.add(radioButton_C5); JRadioButton radioButton_D5 = new JRadioButton("D. "); radioButton_D5.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_D5.setBounds(575, 31, 123, 29); panel_5.add(radioButton_D5); m_rightOption5 = randomSetRight(radioButton_A5, radioButton_B5, radioButton_C5, radioButton_D5, m_right5); textField_judge5 = new JTextField(); textField_judge5.setFont(new Font("宋体", Font.PLAIN, 40)); textField_judge5.setEditable(false); textField_judge5.setColumns(10); textField_judge5.setBounds(720, 15, 50, 50); panel_5.add(textField_judge5); JLabel label_number5 = new JLabel("\u2464"); label_number5.setHorizontalAlignment(SwingConstants.TRAILING); label_number5.setFont(new Font("宋体", Font.PLAIN, 30)); label_number5.setBounds(785, 23, 40, 40); panel_5.add(label_number5); /**************************第五题*********************************/ /**************************第六题*********************************/ JPanel panel_6 = new JPanel(); panel_6.setLayout(null); panel_6.setBounds(0, 400, 857, 86); f.getContentPane().add(panel_6); textField_question6 = new JTextField(" " + String.valueOf(x6) + " × " + String.valueOf(y6) + " = "); textField_question6.setFont(new Font("宋体", Font.PLAIN, 29)); textField_question6.setEditable(false); textField_question6.setColumns(10); textField_question6.setBounds(15, 24, 216, 47); panel_6.add(textField_question6); JRadioButton radioButton_A6 = new JRadioButton("A. "); radioButton_A6.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_A6.setBounds(275, 31, 100, 29); panel_6.add(radioButton_A6); JRadioButton radioButton_B6 = new JRadioButton("B. "); radioButton_B6.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_B6.setBounds(375, 31, 93, 29); panel_6.add(radioButton_B6); JRadioButton radioButton_C6 = new JRadioButton("C. "); radioButton_C6.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_C6.setBounds(475, 31, 93, 29); panel_6.add(radioButton_C6); JRadioButton radioButton_D6 = new JRadioButton("D. "); radioButton_D6.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_D6.setBounds(575, 31, 123, 29); panel_6.add(radioButton_D6); m_rightOption6 = randomSetRight(radioButton_A6, radioButton_B6, radioButton_C6, radioButton_D6, m_right6); textField_judge6 = new JTextField(); textField_judge6.setFont(new Font("宋体", Font.PLAIN, 40)); textField_judge6.setEditable(false); textField_judge6.setColumns(10); textField_judge6.setBounds(720, 15, 50, 50); panel_6.add(textField_judge6); JLabel label_number6 = new JLabel("\u2465"); label_number6.setHorizontalAlignment(SwingConstants.TRAILING); label_number6.setFont(new Font("宋体", Font.PLAIN, 30)); label_number6.setBounds(785, 23, 40, 40); panel_6.add(label_number6); /**************************第六题*********************************/ /**************************第七题*********************************/ JPanel panel_7 = new JPanel(); panel_7.setLayout(null); panel_7.setBounds(0, 480, 857, 86); f.getContentPane().add(panel_7); textField_question7 = new JTextField(" " + String.valueOf(x7) + " × " + String.valueOf(y7) + " = "); textField_question7.setFont(new Font("宋体", Font.PLAIN, 29)); textField_question7.setEditable(false); textField_question7.setColumns(10); textField_question7.setBounds(15, 24, 216, 47); panel_7.add(textField_question7); JRadioButton radioButton_A7 = new JRadioButton("A. "); radioButton_A7.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_A7.setBounds(275, 31, 100, 29); panel_7.add(radioButton_A7); JRadioButton radioButton_B7 = new JRadioButton("B. "); radioButton_B7.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_B7.setBounds(375, 31, 93, 29); panel_7.add(radioButton_B7); JRadioButton radioButton_C7 = new JRadioButton("C. "); radioButton_C7.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_C7.setBounds(475, 31, 93, 29); panel_7.add(radioButton_C7); JRadioButton radioButton_D7 = new JRadioButton("D. "); radioButton_D7.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_D7.setBounds(575, 31, 123, 29); panel_7.add(radioButton_D7); m_rightOption7 = randomSetRight(radioButton_A7, radioButton_B7, radioButton_C7, radioButton_D7, m_right7); textField_judge7 = new JTextField(); textField_judge7.setFont(new Font("宋体", Font.PLAIN, 40)); textField_judge7.setEditable(false); textField_judge7.setColumns(10); textField_judge7.setBounds(720, 15, 50, 50); panel_7.add(textField_judge7); JLabel label_number7 = new JLabel("\u2466"); label_number7.setHorizontalAlignment(SwingConstants.TRAILING); label_number7.setFont(new Font("宋体", Font.PLAIN, 30)); label_number7.setBounds(785, 23, 40, 40); panel_7.add(label_number7); /**************************第七题*********************************/ /**************************第八题*********************************/ JPanel panel_8 = new JPanel(); panel_8.setLayout(null); panel_8.setBounds(0, 560, 857, 86); f.getContentPane().add(panel_8); textField_question8 = new JTextField(" " + String.valueOf(x8) + " × " + String.valueOf(y8) + " = "); textField_question8.setFont(new Font("宋体", Font.PLAIN, 29)); textField_question8.setEditable(false); textField_question8.setColumns(10); textField_question8.setBounds(15, 24, 216, 47); panel_8.add(textField_question8); JRadioButton radioButton_A8 = new JRadioButton("A. "); radioButton_A8.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_A8.setBounds(275, 31, 100, 29); panel_8.add(radioButton_A8); JRadioButton radioButton_B8 = new JRadioButton("B. "); radioButton_B8.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_B8.setBounds(375, 31, 93, 29); panel_8.add(radioButton_B8); JRadioButton radioButton_C8 = new JRadioButton("C. "); radioButton_C8.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_C8.setBounds(475, 31, 93, 29); panel_8.add(radioButton_C8); JRadioButton radioButton_D8 = new JRadioButton("D. "); radioButton_D8.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_D8.setBounds(575, 31, 123, 29); panel_8.add(radioButton_D8); m_rightOption8 = randomSetRight(radioButton_A8, radioButton_B8, radioButton_C8, radioButton_D8, m_right8); textField_judge8 = new JTextField(); textField_judge8.setFont(new Font("宋体", Font.PLAIN, 40)); textField_judge8.setEditable(false); textField_judge8.setColumns(10); textField_judge8.setBounds(720, 15, 50, 50); panel_8.add(textField_judge8); JLabel label_number8 = new JLabel("\u2467"); label_number8.setHorizontalAlignment(SwingConstants.TRAILING); label_number8.setFont(new Font("宋体", Font.PLAIN, 30)); label_number8.setBounds(785, 23, 40, 40); panel_8.add(label_number8); /**************************第八题*********************************/ /**************************第九题*********************************/ JPanel panel_9 = new JPanel(); panel_9.setLayout(null); panel_9.setBounds(0, 640, 857, 86); f.getContentPane().add(panel_9); textField_question9 = new JTextField(" " + String.valueOf(y9) + " ÷ " + String.valueOf(x9) + " = "); textField_question9.setFont(new Font("宋体", Font.PLAIN, 28)); textField_question9.setEditable(false); textField_question9.setColumns(10); textField_question9.setBounds(15, 24, 216, 47); panel_9.add(textField_question9); JRadioButton radioButton_A9 = new JRadioButton("A. "); radioButton_A9.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_A9.setBounds(275, 31, 100, 29); panel_9.add(radioButton_A9); JRadioButton radioButton_B9 = new JRadioButton("B. "); radioButton_B9.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_B9.setBounds(375, 31, 100, 29); panel_9.add(radioButton_B9); JRadioButton radioButton_C9 = new JRadioButton("C. "); radioButton_C9.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_C9.setBounds(475, 31, 100, 29); panel_9.add(radioButton_C9); JRadioButton radioButton_D9 = new JRadioButton("D. "); radioButton_D9.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_D9.setBounds(575, 31, 123, 29); panel_9.add(radioButton_D9); m_rightOption9 = randomSetRight(radioButton_A9, radioButton_B9, radioButton_C9, radioButton_D9, m_right9); textField_judge9 = new JTextField(); textField_judge9.setFont(new Font("宋体", Font.PLAIN, 40)); textField_judge9.setEditable(false); textField_judge9.setColumns(10); textField_judge9.setBounds(720, 15, 50, 50); panel_9.add(textField_judge9); JLabel label_number9 = new JLabel("\u2468"); label_number9.setHorizontalAlignment(SwingConstants.TRAILING); label_number9.setFont(new Font("宋体", Font.PLAIN, 30)); label_number9.setBounds(785, 23, 40, 40); panel_9.add(label_number9); /**************************第九题*********************************/ /**************************第十题*********************************/ JPanel panel_10 = new JPanel(); panel_10.setLayout(null); panel_10.setBounds(0, 720, 857, 86); f.getContentPane().add(panel_10); textField_question10 = new JTextField(" " + String.valueOf(y10) + " ÷ " + String.valueOf(x10) + " = "); textField_question10.setFont(new Font("宋体", Font.PLAIN, 28)); textField_question10.setEditable(false); textField_question10.setColumns(10); textField_question10.setBounds(15, 24, 216, 47); panel_10.add(textField_question10); JRadioButton radioButton_A10 = new JRadioButton("A. "); radioButton_A10.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_A10.setBounds(275, 31, 100, 29); panel_10.add(radioButton_A10); JRadioButton radioButton_B10 = new JRadioButton("B. "); radioButton_B10.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_B10.setBounds(375, 31, 93, 29); panel_10.add(radioButton_B10); JRadioButton radioButton_C10 = new JRadioButton("C. "); radioButton_C10.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_C10.setBounds(475, 31, 93, 29); panel_10.add(radioButton_C10); JRadioButton radioButton_D10 = new JRadioButton("D. "); radioButton_D10.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_D10.setBounds(575, 31, 123, 29); panel_10.add(radioButton_D10); m_rightOption10 = randomSetRight(radioButton_A10, radioButton_B10, radioButton_C10, radioButton_D10, m_right10); textField_judge10 = new JTextField(); textField_judge10.setFont(new Font("宋体", Font.PLAIN, 40)); textField_judge10.setEditable(false); textField_judge10.setColumns(10); textField_judge10.setBounds(720, 15, 50, 50); panel_10.add(textField_judge10); JLabel label_number10 = new JLabel("\u2469"); label_number10.setHorizontalAlignment(SwingConstants.TRAILING); label_number10.setFont(new Font("宋体", Font.PLAIN, 30)); label_number10.setBounds(785, 23, 40, 40); panel_10.add(label_number10); /**************************第十题*********************************/ textField_feedback = new JTextField(); textField_feedback.setEditable(false); textField_feedback.setFont(new Font("宋体", Font.PLAIN, 30)); textField_feedback.setBounds(443, 851, 376, 125); f.getContentPane().add(textField_feedback); textField_feedback.setColumns(10); /*根据题数隐藏相应题目*/ switch (m_totalChoice) {case 0:f.dispose();EasyJudge.doJudge();break;case 1:panel_10.setVisible(false);panel_9.setVisible(false);panel_8.setVisible(false);panel_7.setVisible(false);panel_6.setVisible(false);panel_5.setVisible(false);panel_4.setVisible(false);panel_3.setVisible(false);panel_2.setVisible(false);break;case 2:panel_10.setVisible(false);panel_9.setVisible(false);panel_8.setVisible(false);panel_7.setVisible(false);panel_6.setVisible(false);panel_5.setVisible(false);panel_4.setVisible(false);panel_3.setVisible(false);break;case 3:panel_10.setVisible(false);panel_9.setVisible(false);panel_8.setVisible(false);panel_7.setVisible(false);panel_6.setVisible(false);panel_5.setVisible(false);panel_4.setVisible(false);break;case 4:panel_10.setVisible(false);panel_9.setVisible(false);panel_8.setVisible(false);panel_7.setVisible(false);panel_6.setVisible(false);panel_5.setVisible(false);break;case 5:panel_10.setVisible(false);panel_9.setVisible(false);panel_8.setVisible(false);panel_7.setVisible(false);panel_6.setVisible(false);break;case 6:panel_10.setVisible(false);panel_9.setVisible(false);panel_8.setVisible(false);panel_7.setVisible(false);break;case 7:panel_10.setVisible(false);panel_9.setVisible(false);panel_8.setVisible(false);break;case 8:panel_10.setVisible(false);panel_9.setVisible(false);break;case 9:panel_10.setVisible(false);break;case 10:break;} //对了则分数加一分且判断框中显示“√”,错了则不加分且判断框中显示“×” JButton button_submit = new JButton("提交"); button_submit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { m_score = 0; //便于反复提交,每次提交则得分先清零然后再统计新的得分,避免正确率累加 /******第1题判断********/ switch (m_rightOption1) {case "A":if (radioButton_A1.isSelected() && !radioButton_B1.isSelected() && !radioButton_C1.isSelected() && !radioButton_D1.isSelected()) {m_score ++; textField_judge1.setText("√");}else {textField_judge1.setText("×");}break;case "B":if (!radioButton_A1.isSelected() && radioButton_B1.isSelected() && !radioButton_C1.isSelected() && !radioButton_D1.isSelected()) {m_score ++; textField_judge1.setText("√");}else {textField_judge1.setText("×");}break;case "C":if (!radioButton_A1.isSelected() && !radioButton_B1.isSelected() && radioButton_C1.isSelected() && !radioButton_D1.isSelected()) {m_score ++; textField_judge1.setText("√");}else {textField_judge1.setText("×");}break;case "D":if (!radioButton_A1.isSelected() && !radioButton_B1.isSelected() && !radioButton_C1.isSelected() && radioButton_D1.isSelected()) {m_score ++; textField_judge1.setText("√");}else {textField_judge1.setText("×");}break;default:textField_judge1.setText("×");break;} /******第1题判断********/ /******第2题判断********/ switch (m_rightOption2) {case "A":if (radioButton_A2.isSelected() && !radioButton_B2.isSelected() && !radioButton_C2.isSelected() && !radioButton_D2.isSelected()) {m_score ++; textField_judge2.setText("√");}else {textField_judge2.setText("×");}break;case "B":if (!radioButton_A2.isSelected() && radioButton_B2.isSelected() && !radioButton_C2.isSelected() && !radioButton_D2.isSelected()) {m_score ++; textField_judge2.setText("√");}else {textField_judge2.setText("×");}break;case "C":if (!radioButton_A2.isSelected() && !radioButton_B2.isSelected() && radioButton_C2.isSelected() && !radioButton_D2.isSelected()) {m_score ++; textField_judge2.setText("√");}else {textField_judge2.setText("×");}break;case "D":if (!radioButton_A2.isSelected() && !radioButton_B2.isSelected() && !radioButton_C2.isSelected() && radioButton_D2.isSelected()) {m_score ++; textField_judge2.setText("√");}else {textField_judge2.setText("×");}break;} /******第2题判断********/ /******第3题判断********/ switch (m_rightOption3) {case "A":if (radioButton_A3.isSelected() && !radioButton_B3.isSelected() && !radioButton_C3.isSelected() && !radioButton_D3.isSelected()) {m_score ++; textField_judge3.setText("√");}else {textField_judge3.setText("×");}break;case "B":if (!radioButton_A3.isSelected() && radioButton_B3.isSelected() && !radioButton_C3.isSelected() && !radioButton_D3.isSelected()) {m_score ++; textField_judge3.setText("√");}else {textField_judge3.setText("×");}break;case "C":if (!radioButton_A3.isSelected() && !radioButton_B3.isSelected() && radioButton_C3.isSelected() && !radioButton_D3.isSelected()) {m_score ++; textField_judge3.setText("√");}else {textField_judge3.setText("×");}break;case "D":if (!radioButton_A3.isSelected() && !radioButton_B3.isSelected() && !radioButton_C3.isSelected() && radioButton_D3.isSelected()) {m_score ++; textField_judge3.setText("√");}else {textField_judge3.setText("×");}break;} /******第3题判断********/ /******第4题判断********/ switch (m_rightOption4) {case "A":if (radioButton_A4.isSelected() && !radioButton_B4.isSelected() && !radioButton_C4.isSelected() && !radioButton_D4.isSelected()) {m_score ++; textField_judge4.setText("√");}else {textField_judge4.setText("×");}break;case "B":if (!radioButton_A4.isSelected() && radioButton_B4.isSelected() && !radioButton_C4.isSelected() && !radioButton_D4.isSelected()) {m_score ++; textField_judge4.setText("√");}else {textField_judge4.setText("×");}break;case "C":if (!radioButton_A4.isSelected() && !radioButton_B4.isSelected() && radioButton_C4.isSelected() && !radioButton_D4.isSelected()) {m_score ++; textField_judge4.setText("√");}else {textField_judge4.setText("×");}break;case "D":if (!radioButton_A4.isSelected() && !radioButton_B4.isSelected() && !radioButton_C4.isSelected() && radioButton_D4.isSelected()) {m_score ++; textField_judge4.setText("√");}else {textField_judge4.setText("×");}break;} /******第4题判断********/ /******第5题判断********/ switch (m_rightOption5) {case "A":if (radioButton_A5.isSelected() && !radioButton_B5.isSelected() && !radioButton_C5.isSelected() && !radioButton_D5.isSelected()) {m_score ++; textField_judge5.setText("√");}else {textField_judge5.setText("×");}break;case "B":if (!radioButton_A5.isSelected() && radioButton_B5.isSelected() && !radioButton_C5.isSelected() && !radioButton_D5.isSelected()) {m_score ++; textField_judge5.setText("√");}else {textField_judge5.setText("×");}break;case "C":if (!radioButton_A5.isSelected() && !radioButton_B5.isSelected() && radioButton_C5.isSelected() && !radioButton_D5.isSelected()) {m_score ++; textField_judge5.setText("√");}else {textField_judge5.setText("×");}break;case "D":if (!radioButton_A5.isSelected() && !radioButton_B5.isSelected() && !radioButton_C5.isSelected() && radioButton_D5.isSelected()) {m_score ++; textField_judge5.setText("√");}else {textField_judge5.setText("×");}break;} /******第5题判断********/ /******第6题判断********/ switch (m_rightOption6) {case "A":if (radioButton_A6.isSelected() && !radioButton_B6.isSelected() && !radioButton_C6.isSelected() && !radioButton_D6.isSelected()) {m_score ++; textField_judge6.setText("√");}else {textField_judge6.setText("×");}break;case "B":if (!radioButton_A6.isSelected() && radioButton_B6.isSelected() && !radioButton_C6.isSelected() && !radioButton_D6.isSelected()) {m_score ++; textField_judge6.setText("√");}else {textField_judge6.setText("×");}break;case "C":if (!radioButton_A6.isSelected() && !radioButton_B6.isSelected() && radioButton_C6.isSelected() && !radioButton_D6.isSelected()) {m_score ++; textField_judge6.setText("√");}else {textField_judge6.setText("×");}break;case "D":if (!radioButton_A6.isSelected() && !radioButton_B6.isSelected() && !radioButton_C6.isSelected() && radioButton_D6.isSelected()) {m_score ++; textField_judge6.setText("√");}else {textField_judge6.setText("×");}break;} /******第6题判断********/ /******第7题判断********/ switch (m_rightOption7) {case "A":if (radioButton_A7.isSelected() && !radioButton_B7.isSelected() && !radioButton_C7.isSelected() && !radioButton_D7.isSelected()) {m_score ++; textField_judge7.setText("√");}else {textField_judge7.setText("×");}break;case "B":if (!radioButton_A7.isSelected() && radioButton_B7.isSelected() && !radioButton_C7.isSelected() && !radioButton_D7.isSelected()) {m_score ++; textField_judge7.setText("√");}else {textField_judge7.setText("×");}break;case "C":if (!radioButton_A7.isSelected() && !radioButton_B7.isSelected() && radioButton_C7.isSelected() && !radioButton_D7.isSelected()) {m_score ++; textField_judge7.setText("√");}else {textField_judge7.setText("×");}break;case "D":if (!radioButton_A7.isSelected() && !radioButton_B7.isSelected() && !radioButton_C7.isSelected() && radioButton_D7.isSelected()) {m_score ++; textField_judge7.setText("√");}else {textField_judge7.setText("×");}break;} /******第7题判断********/ /******第8题判断********/ switch (m_rightOption8) {case "A":if (radioButton_A8.isSelected() && !radioButton_B8.isSelected() && !radioButton_C8.isSelected() && !radioButton_D8.isSelected()) {m_score ++; textField_judge8.setText("√");}else {textField_judge8.setText("×");}break;case "B":if (!radioButton_A8.isSelected() && radioButton_B8.isSelected() && !radioButton_C8.isSelected() && !radioButton_D8.isSelected()) {m_score ++; textField_judge8.setText("√");}else {textField_judge8.setText("×");}break;case "C":if (!radioButton_A8.isSelected() && !radioButton_B8.isSelected() && radioButton_C8.isSelected() && !radioButton_D8.isSelected()) {m_score ++; textField_judge8.setText("√");}else {textField_judge8.setText("×");}break;case "D":if (!radioButton_A8.isSelected() && !radioButton_B8.isSelected() && !radioButton_C8.isSelected() && radioButton_D8.isSelected()) {m_score ++; textField_judge8.setText("√");}else {textField_judge8.setText("×");}break;} /******第8题判断********/ /******第9题判断********/ switch (m_rightOption9) {case "A":if (radioButton_A9.isSelected() && !radioButton_B9.isSelected() && !radioButton_C9.isSelected() && !radioButton_D9.isSelected()) {m_score ++; textField_judge9.setText("√");}else {textField_judge9.setText("×");}break;case "B":if (!radioButton_A9.isSelected() && radioButton_B9.isSelected() && !radioButton_C9.isSelected() && !radioButton_D9.isSelected()) {m_score ++; textField_judge9.setText("√");}else {textField_judge9.setText("×");}break;case "C":if (!radioButton_A9.isSelected() && !radioButton_B9.isSelected() && radioButton_C9.isSelected() && !radioButton_D9.isSelected()) {m_score ++; textField_judge9.setText("√");}else {textField_judge9.setText("×");}break;case "D":if (!radioButton_A9.isSelected() && !radioButton_B9.isSelected() && !radioButton_C9.isSelected() && radioButton_D9.isSelected()) {m_score ++; textField_judge9.setText("√");}else {textField_judge9.setText("×");}break;} /******第9题判断********/ /******第10题判断********/ switch (m_rightOption10) {case "A":if (radioButton_A10.isSelected() && !radioButton_B10.isSelected() && !radioButton_C10.isSelected() && !radioButton_D10.isSelected()) {m_score ++; textField_judge10.setText("√");}else {textField_judge10.setText("×");}break;case "B":if (!radioButton_A10.isSelected() && radioButton_B10.isSelected() && !radioButton_C10.isSelected() && !radioButton_D10.isSelected()) {m_score ++; textField_judge10.setText("√");}else {textField_judge10.setText("×");}break;case "C":if (!radioButton_A10.isSelected() && !radioButton_B10.isSelected() && radioButton_C10.isSelected() && !radioButton_D10.isSelected()) {m_score ++; textField_judge10.setText("√");}else {textField_judge10.setText("×");}break;case "D":if (!radioButton_A10.isSelected() && !radioButton_B10.isSelected() && !radioButton_C10.isSelected() && radioButton_D10.isSelected()) {m_score ++; textField_judge10.setText("√");}else {textField_judge10.setText("×");}break;} /******第10题判断********/ double temp1 = (double)m_score / (double)m_totalChoice * 100;DecimalFormat df = new DecimalFormat("#.00"); //正确率只保留小数点后两位 String accuracy = df.format(temp1);textField_feedback.setText(" 选择题正确率: " + accuracy + "%"); } }); button_submit.setFont(new Font("宋体", Font.PLAIN, 30)); button_submit.setBounds(63, 880, 123, 57); f.getContentPane().add(button_submit); JButton button_next = new JButton("下一题"); button_next.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (radioButton_A1.isSelected()) {FeedBack.m_choice1.append(" A");} if (radioButton_B1.isSelected()) {FeedBack.m_choice1.append(" B");} if (radioButton_C1.isSelected()) {FeedBack.m_choice1.append(" C");} if (radioButton_D1.isSelected()) {FeedBack.m_choice1.append(" D");} if (radioButton_A2.isSelected()) {FeedBack.m_choice2.append(" A");} if (radioButton_B2.isSelected()) {FeedBack.m_choice2.append(" B");} if (radioButton_C2.isSelected()) {FeedBack.m_choice2.append(" C");} if (radioButton_D2.isSelected()) {FeedBack.m_choice2.append(" D");} if (radioButton_A3.isSelected()) {FeedBack.m_choice3.append(" A");} if (radioButton_B3.isSelected()) {FeedBack.m_choice3.append(" B");} if (radioButton_C3.isSelected()) {FeedBack.m_choice3.append(" C");} if (radioButton_D3.isSelected()) {FeedBack.m_choice3.append(" D");} if (radioButton_A4.isSelected()) {FeedBack.m_choice4.append(" A");} if (radioButton_B4.isSelected()) {FeedBack.m_choice4.append(" B");} if (radioButton_C4.isSelected()) {FeedBack.m_choice4.append(" C");} if (radioButton_D4.isSelected()) {FeedBack.m_choice4.append(" D");} if (radioButton_A5.isSelected()) {FeedBack.m_choice5.append(" A");} if (radioButton_B5.isSelected()) {FeedBack.m_choice5.append(" B");} if (radioButton_C5.isSelected()) {FeedBack.m_choice5.append(" C");} if (radioButton_D5.isSelected()) {FeedBack.m_choice5.append(" D");} if (radioButton_A6.isSelected()) {FeedBack.m_choice6.append(" A");} if (radioButton_B6.isSelected()) {FeedBack.m_choice6.append(" B");} if (radioButton_C6.isSelected()) {FeedBack.m_choice6.append(" C");} if (radioButton_D6.isSelected()) {FeedBack.m_choice6.append(" D");} if (radioButton_A7.isSelected()) {FeedBack.m_choice7.append(" A");} if (radioButton_B7.isSelected()) {FeedBack.m_choice7.append(" B");} if (radioButton_C7.isSelected()) {FeedBack.m_choice7.append(" C");} if (radioButton_D7.isSelected()) {FeedBack.m_choice7.append(" D");} if (radioButton_A8.isSelected()) {FeedBack.m_choice8.append(" A");} if (radioButton_B8.isSelected()) {FeedBack.m_choice8.append(" B");} if (radioButton_C8.isSelected()) {FeedBack.m_choice8.append(" C");} if (radioButton_D8.isSelected()) {FeedBack.m_choice8.append(" D");} if (radioButton_A9.isSelected()) {FeedBack.m_choice9.append(" A");} if (radioButton_B9.isSelected()) {FeedBack.m_choice9.append(" B");} if (radioButton_C9.isSelected()) {FeedBack.m_choice9.append(" C");} if (radioButton_D9.isSelected()) {FeedBack.m_choice9.append(" D");} if (radioButton_A10.isSelected()) {FeedBack.m_choice10.append(" A");} if (radioButton_B10.isSelected()) {FeedBack.m_choice10.append(" B");} if (radioButton_C10.isSelected()) {FeedBack.m_choice10.append(" C");} if (radioButton_D10.isSelected()) {FeedBack.m_choice10.append(" D");} FeedBack.m_optionContent1 = getOptionContent(radioButton_A1, radioButton_B1, radioButton_C1, radioButton_D1); FeedBack.m_optionContent2 = getOptionContent(radioButton_A2, radioButton_B2, radioButton_C2, radioButton_D2); FeedBack.m_optionContent3 = getOptionContent(radioButton_A3, radioButton_B3, radioButton_C3, radioButton_D3); FeedBack.m_optionContent4 = getOptionContent(radioButton_A4, radioButton_B4, radioButton_C4, radioButton_D4); FeedBack.m_optionContent5 = getOptionContent(radioButton_A5, radioButton_B5, radioButton_C5, radioButton_D5); FeedBack.m_optionContent6 = getOptionContent(radioButton_A6, radioButton_B6, radioButton_C6, radioButton_D6); FeedBack.m_optionContent7 = getOptionContent(radioButton_A7, radioButton_B7, radioButton_C7, radioButton_D7); FeedBack.m_optionContent8 = getOptionContent(radioButton_A8, radioButton_B8, radioButton_C8, radioButton_D8); FeedBack.m_optionContent9 = getOptionContent(radioButton_A9, radioButton_B9, radioButton_C9, radioButton_D9); FeedBack.m_optionContent10 = getOptionContent(radioButton_A10, radioButton_B10, radioButton_C10, radioButton_D10); f.dispose(); EasyJudge.doJudge(); } }); button_next.setFont(new Font("宋体", Font.PLAIN, 30)); button_next.setBounds(225, 880, 150, 57); f.getContentPane().add(button_next); f.setBounds(50, 50, 879, 1047); } //doChoice /**随机指定一个选项为正确选项**/public static String randomSetRight(JRadioButton buttonA, JRadioButton buttonB, JRadioButton buttonC, JRadioButton buttonD, int right) {Random random = new Random(); //int number = random.nextInt(max)%(max-min+1) + min /*干扰选项用数*/ int disturb1 = random.nextInt(10)%(10) + 1; //disturb1为1到10之间的整数 int disturb2 = random.nextInt(10)%(10) + 1; //disturb2为1到10之间的整数 int disturb3 = random.nextInt(10)%(10) + 1; //disturb3为1到10之间的整数 int randomSet = random.nextInt(4)%(4) + 1; //randomSet为1到4之间的整数 switch (randomSet) {case 1:buttonA.setText("A. " + String.valueOf(right));buttonB.setText("B. " + String.valueOf(right + disturb1));buttonC.setText("C. " + String.valueOf(right - disturb2));buttonD.setText("D. " + String.valueOf(right + disturb3));return "A"; //返回正确选项case 2:buttonA.setText("A. " + String.valueOf(right + disturb1));buttonB.setText("B. " + String.valueOf(right));buttonC.setText("C. " + String.valueOf(right - disturb2));buttonD.setText("D. " + String.valueOf(right + disturb3));return "B"; //返回正确选项case 3:buttonA.setText("A. " + String.valueOf(right + disturb1));buttonB.setText("B. " + String.valueOf(right - disturb2));buttonC.setText("C. " + String.valueOf(right));buttonD.setText("D. " + String.valueOf(right + disturb3));return "C"; //返回正确选项case 4:buttonA.setText("A. " + String.valueOf(right + disturb1));buttonB.setText("B. " + String.valueOf(right - disturb2));buttonC.setText("C. " + String.valueOf(right + disturb3));buttonD.setText("D. " + String.valueOf(right));return "D"; //返回正确选项}return null;} //randomSetRight/**得到选项内容**/public static String getOptionContent(JRadioButton buttonA, JRadioButton buttonB, JRadioButton buttonC, JRadioButton buttonD) {String content = "\t" + buttonA.getText() + "\t" + buttonB.getText() + "\t" + buttonC.getText() + "\t" + buttonD.getText(); return content;}public static void main(String[] args) {doChoice();}}
简单判断题:
package examSystem;import javax.swing.JFrame;import javax.swing.JPanel;import javax.swing.JTextField;import javax.swing.JRadioButton;import java.awt.Font;import java.awt.TextField;import javax.swing.JLabel;import javax.swing.SwingConstants;import javax.swing.JButton;import java.awt.event.ActionListener;import java.text.DecimalFormat;import java.util.Random;import java.awt.event.ActionEvent;public class EasyJudge {protected static int m_score = 0; //判断题得分 protected static int m_totalJudge = Settings.m_judgeAmount; //判断题总分 protected static JTextField textField_question1;protected static JTextField textField_question2;protected static JTextField textField_judge1;protected static JTextField textField_judge2;protected static JTextField textField_question3;protected static JTextField textField_judge3;protected static JTextField textField_question4;protected static JTextField textField_judge4;protected static JTextField textField_question5;protected static JTextField textField_judge5;protected static JTextField textField_question6;protected static JTextField textField_judge6;protected static JTextField textField_question7;protected static JTextField textField_judge7;protected static JTextField textField_question8;protected static JTextField textField_judge8;protected static JTextField textField_question9;protected static JTextField textField_judge9;protected static JTextField textField_question10;protected static JTextField textField_judge10;protected static JTextField textField_feedback;protected static int m_right1;protected static int m_right2;protected static int m_right3;protected static int m_right4;protected static int m_right5;protected static int m_right6;protected static int m_right7;protected static int m_right8;protected static int m_right9;protected static int m_right10;protected static String m_rightJudge1;protected static String m_rightJudge2;protected static String m_rightJudge3;protected static String m_rightJudge4;protected static String m_rightJudge5;protected static String m_rightJudge6;protected static String m_rightJudge7;protected static String m_rightJudge8;protected static String m_rightJudge9;protected static String m_rightJudge10;public static void doJudge() { JFrame f = new JFrame("判断题");f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setVisible(true); f.getContentPane().setLayout(null); /************************ 题干所用随机数 *******************************/ Random random = new Random(); //int number = random.nextInt(max)%(max-min+1) + min int x1 = random.nextInt(10)%(11); //x1为0到10之间的整数 int y1 = random.nextInt(10)%(11); //y1为0到10之间的整数 m_right1 = x1 + y1; int x2 = random.nextInt(10)%(11); //x2为0到10之间的整数 int y2 = random.nextInt(10)%(11); //y2为0到10之间的整数 m_right2 = x2 + y2; int x3 = random.nextInt(10)%(11); //x3为0到10之间的整数 int y3 = random.nextInt(10)%(11); //y3为0到10之间的整数 m_right3 = x3 + y3; int x4 = random.nextInt(20)%(11) + 10; //x4为10到20之间的整数 int y4 = random.nextInt(10)%(11); //y4为0到10之间的整数 m_right4 = x4 - y4; int x5 = random.nextInt(100)%(51) + 50; //x5为50到100之间的整数 int y5 = random.nextInt(50)%(31) + 20; //y5为20到50之间的整数 m_right5 = x5 - y5; int x6 = random.nextInt(10)%(11); //x6为0到10之间的整数 int y6 = random.nextInt(10)%(11); //y6为0到10之间的整数 m_right6 = x6 * y6; int x7 = random.nextInt(10)%(11); //x7为0到10之间的整数 int y7 = random.nextInt(10)%(11); //y7为0到10之间的整数 m_right7 = x7 * y7; int x8 = random.nextInt(10)%(11); //x8为0到10之间的整数 int y8 = random.nextInt(10)%(11); //y8为0到10之间的整数 m_right8 = x8 * y8; int x9 = random.nextInt(10)%(10) + 1; //x9为1到10之间的整数 int times9 = random.nextInt(10)%(10) + 1; //times9代表1到10倍 int y9 = x9 * times9; //y8为x8的整数倍 m_right9 = times9; int x10 = random.nextInt(10)%(10) + 1; //x10为1到10之间的整数 int times10 = random.nextInt(10)%(10) + 1; //times10代表1到10倍 int y10 = x10 * times10; //y10为x10的整数倍 m_right10 = times10; /**************************第一题*********************************/ JPanel panel_1 = new JPanel(); panel_1.setBounds(0, 0, 857, 86); f.getContentPane().add(panel_1); panel_1.setLayout(null); textField_question1 = new JTextField(" " + String.valueOf(x1) + " + " + String.valueOf(y1) + " = "); textField_question1.setFont(new Font("宋体", Font.PLAIN, 30)); textField_question1.setEditable(false); textField_question1.setBounds(15, 24, 414, 47); panel_1.add(textField_question1); textField_question1.setColumns(10); m_rightJudge1 = randomSetRight(textField_question1, m_right1); JRadioButton radioButton_true1 = new JRadioButton("√"); radioButton_true1.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_true1.setBounds(440, 31, 100, 29); panel_1.add(radioButton_true1); JRadioButton radioButton_false1 = new JRadioButton("×"); radioButton_false1.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_false1.setBounds(575, 31, 123, 29); panel_1.add(radioButton_false1); textField_judge1 = new JTextField(); textField_judge1.setFont(new Font("宋体", Font.PLAIN, 40)); textField_judge1.setEditable(false); textField_judge1.setBounds(720, 15, 50, 50); panel_1.add(textField_judge1); textField_judge1.setColumns(10); JLabel lable_number1 = new JLabel("\u2460"); lable_number1.setFont(new Font("宋体", Font.PLAIN, 30)); lable_number1.setHorizontalAlignment(SwingConstants.TRAILING); lable_number1.setBounds(785, 23, 40, 40); panel_1.add(lable_number1); /**************************第一题*********************************/ /**************************第二题*********************************/ JPanel panel_2 = new JPanel(); panel_2.setLayout(null); panel_2.setBounds(0, 80, 857, 86); f.getContentPane().add(panel_2); textField_question2 = new JTextField(" " + String.valueOf(x2) + " + " + String.valueOf(y2) + " = "); textField_question2.setFont(new Font("宋体", Font.PLAIN, 30)); textField_question2.setEditable(false); textField_question2.setColumns(10); textField_question2.setBounds(15, 24, 414, 47); panel_2.add(textField_question2); m_rightJudge2 = randomSetRight(textField_question2, m_right2); JRadioButton radioButton_true2 = new JRadioButton("\u221A"); radioButton_true2.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_true2.setBounds(440, 31, 99, 29); panel_2.add(radioButton_true2); JRadioButton radioButton_false2 = new JRadioButton("\u00D7"); radioButton_false2.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_false2.setBounds(575, 31, 117, 29); panel_2.add(radioButton_false2); textField_judge2 = new JTextField(); textField_judge2.setFont(new Font("宋体", Font.PLAIN, 40)); textField_judge2.setEditable(false); textField_judge2.setColumns(10); textField_judge2.setBounds(720, 15, 50, 50); panel_2.add(textField_judge2); JLabel label_number2 = new JLabel("\u2461"); label_number2.setHorizontalAlignment(SwingConstants.TRAILING); label_number2.setFont(new Font("宋体", Font.PLAIN, 30)); label_number2.setBounds(785, 23, 40, 40); panel_2.add(label_number2); /**************************第二题*********************************/ /**************************第三题*********************************/ JPanel panel_3 = new JPanel(); panel_3.setLayout(null); panel_3.setBounds(0, 160, 857, 86); f.getContentPane().add(panel_3); textField_question3 = new JTextField(" " + String.valueOf(x3) + " + " + String.valueOf(y3) + " = "); textField_question3.setFont(new Font("宋体", Font.PLAIN, 30)); textField_question3.setEditable(false); textField_question3.setColumns(10); textField_question3.setBounds(15, 20, 414, 47); panel_3.add(textField_question3); m_rightJudge3 = randomSetRight(textField_question3, m_right3); JRadioButton radioButton_true3 = new JRadioButton("\u221A"); radioButton_true3.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_true3.setBounds(440, 31, 100, 29); panel_3.add(radioButton_true3); JRadioButton radioButton_false3 = new JRadioButton("\u00D7"); radioButton_false3.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_false3.setBounds(575, 31, 123, 29); panel_3.add(radioButton_false3); textField_judge3 = new JTextField(); textField_judge3.setFont(new Font("宋体", Font.PLAIN, 40)); textField_judge3.setEditable(false); textField_judge3.setColumns(10); textField_judge3.setBounds(720, 15, 50, 50); panel_3.add(textField_judge3); JLabel label_number3 = new JLabel("\u2462"); label_number3.setHorizontalAlignment(SwingConstants.TRAILING); label_number3.setFont(new Font("宋体", Font.PLAIN, 30)); label_number3.setBounds(785, 23, 40, 40); panel_3.add(label_number3); /**************************第三题*********************************/ /**************************第四题*********************************/ JPanel panel_4 = new JPanel(); panel_4.setLayout(null); panel_4.setBounds(0, 240, 857, 86); f.getContentPane().add(panel_4); textField_question4 = new JTextField(" " + String.valueOf(x4) + " - " + String.valueOf(y4) + " = "); textField_question4.setFont(new Font("宋体", Font.PLAIN, 30)); textField_question4.setEditable(false); textField_question4.setColumns(10); textField_question4.setBounds(15, 24, 414, 47); panel_4.add(textField_question4); m_rightJudge4 = randomSetRight(textField_question4, m_right4); JRadioButton radioButton_true4 = new JRadioButton("\u221A"); radioButton_true4.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_true4.setBounds(440, 30, 100, 29); panel_4.add(radioButton_true4); JRadioButton radioButton_false4 = new JRadioButton("\u00D7"); radioButton_false4.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_false4.setBounds(575, 31, 123, 29); panel_4.add(radioButton_false4); textField_judge4 = new JTextField(); textField_judge4.setFont(new Font("宋体", Font.PLAIN, 40)); textField_judge4.setEditable(false); textField_judge4.setColumns(10); textField_judge4.setBounds(720, 15, 50, 50); panel_4.add(textField_judge4); JLabel label_number4 = new JLabel("\u2463"); label_number4.setHorizontalAlignment(SwingConstants.TRAILING); label_number4.setFont(new Font("宋体", Font.PLAIN, 30)); label_number4.setBounds(785, 23, 40, 40); panel_4.add(label_number4); /**************************第四题*********************************/ /**************************第五题*********************************/ JPanel panel_5 = new JPanel(); panel_5.setLayout(null); panel_5.setBounds(0, 320, 857, 86); f.getContentPane().add(panel_5); textField_question5 = new JTextField(" " + String.valueOf(x5) + " - " + String.valueOf(y5) + " = "); textField_question5.setFont(new Font("宋体", Font.PLAIN, 29)); textField_question5.setEditable(false); textField_question5.setColumns(10); textField_question5.setBounds(15, 24, 414, 47); panel_5.add(textField_question5); m_rightJudge5 = randomSetRight(textField_question5, m_right5); JRadioButton radioButton_true5 = new JRadioButton("\u221A"); radioButton_true5.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_true5.setBounds(440, 31, 100, 29); panel_5.add(radioButton_true5); JRadioButton radioButton_false5 = new JRadioButton("\u00D7"); radioButton_false5.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_false5.setBounds(575, 31, 123, 29); panel_5.add(radioButton_false5); textField_judge5 = new JTextField(); textField_judge5.setFont(new Font("宋体", Font.PLAIN, 40)); textField_judge5.setEditable(false); textField_judge5.setColumns(10); textField_judge5.setBounds(720, 15, 50, 50); panel_5.add(textField_judge5); JLabel label_number5 = new JLabel("\u2464"); label_number5.setHorizontalAlignment(SwingConstants.TRAILING); label_number5.setFont(new Font("宋体", Font.PLAIN, 30)); label_number5.setBounds(785, 23, 40, 40); panel_5.add(label_number5); /**************************第五题*********************************/ /**************************第六题*********************************/ JPanel panel_6 = new JPanel(); panel_6.setLayout(null); panel_6.setBounds(0, 400, 857, 86); f.getContentPane().add(panel_6); textField_question6 = new JTextField(" " + String.valueOf(x6) + " × " + String.valueOf(y6) + " = " ); textField_question6.setFont(new Font("宋体", Font.PLAIN, 29)); textField_question6.setEditable(false); textField_question6.setColumns(10); textField_question6.setBounds(15, 24, 414, 47); panel_6.add(textField_question6); m_rightJudge6 = randomSetRight(textField_question6, m_right6); JRadioButton radioButton_true6 = new JRadioButton("\u221A"); radioButton_true6.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_true6.setBounds(440, 31, 100, 29); panel_6.add(radioButton_true6); JRadioButton radioButton_false6 = new JRadioButton("\u00D7"); radioButton_false6.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_false6.setBounds(575, 31, 123, 29); panel_6.add(radioButton_false6); textField_judge6 = new JTextField(); textField_judge6.setFont(new Font("宋体", Font.PLAIN, 40)); textField_judge6.setEditable(false); textField_judge6.setColumns(10); textField_judge6.setBounds(720, 15, 50, 50); panel_6.add(textField_judge6); JLabel label_number6 = new JLabel("\u2465"); label_number6.setHorizontalAlignment(SwingConstants.TRAILING); label_number6.setFont(new Font("宋体", Font.PLAIN, 30)); label_number6.setBounds(785, 23, 40, 40); panel_6.add(label_number6); /**************************第六题*********************************/ /**************************第七题*********************************/ JPanel panel_7 = new JPanel(); panel_7.setLayout(null); panel_7.setBounds(0, 480, 857, 86); f.getContentPane().add(panel_7); textField_question7 = new JTextField(" " + String.valueOf(x7) + " × " + String.valueOf(y7) + " = "); textField_question7.setFont(new Font("宋体", Font.PLAIN, 29)); textField_question7.setEditable(false); textField_question7.setColumns(10); textField_question7.setBounds(15, 24, 414, 47); panel_7.add(textField_question7); m_rightJudge7 = randomSetRight(textField_question7, m_right7); JRadioButton radioButton_true7 = new JRadioButton("\u221A"); radioButton_true7.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_true7.setBounds(440, 31, 100, 29); panel_7.add(radioButton_true7); JRadioButton radioButton_false7 = new JRadioButton("\u00D7"); radioButton_false7.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_false7.setBounds(575, 31, 123, 29); panel_7.add(radioButton_false7); textField_judge7 = new JTextField(); textField_judge7.setFont(new Font("宋体", Font.PLAIN, 40)); textField_judge7.setEditable(false); textField_judge7.setColumns(10); textField_judge7.setBounds(720, 15, 50, 50); panel_7.add(textField_judge7); JLabel label_number7 = new JLabel("\u2466"); label_number7.setHorizontalAlignment(SwingConstants.TRAILING); label_number7.setFont(new Font("宋体", Font.PLAIN, 30)); label_number7.setBounds(785, 23, 40, 40); panel_7.add(label_number7); /**************************第七题*********************************/ /**************************第八题*********************************/ JPanel panel_8 = new JPanel(); panel_8.setLayout(null); panel_8.setBounds(0, 560, 857, 86); f.getContentPane().add(panel_8); textField_question8 = new JTextField(" " + String.valueOf(x8) + " × " + String.valueOf(y8) + " = "); textField_question8.setFont(new Font("宋体", Font.PLAIN, 29)); textField_question8.setEditable(false); textField_question8.setColumns(10); textField_question8.setBounds(15, 24, 414, 47); panel_8.add(textField_question8); m_rightJudge8 = randomSetRight(textField_question8, m_right8); JRadioButton radioButton_true8 = new JRadioButton("\u221A"); radioButton_true8.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_true8.setBounds(440, 31, 100, 29); panel_8.add(radioButton_true8); JRadioButton radioButton_false8 = new JRadioButton("\u00D7"); radioButton_false8.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_false8.setBounds(575, 31, 123, 29); panel_8.add(radioButton_false8); textField_judge8 = new JTextField(); textField_judge8.setFont(new Font("宋体", Font.PLAIN, 40)); textField_judge8.setEditable(false); textField_judge8.setColumns(10); textField_judge8.setBounds(720, 15, 50, 50); panel_8.add(textField_judge8); JLabel label_number8 = new JLabel("\u2467"); label_number8.setHorizontalAlignment(SwingConstants.TRAILING); label_number8.setFont(new Font("宋体", Font.PLAIN, 30)); label_number8.setBounds(785, 23, 40, 40); panel_8.add(label_number8); /**************************第八题*********************************/ /**************************第九题*********************************/ JPanel panel_9 = new JPanel(); panel_9.setLayout(null); panel_9.setBounds(0, 640, 857, 86); f.getContentPane().add(panel_9); textField_question9 = new JTextField(" " + String.valueOf(y9) + " ÷ " + String.valueOf(x9) + " = "); textField_question9.setFont(new Font("宋体", Font.PLAIN, 28)); textField_question9.setEditable(false); textField_question9.setColumns(10); textField_question9.setBounds(15, 24, 414, 47); panel_9.add(textField_question9); m_rightJudge9 = randomSetRight(textField_question9, m_right9); JRadioButton radioButton_true9 = new JRadioButton("\u221A"); radioButton_true9.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_true9.setBounds(440, 31, 100, 29); panel_9.add(radioButton_true9); JRadioButton radioButton_false9 = new JRadioButton("\u00D7"); radioButton_false9.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_false9.setBounds(575, 31, 123, 29); panel_9.add(radioButton_false9); textField_judge9 = new JTextField(); textField_judge9.setFont(new Font("宋体", Font.PLAIN, 40)); textField_judge9.setEditable(false); textField_judge9.setColumns(10); textField_judge9.setBounds(720, 15, 50, 50); panel_9.add(textField_judge9); JLabel label_number9 = new JLabel("\u2468"); label_number9.setHorizontalAlignment(SwingConstants.TRAILING); label_number9.setFont(new Font("宋体", Font.PLAIN, 30)); label_number9.setBounds(785, 23, 40, 40); panel_9.add(label_number9); /**************************第九题*********************************/ /**************************第十题*********************************/ JPanel panel_10 = new JPanel(); panel_10.setLayout(null); panel_10.setBounds(0, 720, 857, 86); f.getContentPane().add(panel_10); textField_question10 = new JTextField(" " + String.valueOf(y10) + " ÷ " + String.valueOf(x10) + " = "); textField_question10.setFont(new Font("宋体", Font.PLAIN, 28)); textField_question10.setEditable(false); textField_question10.setColumns(10); textField_question10.setBounds(15, 24, 411, 47); panel_10.add(textField_question10); m_rightJudge10 = randomSetRight(textField_question10, m_right10); JRadioButton radioButton_true10 = new JRadioButton("\u221A"); radioButton_true10.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_true10.setBounds(437, 34, 100, 29); panel_10.add(radioButton_true10); JRadioButton radioButton_false10 = new JRadioButton("\u00D7"); radioButton_false10.setFont(new Font("宋体", Font.PLAIN, 25)); radioButton_false10.setBounds(575, 31, 123, 29); panel_10.add(radioButton_false10); textField_judge10 = new JTextField(); textField_judge10.setFont(new Font("宋体", Font.PLAIN, 40)); textField_judge10.setEditable(false); textField_judge10.setColumns(10); textField_judge10.setBounds(720, 15, 50, 50); panel_10.add(textField_judge10); JLabel label_number10 = new JLabel("\u2469"); label_number10.setHorizontalAlignment(SwingConstants.TRAILING); label_number10.setFont(new Font("宋体", Font.PLAIN, 30)); label_number10.setBounds(785, 23, 40, 40); panel_10.add(label_number10); /**************************第十题*********************************/ textField_feedback = new JTextField(); textField_feedback.setEditable(false); textField_feedback.setFont(new Font("宋体", Font.PLAIN, 30)); textField_feedback.setBounds(443, 851, 376, 125); f.getContentPane().add(textField_feedback); textField_feedback.setColumns(10); /*根据题数隐藏相应题目*/ switch (m_totalJudge) {case 0:f.dispose();FeedBack.giveFeedback();break;case 1:panel_10.setVisible(false);panel_9.setVisible(false);panel_8.setVisible(false);panel_7.setVisible(false);panel_6.setVisible(false);panel_5.setVisible(false);panel_4.setVisible(false);panel_3.setVisible(false);panel_2.setVisible(false);break;case 2:panel_10.setVisible(false);panel_9.setVisible(false);panel_8.setVisible(false);panel_7.setVisible(false);panel_6.setVisible(false);panel_5.setVisible(false);panel_4.setVisible(false);panel_3.setVisible(false);break;case 3:panel_10.setVisible(false);panel_9.setVisible(false);panel_8.setVisible(false);panel_7.setVisible(false);panel_6.setVisible(false);panel_5.setVisible(false);panel_4.setVisible(false);break;case 4:panel_10.setVisible(false);panel_9.setVisible(false);panel_8.setVisible(false);panel_7.setVisible(false);panel_6.setVisible(false);panel_5.setVisible(false);break;case 5:panel_10.setVisible(false);panel_9.setVisible(false);panel_8.setVisible(false);panel_7.setVisible(false);panel_6.setVisible(false);break;case 6:panel_10.setVisible(false);panel_9.setVisible(false);panel_8.setVisible(false);panel_7.setVisible(false);break;case 7:panel_10.setVisible(false);panel_9.setVisible(false);panel_8.setVisible(false);break;case 8:panel_10.setVisible(false);panel_9.setVisible(false);break;case 9:panel_10.setVisible(false);break;case 10:break;} //对了则分数加一分且判断框中显示“√”,错了则不加分且判断框中显示“×” JButton button_submit = new JButton("提交"); button_submit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { m_score = 0; //便于反复提交,每次提交则得分先清零然后再统计新的得分,避免正确率累加 /********************第1题********************/ switch (m_rightJudge1) {case "√":if (radioButton_true1.isSelected() && !radioButton_false1.isSelected()) {m_score ++; textField_judge1.setText("√");}else {textField_judge1.setText("×");}break;case "×":if (!radioButton_true1.isSelected() && radioButton_false1.isSelected()) {m_score ++; textField_judge1.setText("√");}else {textField_judge1.setText("×");}break;default:textField_judge1.setText("×");break;} /********************第1题********************/ /********************第2题********************/ switch (m_rightJudge2) {case "√":if (radioButton_true2.isSelected() && !radioButton_false2.isSelected()) {m_score ++; textField_judge2.setText("√");}else {textField_judge2.setText("×");}break;case "×":if (!radioButton_true2.isSelected() && radioButton_false2.isSelected()) {m_score ++; textField_judge2.setText("√");}else {textField_judge2.setText("×");}break;default:textField_judge2.setText("×");break;} /********************第2题********************/ /********************第3题********************/ switch (m_rightJudge3) {case "√":if (radioButton_true3.isSelected() && !radioButton_false3.isSelected()) {m_score ++; textField_judge3.setText("√");}else {textField_judge3.setText("×");}break;case "×":if (!radioButton_true3.isSelected() && radioButton_false3.isSelected()) {m_score ++; textField_judge3.setText("√");}else {textField_judge3.setText("×");}break;default:textField_judge3.setText("×");break;} /********************第3题********************/ /********************第4题********************/ switch (m_rightJudge4) {case "√":if (radioButton_true4.isSelected() && !radioButton_false4.isSelected()) {m_score ++; textField_judge4.setText("√");}else {textField_judge4.setText("×");}break;case "×":if (!radioButton_true4.isSelected() && radioButton_false4.isSelected()) {m_score ++; textField_judge4.setText("√");}else {textField_judge4.setText("×");}break;default:textField_judge4.setText("×");break;} /********************第4题********************/ /********************第5题********************/ switch (m_rightJudge5) {case "√":if (radioButton_true5.isSelected() && !radioButton_false5.isSelected()) {m_score ++; textField_judge5.setText("√");}else {textField_judge5.setText("×");}break;case "×":if (!radioButton_true5.isSelected() && radioButton_false5.isSelected()) {m_score ++; textField_judge5.setText("√");}else {textField_judge5.setText("×");}break;default:textField_judge5.setText("×");break;} /********************第5题********************/ /********************第6题********************/ switch (m_rightJudge6) {case "√":if (radioButton_true6.isSelected() && !radioButton_false6.isSelected()) {m_score ++; textField_judge6.setText("√");}else {textField_judge6.setText("×");}break;case "×":if (!radioButton_true6.isSelected() && radioButton_false6.isSelected()) {m_score ++; textField_judge6.setText("√");}else {textField_judge6.setText("×");}break;default:textField_judge6.setText("×");break;} /********************第6题********************/ /********************第7题********************/ switch (m_rightJudge7) {case "√":if (radioButton_true7.isSelected() && !radioButton_false7.isSelected()) {m_score ++; textField_judge7.setText("√");}else {textField_judge7.setText("×");}break;case "×":if (!radioButton_true7.isSelected() && radioButton_false7.isSelected()) {m_score ++; textField_judge7.setText("√");}else {textField_judge7.setText("×");}break;default:textField_judge7.setText("×");break;} /********************第7题********************/ /********************第8题********************/ switch (m_rightJudge8) {case "√":if (radioButton_true8.isSelected() && !radioButton_false8.isSelected()) {m_score ++; textField_judge8.setText("√");}else {textField_judge8.setText("×");}break;case "×":if (!radioButton_true8.isSelected() && radioButton_false8.isSelected()) {m_score ++; textField_judge8.setText("√");}else {textField_judge8.setText("×");}break;default:textField_judge8.setText("×");break;} /********************第8题********************/ /********************第9题********************/ switch (m_rightJudge9) {case "√":if (radioButton_true9.isSelected() && !radioButton_false9.isSelected()) {m_score ++; textField_judge9.setText("√");}else {textField_judge9.setText("×");}break;case "×":if (!radioButton_true9.isSelected() && radioButton_false9.isSelected()) {m_score ++; textField_judge9.setText("√");}else {textField_judge9.setText("×");}break;default:textField_judge9.setText("×");break;} /********************第9题********************/ /********************第10题********************/ switch (m_rightJudge10) {case "√":if (radioButton_true10.isSelected() && !radioButton_false10.isSelected()) {m_score ++; textField_judge10.setText("√");}else {textField_judge10.setText("×");}break;case "×":if (!radioButton_true10.isSelected() && radioButton_false10.isSelected()) {m_score ++; textField_judge10.setText("√");}else {textField_judge10.setText("×");}break;default:textField_judge10.setText("×");break;} /********************第10题********************/ double temp1 = (double)m_score / (double)m_totalJudge * 100;DecimalFormat df = new DecimalFormat("#.00"); //正确率只保留小数点后两位 String accuracy = df.format(temp1);textField_feedback.setText(" 判断题正确率: " + accuracy + "%"); } }); button_submit.setFont(new Font("宋体", Font.PLAIN, 30)); button_submit.setBounds(63, 880, 123, 57); f.getContentPane().add(button_submit); JButton button_next = new JButton("总结"); button_next.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if(radioButton_true1.isSelected() ) {FeedBack.m_judge1.append(" √");} if(radioButton_false1.isSelected()) {FeedBack.m_judge1.append(" ×");} if(radioButton_true2.isSelected() ) {FeedBack.m_judge2.append(" √");} if(radioButton_false2.isSelected()) {FeedBack.m_judge2.append(" ×");} if(radioButton_true3.isSelected() ) {FeedBack.m_judge3.append(" √");} if(radioButton_false3.isSelected()) {FeedBack.m_judge3.append(" ×");} if(radioButton_true4.isSelected() ) {FeedBack.m_judge4.append(" √");} if(radioButton_false4.isSelected()) {FeedBack.m_judge4.append(" ×");} if(radioButton_true5.isSelected() ) {FeedBack.m_judge5.append(" √");} if(radioButton_false5.isSelected()) {FeedBack.m_judge5.append(" ×");} if(radioButton_true6.isSelected() ) {FeedBack.m_judge6.append(" √");} if(radioButton_false6.isSelected()) {FeedBack.m_judge6.append(" ×");} if(radioButton_true7.isSelected() ) {FeedBack.m_judge7.append(" √");} if(radioButton_false7.isSelected()) {FeedBack.m_judge7.append(" ×");} if(radioButton_true8.isSelected() ) {FeedBack.m_judge8.append(" √");} if(radioButton_false8.isSelected()) {FeedBack.m_judge8.append(" ×");} if(radioButton_true9.isSelected() ) {FeedBack.m_judge9.append(" √");} if(radioButton_false9.isSelected()) {FeedBack.m_judge9.append(" ×");} if(radioButton_true10.isSelected() ) {FeedBack.m_judge10.append(" √");} if(radioButton_false10.isSelected()) {FeedBack.m_judge10.append(" ×");} f.dispose(); FeedBack.giveFeedback (); } }); button_next.setFont(new Font("宋体", Font.PLAIN, 30)); button_next.setBounds(225, 880, 150, 57); f.getContentPane().add(button_next); f.setBounds(50, 50, 879, 1047); } //doJudge/**随机指定一个选项为正确选项**/public static String randomSetRight(JTextField textField_question12, int right) {Random random = new Random(); //int number = random.nextInt(max)%(max-min+1) + minint disturb = random.nextInt(10)%(10) + 1; //disturb1为1到10之间的整数 int randomSet = random.nextInt(2)%(2) + 1; //randomSet为1到2之间的整数 switch (randomSet) {case 1:textField_question12.setText(textField_question12.getText() + String.valueOf(right));return "√"; //返回正确选项case 2:textField_question12.setText(textField_question12.getText() + String.valueOf(right + disturb));return "×"; //返回正确选项}return null;} //randomSetRight public static void main(String[] args) {doJudge();}}
总结界面:
导出的结果将会保存在D盘根目录下
package examSystem;import javax.swing.JFrame;import javax.swing.JLabel;import java.awt.Font;import javax.swing.JButton;import java.awt.event.ActionListener;import java.io.File;import java.io.FileNotFoundException;import java.io.FileOutputStream;import java.io.IOException;import java.awt.event.ActionEvent;import javax.swing.JTextArea;import java.awt.Color;import javax.swing.JScrollPane;public class FeedBack {protected static String m_mode = Settings.m_modeOption; //获得难度模式protected static StringBuffer m_choice1 = new StringBuffer("");protected static StringBuffer m_choice2 = new StringBuffer("");protected static StringBuffer m_choice3 = new StringBuffer("");protected static StringBuffer m_choice4 = new StringBuffer("");protected static StringBuffer m_choice5 = new StringBuffer("");protected static StringBuffer m_choice6 = new StringBuffer("");protected static StringBuffer m_choice7 = new StringBuffer("");protected static StringBuffer m_choice8 = new StringBuffer("");protected static StringBuffer m_choice9 = new StringBuffer("");protected static StringBuffer m_choice10 = new StringBuffer("");protected static StringBuffer m_judge1 = new StringBuffer("");protected static StringBuffer m_judge2 = new StringBuffer("");protected static StringBuffer m_judge3 = new StringBuffer("");protected static StringBuffer m_judge4 = new StringBuffer("");protected static StringBuffer m_judge5 = new StringBuffer("");protected static StringBuffer m_judge6 = new StringBuffer("");protected static StringBuffer m_judge7 = new StringBuffer("");protected static StringBuffer m_judge8 = new StringBuffer("");protected static StringBuffer m_judge9 = new StringBuffer("");protected static StringBuffer m_judge10 = new StringBuffer("");protected static String m_optionContent1;protected static String m_optionContent2;protected static String m_optionContent3;protected static String m_optionContent4;protected static String m_optionContent5;protected static String m_optionContent6;protected static String m_optionContent7;protected static String m_optionContent8;protected static String m_optionContent9;protected static String m_optionContent10; public static void giveFeedback() { JFrame f = new JFrame("总结"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setVisible(true); f.getContentPane().setLayout(null); f.setBounds(50, 50, 772, 748); /******************************恭喜完成测试**********************************/ JLabel label_congratulation = new JLabel("恭喜完成测试!"); label_congratulation.setFont(new Font("宋体", Font.PLAIN, 30)); label_congratulation.setBounds(270, 31, 210, 38); f.getContentPane().add(label_congratulation); /******************************恭喜完成测试**********************************/ /*******************************主反馈区***********************************/ JTextArea textArea_mainFeedback = new JTextArea(); textArea_mainFeedback.setEditable(false); /*******************************填空题反馈区***********************************/ if (m_mode.equals("简单")) {textArea_mainFeedback.append("填空题情况: \n");textArea_mainFeedback.append(" 一共 " + EasyFillBlank.m_totalBlank + " 题\n");textArea_mainFeedback.append(" 答对 " + EasyFillBlank.m_score + " 题\n"); switch(Settings.m_blankAmount) {case 0:break;case 1:textArea_mainFeedback.append(" 第一题: " + EasyFillBlank.textField_question0.getText() + "\t正确答案: " + String.valueOf(EasyFillBlank.m_right0) + "; 您的答案: " + EasyFillBlank.textField_answer0.getText() + "\n"); break; case 2:textArea_mainFeedback.append(" 第一题: " + EasyFillBlank.textField_question0.getText() + "\t正确答案: " + String.valueOf(EasyFillBlank.m_right0) + "; 您的答案: " + EasyFillBlank.textField_answer0.getText() + "\n");textArea_mainFeedback.append(" 第二题: " + EasyFillBlank.textField_question5.getText() + "\t正确答案: " + String.valueOf(EasyFillBlank.m_right5) + "; 您的答案: " + EasyFillBlank.textField_answer5.getText() + "\n");break; case 3:textArea_mainFeedback.append(" 第一题: " + EasyFillBlank.textField_question0.getText() + "\t正确答案: " + String.valueOf(EasyFillBlank.m_right0) + "; 您的答案: " + EasyFillBlank.textField_answer0.getText() + "\n");textArea_mainFeedback.append(" 第二题: " + EasyFillBlank.textField_question5.getText() + "\t正确答案: " + String.valueOf(EasyFillBlank.m_right5) + "; 您的答案: " + EasyFillBlank.textField_answer5.getText() + "\n");textArea_mainFeedback.append(" 第三题: " + EasyFillBlank.textField_question1.getText() + "\t正确答案: " + String.valueOf(EasyFillBlank.m_right1) + "; 您的答案: " + EasyFillBlank.textField_answer1.getText() + "\n");break; case 4:textArea_mainFeedback.append(" 第一题: " + EasyFillBlank.textField_question0.getText() + "\t正确答案: " + String.valueOf(EasyFillBlank.m_right0) + "; 您的答案: " + EasyFillBlank.textField_answer0.getText() + "\n");textArea_mainFeedback.append(" 第二题: " + EasyFillBlank.textField_question5.getText() + "\t正确答案: " + String.valueOf(EasyFillBlank.m_right5) + "; 您的答案: " + EasyFillBlank.textField_answer5.getText() + "\n");textArea_mainFeedback.append(" 第三题: " + EasyFillBlank.textField_question1.getText() + "\t正确答案: " + String.valueOf(EasyFillBlank.m_right1) + "; 您的答案: " + EasyFillBlank.textField_answer1.getText() + "\n");textArea_mainFeedback.append(" 第四题: " + EasyFillBlank.textField_question6.getText() + "\t正确答案: " + String.valueOf(EasyFillBlank.m_right6) + "; 您的答案: " + EasyFillBlank.textField_answer6.getText() + "\n");break;case 5:textArea_mainFeedback.append(" 第一题: " + EasyFillBlank.textField_question0.getText() + "\t正确答案: " + String.valueOf(EasyFillBlank.m_right0) + "; 您的答案: " + EasyFillBlank.textField_answer0.getText() + "\n");textArea_mainFeedback.append(" 第二题: " + EasyFillBlank.textField_question5.getText() + "\t正确答案: " + String.valueOf(EasyFillBlank.m_right5) + "; 您的答案: " + EasyFillBlank.textField_answer5.getText() + "\n");textArea_mainFeedback.append(" 第三题: " + EasyFillBlank.textField_question1.getText() + "\t正确答案: " + String.valueOf(EasyFillBlank.m_right1) + "; 您的答案: " + EasyFillBlank.textField_answer1.getText() + "\n");textArea_mainFeedback.append(" 第四题: " + EasyFillBlank.textField_question6.getText() + "\t正确答案: " + String.valueOf(EasyFillBlank.m_right6) + "; 您的答案: " + EasyFillBlank.textField_answer6.getText() + "\n");textArea_mainFeedback.append(" 第五题: " + EasyFillBlank.textField_question2.getText() + "\t正确答案: " + String.valueOf(EasyFillBlank.m_right2) + "; 您的答案: " + EasyFillBlank.textField_answer2.getText() + "\n");break; case 6:textArea_mainFeedback.append(" 第一题: " + EasyFillBlank.textField_question0.getText() + "\t正确答案: " + String.valueOf(EasyFillBlank.m_right0) + "; 您的答案: " + EasyFillBlank.textField_answer0.getText() + "\n");textArea_mainFeedback.append(" 第二题: " + EasyFillBlank.textField_question5.getText() + "\t正确答案: " + String.valueOf(EasyFillBlank.m_right5) + "; 您的答案: " + EasyFillBlank.textField_answer5.getText() + "\n");textArea_mainFeedback.append(" 第三题: " + EasyFillBlank.textField_question1.getText() + "\t正确答案: " + String.valueOf(EasyFillBlank.m_right1) + "; 您的答案: " + EasyFillBlank.textField_answer1.getText() + "\n");textArea_mainFeedback.append(" 第四题: " + EasyFillBlank.textField_question6.getText() + "\t正确答案: " + String.valueOf(EasyFillBlank.m_right6) + "; 您的答案: " + EasyFillBlank.textField_answer6.getText() + "\n");textArea_mainFeedback.append(" 第五题: " + EasyFillBlank.textField_question2.getText() + "\t正确答案: " + String.valueOf(EasyFillBlank.m_right2) + "; 您的答案: " + EasyFillBlank.textField_answer2.getText() + "\n");textArea_mainFeedback.append(" 第六题: " + EasyFillBlank.textField_question7.getText() + "\t正确答案: " + String.valueOf(EasyFillBlank.m_right7) + "; 您的答案: " + EasyFillBlank.textField_answer7.getText() + "\n");break; case 7:textArea_mainFeedback.append(" 第一题: " + EasyFillBlank.textField_question0.getText() + "\t正确答案: " + String.valueOf(EasyFillBlank.m_right0) + "; 您的答案: " + EasyFillBlank.textField_answer0.getText() + "\n");textArea_mainFeedback.append(" 第二题: " + EasyFillBlank.textField_question5.getText() + "\t正确答案: " + String.valueOf(EasyFillBlank.m_right5) + "; 您的答案: " + EasyFillBlank.textField_answer5.getText() + "\n");textArea_mainFeedback.append(" 第三题: " + EasyFillBlank.textField_question1.getText() + "\t正确答案: " + String.valueOf(EasyFillBlank.m_right1) + "; 您的答案: " + EasyFillBlank.textField_answer1.getText() + "\n");textArea_mainFeedback.append(" 第四题: " + EasyFillBlank.textField_question6.getText() + "\t正确答案: " + String.valueOf(EasyFillBlank.m_right6) + "; 您的答案: " + EasyFillBlank.textField_answer6.getText() + "\n");textArea_mainFeedback.append(" 第五题: " + EasyFillBlank.textField_question2.getText() + "\t正确答案: " + String.valueOf(EasyFillBlank.m_right2) + "; 您的答案: " + EasyFillBlank.textField_answer2.getText() + "\n");textArea_mainFeedback.append(" 第六题: " + EasyFillBlank.textField_question7.getText() + "\t正确答案: " + String.valueOf(EasyFillBlank.m_right7) + "; 您的答案: " + EasyFillBlank.textField_answer7.getText() + "\n");textArea_mainFeedback.append(" 第七题: " + EasyFillBlank.textField_question3.getText() + "\t正确答案: " + String.valueOf(EasyFillBlank.m_right3) + "; 您的答案: " + EasyFillBlank.textField_answer3.getText() + "\n");break;case 8:textArea_mainFeedback.append(" 第一题: " + EasyFillBlank.textField_question0.getText() + "\t正确答案: " + String.valueOf(EasyFillBlank.m_right0) + "; 您的答案: " + EasyFillBlank.textField_answer0.getText() + "\n");textArea_mainFeedback.append(" 第二题: " + EasyFillBlank.textField_question5.getText() + "\t正确答案: " + String.valueOf(EasyFillBlank.m_right5) + "; 您的答案: " + EasyFillBlank.textField_answer5.getText() + "\n");textArea_mainFeedback.append(" 第三题: " + EasyFillBlank.textField_question1.getText() + "\t正确答案: " + String.valueOf(EasyFillBlank.m_right1) + "; 您的答案: " + EasyFillBlank.textField_answer1.getText() + "\n");textArea_mainFeedback.append(" 第四题: " + EasyFillBlank.textField_question6.getText() + "\t正确答案: " + String.valueOf(EasyFillBlank.m_right6) + "; 您的答案: " + EasyFillBlank.textField_answer6.getText() + "\n");textArea_mainFeedback.append(" 第五题: " + EasyFillBlank.textField_question2.getText() + "\t正确答案: " + String.valueOf(EasyFillBlank.m_right2) + "; 您的答案: " + EasyFillBlank.textField_answer2.getText() + "\n");textArea_mainFeedback.append(" 第六题: " + EasyFillBlank.textField_question7.getText() + "\t正确答案: " + String.valueOf(EasyFillBlank.m_right7) + "; 您的答案: " + EasyFillBlank.textField_answer7.getText() + "\n");textArea_mainFeedback.append(" 第七题: " + EasyFillBlank.textField_question3.getText() + "\t正确答案: " + String.valueOf(EasyFillBlank.m_right3) + "; 您的答案: " + EasyFillBlank.textField_answer3.getText() + "\n");textArea_mainFeedback.append(" 第八题: " + EasyFillBlank.textField_question8.getText() + "\t正确答案: " + String.valueOf(EasyFillBlank.m_right8) + "; 您的答案: " + EasyFillBlank.textField_answer8.getText() + "\n");break;case 9:textArea_mainFeedback.append(" 第一题: " + EasyFillBlank.textField_question0.getText() + "\t正确答案: " + String.valueOf(EasyFillBlank.m_right0) + "; 您的答案: " + EasyFillBlank.textField_answer0.getText() + "\n");textArea_mainFeedback.append(" 第二题: " + EasyFillBlank.textField_question5.getText() + "\t正确答案: " + String.valueOf(EasyFillBlank.m_right5) + "; 您的答案: " + EasyFillBlank.textField_answer5.getText() + "\n");textArea_mainFeedback.append(" 第三题: " + EasyFillBlank.textField_question1.getText() + "\t正确答案: " + String.valueOf(EasyFillBlank.m_right1) + "; 您的答案: " + EasyFillBlank.textField_answer1.getText() + "\n");textArea_mainFeedback.append(" 第四题: " + EasyFillBlank.textField_question6.getText() + "\t正确答案: " + String.valueOf(EasyFillBlank.m_right6) + "; 您的答案: " + EasyFillBlank.textField_answer6.getText() + "\n");textArea_mainFeedback.append(" 第五题: " + EasyFillBlank.textField_question2.getText() + "\t正确答案: " + String.valueOf(EasyFillBlank.m_right2) + "; 您的答案: " + EasyFillBlank.textField_answer2.getText() + "\n");textArea_mainFeedback.append(" 第六题: " + EasyFillBlank.textField_question7.getText() + "\t正确答案: " + String.valueOf(EasyFillBlank.m_right7) + "; 您的答案: " + EasyFillBlank.textField_answer7.getText() + "\n");textArea_mainFeedback.append(" 第七题: " + EasyFillBlank.textField_question3.getText() + "\t正确答案: " + String.valueOf(EasyFillBlank.m_right3) + "; 您的答案: " + EasyFillBlank.textField_answer3.getText() + "\n");textArea_mainFeedback.append(" 第八题: " + EasyFillBlank.textField_question8.getText() + "\t正确答案: " + String.valueOf(EasyFillBlank.m_right8) + "; 您的答案: " + EasyFillBlank.textField_answer8.getText() + "\n");textArea_mainFeedback.append(" 第九题: " + EasyFillBlank.textField_question4.getText() + "\t正确答案: " + String.valueOf(EasyFillBlank.m_right4) + "; 您的答案: " + EasyFillBlank.textField_answer4.getText() + "\n");break;case 10:textArea_mainFeedback.append(" 第一题: " + EasyFillBlank.textField_question0.getText() + "\t正确答案: " + String.valueOf(EasyFillBlank.m_right0) + "; 您的答案: " + EasyFillBlank.textField_answer0.getText() + "\n");textArea_mainFeedback.append(" 第二题: " + EasyFillBlank.textField_question5.getText() + "\t正确答案: " + String.valueOf(EasyFillBlank.m_right5) + "; 您的答案: " + EasyFillBlank.textField_answer5.getText() + "\n");textArea_mainFeedback.append(" 第三题: " + EasyFillBlank.textField_question1.getText() + "\t正确答案: " + String.valueOf(EasyFillBlank.m_right1) + "; 您的答案: " + EasyFillBlank.textField_answer1.getText() + "\n");textArea_mainFeedback.append(" 第四题: " + EasyFillBlank.textField_question6.getText() + "\t正确答案: " + String.valueOf(EasyFillBlank.m_right6) + "; 您的答案: " + EasyFillBlank.textField_answer6.getText() + "\n");textArea_mainFeedback.append(" 第五题: " + EasyFillBlank.textField_question2.getText() + "\t正确答案: " + String.valueOf(EasyFillBlank.m_right2) + "; 您的答案: " + EasyFillBlank.textField_answer2.getText() + "\n");textArea_mainFeedback.append(" 第六题: " + EasyFillBlank.textField_question7.getText() + "\t正确答案: " + String.valueOf(EasyFillBlank.m_right7) + "; 您的答案: " + EasyFillBlank.textField_answer7.getText() + "\n");textArea_mainFeedback.append(" 第七题: " + EasyFillBlank.textField_question3.getText() + "\t正确答案: " + String.valueOf(EasyFillBlank.m_right3) + "; 您的答案: " + EasyFillBlank.textField_answer3.getText() + "\n");textArea_mainFeedback.append(" 第八题: " + EasyFillBlank.textField_question8.getText() + "\t正确答案: " + String.valueOf(EasyFillBlank.m_right8) + "; 您的答案: " + EasyFillBlank.textField_answer8.getText() + "\n");textArea_mainFeedback.append(" 第九题: " + EasyFillBlank.textField_question4.getText() + "\t正确答案: " + String.valueOf(EasyFillBlank.m_right4) + "; 您的答案: " + EasyFillBlank.textField_answer4.getText() + "\n");textArea_mainFeedback.append(" 第十题: " + EasyFillBlank.textField_question9.getText() + "\t正确答案: " + String.valueOf(EasyFillBlank.m_right9) + "; 您的答案: " + EasyFillBlank.textField_answer9.getText() + "\n");break;}textArea_mainFeedback.append(EasyFillBlank.textField_feedback.getText() + "\n\n\n"); //正确率/***************************************************填空题反馈区*****************************************************//***************************************************选择题反馈区*****************************************************/textArea_mainFeedback.append("选择题情况: \n");textArea_mainFeedback.append(" 一共 " + EasyChoice.m_totalChoice + " 题\n");textArea_mainFeedback.append(" 答对 " + EasyChoice.m_score + " 题\n");switch (Settings.m_choiceAmount) {case 1:textArea_mainFeedback.append(" 第一题: " + EasyChoice.textField_question1.getText() + m_optionContent1 + "\t正确答案:" + EasyChoice.m_rightOption1 + "\t您的答案:" + FeedBack.m_choice1 + "\n");break;case 2:textArea_mainFeedback.append(" 第一题: " + EasyChoice.textField_question1.getText() + m_optionContent1 + "\t正确答案:" + EasyChoice.m_rightOption1 + "\t您的答案:" + FeedBack.m_choice1 + "\n");textArea_mainFeedback.append(" 第二题: " + EasyChoice.textField_question2.getText() + m_optionContent2 + "\t正确答案:" + EasyChoice.m_rightOption2 + "\t您的答案:" + FeedBack.m_choice2 + "\n");break;case 3:textArea_mainFeedback.append(" 第一题: " + EasyChoice.textField_question1.getText() + m_optionContent1 + "\t正确答案:" + EasyChoice.m_rightOption1 + "\t您的答案:" + FeedBack.m_choice1 + "\n");textArea_mainFeedback.append(" 第二题: " + EasyChoice.textField_question2.getText() + m_optionContent2 + "\t正确答案:" + EasyChoice.m_rightOption2 + "\t您的答案:" + FeedBack.m_choice2 + "\n");textArea_mainFeedback.append(" 第三题: " + EasyChoice.textField_question3.getText() + m_optionContent3 + "\t正确答案:" + EasyChoice.m_rightOption3 + "\t您的答案:" + FeedBack.m_choice3 + "\n");break;case 4:textArea_mainFeedback.append(" 第一题: " + EasyChoice.textField_question1.getText() + m_optionContent1 + "\t正确答案:" + EasyChoice.m_rightOption1 + "\t您的答案:" + FeedBack.m_choice1 + "\n");textArea_mainFeedback.append(" 第二题: " + EasyChoice.textField_question2.getText() + m_optionContent2 + "\t正确答案:" + EasyChoice.m_rightOption2 + "\t您的答案:" + FeedBack.m_choice2 + "\n");textArea_mainFeedback.append(" 第三题: " + EasyChoice.textField_question3.getText() + m_optionContent3 + "\t正确答案:" + EasyChoice.m_rightOption3 + "\t您的答案:" + FeedBack.m_choice3 + "\n");textArea_mainFeedback.append(" 第四题: " + EasyChoice.textField_question4.getText() + m_optionContent4 + "\t正确答案:" + EasyChoice.m_rightOption4 + "\t您的答案:" + FeedBack.m_choice4 + "\n");break;case 5:textArea_mainFeedback.append(" 第一题: " + EasyChoice.textField_question1.getText() + m_optionContent1 + "\t正确答案:" + EasyChoice.m_rightOption1 + "\t您的答案:" + FeedBack.m_choice1 + "\n");textArea_mainFeedback.append(" 第二题: " + EasyChoice.textField_question2.getText() + m_optionContent2 + "\t正确答案:" + EasyChoice.m_rightOption2 + "\t您的答案:" + FeedBack.m_choice2 + "\n");textArea_mainFeedback.append(" 第三题: " + EasyChoice.textField_question3.getText() + m_optionContent3 + "\t正确答案:" + EasyChoice.m_rightOption3 + "\t您的答案:" + FeedBack.m_choice3 + "\n");textArea_mainFeedback.append(" 第四题: " + EasyChoice.textField_question4.getText() + m_optionContent4 + "\t正确答案:" + EasyChoice.m_rightOption4 + "\t您的答案:" + FeedBack.m_choice4 + "\n");textArea_mainFeedback.append(" 第五题: " + EasyChoice.textField_question5.getText() + m_optionContent5 + "\t正确答案:" + EasyChoice.m_rightOption5 + "\t您的答案:" + FeedBack.m_choice5 + "\n");break;case 6:textArea_mainFeedback.append(" 第一题: " + EasyChoice.textField_question1.getText() + m_optionContent1 + "\t正确答案:" + EasyChoice.m_rightOption1 + "\t您的答案:" + FeedBack.m_choice1 + "\n");textArea_mainFeedback.append(" 第二题: " + EasyChoice.textField_question2.getText() + m_optionContent2 + "\t正确答案:" + EasyChoice.m_rightOption2 + "\t您的答案:" + FeedBack.m_choice2 + "\n");textArea_mainFeedback.append(" 第三题: " + EasyChoice.textField_question3.getText() + m_optionContent3 + "\t正确答案:" + EasyChoice.m_rightOption3 + "\t您的答案:" + FeedBack.m_choice3 + "\n");textArea_mainFeedback.append(" 第四题: " + EasyChoice.textField_question4.getText() + m_optionContent4 + "\t正确答案:" + EasyChoice.m_rightOption4 + "\t您的答案:" + FeedBack.m_choice4 + "\n");textArea_mainFeedback.append(" 第五题: " + EasyChoice.textField_question5.getText() + m_optionContent5 + "\t正确答案:" + EasyChoice.m_rightOption5 + "\t您的答案:" + FeedBack.m_choice5 + "\n");textArea_mainFeedback.append(" 第六题: " + EasyChoice.textField_question6.getText() + m_optionContent6 + "\t正确答案:" + EasyChoice.m_rightOption6 + "\t您的答案:" + FeedBack.m_choice6 + "\n");break;case 7:textArea_mainFeedback.append(" 第一题: " + EasyChoice.textField_question1.getText() + m_optionContent1 + "\t正确答案:" + EasyChoice.m_rightOption1 + "\t您的答案:" + FeedBack.m_choice1 + "\n");textArea_mainFeedback.append(" 第二题: " + EasyChoice.textField_question2.getText() + m_optionContent2 + "\t正确答案:" + EasyChoice.m_rightOption2 + "\t您的答案:" + FeedBack.m_choice2 + "\n");textArea_mainFeedback.append(" 第三题: " + EasyChoice.textField_question3.getText() + m_optionContent3 + "\t正确答案:" + EasyChoice.m_rightOption3 + "\t您的答案:" + FeedBack.m_choice3 + "\n");textArea_mainFeedback.append(" 第四题: " + EasyChoice.textField_question4.getText() + m_optionContent4 + "\t正确答案:" + EasyChoice.m_rightOption4 + "\t您的答案:" + FeedBack.m_choice4 + "\n");textArea_mainFeedback.append(" 第五题: " + EasyChoice.textField_question5.getText() + m_optionContent5 + "\t正确答案:" + EasyChoice.m_rightOption5 + "\t您的答案:" + FeedBack.m_choice5 + "\n");textArea_mainFeedback.append(" 第六题: " + EasyChoice.textField_question6.getText() + m_optionContent6 + "\t正确答案:" + EasyChoice.m_rightOption6 + "\t您的答案:" + FeedBack.m_choice6 + "\n");textArea_mainFeedback.append(" 第七题: " + EasyChoice.textField_question7.getText() + m_optionContent7 + "\t正确答案:" + EasyChoice.m_rightOption7 + "\t您的答案:" + FeedBack.m_choice7 + "\n");break;case 8:textArea_mainFeedback.append(" 第一题: " + EasyChoice.textField_question1.getText() + m_optionContent1 + "\t正确答案:" + EasyChoice.m_rightOption1 + "\t您的答案:" + FeedBack.m_choice1 + "\n");textArea_mainFeedback.append(" 第二题: " + EasyChoice.textField_question2.getText() + m_optionContent2 + "\t正确答案:" + EasyChoice.m_rightOption2 + "\t您的答案:" + FeedBack.m_choice2 + "\n");textArea_mainFeedback.append(" 第三题: " + EasyChoice.textField_question3.getText() + m_optionContent3 + "\t正确答案:" + EasyChoice.m_rightOption3 + "\t您的答案:" + FeedBack.m_choice3 + "\n");textArea_mainFeedback.append(" 第四题: " + EasyChoice.textField_question4.getText() + m_optionContent4 + "\t正确答案:" + EasyChoice.m_rightOption4 + "\t您的答案:" + FeedBack.m_choice4 + "\n");textArea_mainFeedback.append(" 第五题: " + EasyChoice.textField_question5.getText() + m_optionContent5 + "\t正确答案:" + EasyChoice.m_rightOption5 + "\t您的答案:" + FeedBack.m_choice5 + "\n");textArea_mainFeedback.append(" 第六题: " + EasyChoice.textField_question6.getText() + m_optionContent6 + "\t正确答案:" + EasyChoice.m_rightOption6 + "\t您的答案:" + FeedBack.m_choice6 + "\n");textArea_mainFeedback.append(" 第七题: " + EasyChoice.textField_question7.getText() + m_optionContent7 + "\t正确答案:" + EasyChoice.m_rightOption7 + "\t您的答案:" + FeedBack.m_choice7 + "\n");textArea_mainFeedback.append(" 第八题: " + EasyChoice.textField_question8.getText() + m_optionContent8 + "\t正确答案:" + EasyChoice.m_rightOption8 + "\t您的答案:" + FeedBack.m_choice8 + "\n");break;case 9:textArea_mainFeedback.append(" 第一题: " + EasyChoice.textField_question1.getText() + m_optionContent1 + "\t正确答案:" + EasyChoice.m_rightOption1 + "\t您的答案:" + FeedBack.m_choice1 + "\n");textArea_mainFeedback.append(" 第二题: " + EasyChoice.textField_question2.getText() + m_optionContent2 + "\t正确答案:" + EasyChoice.m_rightOption2 + "\t您的答案:" + FeedBack.m_choice2 + "\n");textArea_mainFeedback.append(" 第三题: " + EasyChoice.textField_question3.getText() + m_optionContent3 + "\t正确答案:" + EasyChoice.m_rightOption3 + "\t您的答案:" + FeedBack.m_choice3 + "\n");textArea_mainFeedback.append(" 第四题: " + EasyChoice.textField_question4.getText() + m_optionContent4 + "\t正确答案:" + EasyChoice.m_rightOption4 + "\t您的答案:" + FeedBack.m_choice4 + "\n");textArea_mainFeedback.append(" 第五题: " + EasyChoice.textField_question5.getText() + m_optionContent5 + "\t正确答案:" + EasyChoice.m_rightOption5 + "\t您的答案:" + FeedBack.m_choice5 + "\n");textArea_mainFeedback.append(" 第六题: " + EasyChoice.textField_question6.getText() + m_optionContent6 + "\t正确答案:" + EasyChoice.m_rightOption6 + "\t您的答案:" + FeedBack.m_choice6 + "\n");textArea_mainFeedback.append(" 第七题: " + EasyChoice.textField_question7.getText() + m_optionContent7 + "\t正确答案:" + EasyChoice.m_rightOption7 + "\t您的答案:" + FeedBack.m_choice7 + "\n");textArea_mainFeedback.append(" 第八题: " + EasyChoice.textField_question8.getText() + m_optionContent8 + "\t正确答案:" + EasyChoice.m_rightOption8 + "\t您的答案:" + FeedBack.m_choice8 + "\n");textArea_mainFeedback.append(" 第九题: " + EasyChoice.textField_question9.getText() + m_optionContent9 + "\t正确答案:" + EasyChoice.m_rightOption9 + "\t您的答案:" + FeedBack.m_choice9 + "\n");break;case 10:textArea_mainFeedback.append(" 第一题: " + EasyChoice.textField_question1.getText() + m_optionContent1 + "\t正确答案:" + EasyChoice.m_rightOption1 + "\t您的答案:" + FeedBack.m_choice1 + "\n");textArea_mainFeedback.append(" 第二题: " + EasyChoice.textField_question2.getText() + m_optionContent2 + "\t正确答案:" + EasyChoice.m_rightOption2 + "\t您的答案:" + FeedBack.m_choice2 + "\n");textArea_mainFeedback.append(" 第三题: " + EasyChoice.textField_question3.getText() + m_optionContent3 + "\t正确答案:" + EasyChoice.m_rightOption3 + "\t您的答案:" + FeedBack.m_choice3 + "\n");textArea_mainFeedback.append(" 第四题: " + EasyChoice.textField_question4.getText() + m_optionContent4 + "\t正确答案:" + EasyChoice.m_rightOption4 + "\t您的答案:" + FeedBack.m_choice4 + "\n");textArea_mainFeedback.append(" 第五题: " + EasyChoice.textField_question5.getText() + m_optionContent5 + "\t正确答案:" + EasyChoice.m_rightOption5 + "\t您的答案:" + FeedBack.m_choice5 + "\n");textArea_mainFeedback.append(" 第六题: " + EasyChoice.textField_question6.getText() + m_optionContent6 + "\t正确答案:" + EasyChoice.m_rightOption6 + "\t您的答案:" + FeedBack.m_choice6 + "\n");textArea_mainFeedback.append(" 第七题: " + EasyChoice.textField_question7.getText() + m_optionContent7 + "\t正确答案:" + EasyChoice.m_rightOption7 + "\t您的答案:" + FeedBack.m_choice7 + "\n");textArea_mainFeedback.append(" 第八题: " + EasyChoice.textField_question8.getText() + m_optionContent8 + "\t正确答案:" + EasyChoice.m_rightOption8 + "\t您的答案:" + FeedBack.m_choice8 + "\n");textArea_mainFeedback.append(" 第九题: " + EasyChoice.textField_question9.getText() + m_optionContent9 + "\t正确答案:" + EasyChoice.m_rightOption9 + "\t您的答案:" + FeedBack.m_choice9 + "\n");textArea_mainFeedback.append(" 第十题: " + EasyChoice.textField_question10.getText() + m_optionContent10 + "\t正确答案:" + EasyChoice.m_rightOption10 + "\t您的答案:" + FeedBack.m_choice10 + "\n");break;default:break;}textArea_mainFeedback.append(EasyChoice.textField_feedback.getText() + "\n\n\n"); //正确率/***************************************************选择题反馈区*****************************************************//***************************************************判断题反馈区*****************************************************/textArea_mainFeedback.append("判断题情况: \n");textArea_mainFeedback.append(" 一共 " + EasyJudge.m_totalJudge + " 题\n");textArea_mainFeedback.append(" 答对 " + EasyJudge.m_score + " 题\n");switch(Settings.m_judgeAmount) {case 1:textArea_mainFeedback.append(" 第一题: " + EasyJudge.textField_question1.getText() + "\t\t正确答案:" + EasyJudge.m_rightJudge1 + "您的答案:" + FeedBack.m_judge1 + "\n");break;case 2:textArea_mainFeedback.append(" 第一题: " + EasyJudge.textField_question1.getText() + "\t\t正确答案:" + EasyJudge.m_rightJudge1 + "您的答案:" + FeedBack.m_judge1 + "\n");textArea_mainFeedback.append(" 第二题: " + EasyJudge.textField_question2.getText() + "\t\t正确答案:" + EasyJudge.m_rightJudge2 + "您的答案:" + FeedBack.m_judge2 + "\n");break;case 3:textArea_mainFeedback.append(" 第一题: " + EasyJudge.textField_question1.getText() + "\t\t正确答案:" + EasyJudge.m_rightJudge1 + "您的答案:" + FeedBack.m_judge1 + "\n");textArea_mainFeedback.append(" 第二题: " + EasyJudge.textField_question2.getText() + "\t\t正确答案:" + EasyJudge.m_rightJudge2 + "您的答案:" + FeedBack.m_judge2 + "\n");textArea_mainFeedback.append(" 第三题: " + EasyJudge.textField_question3.getText() + "\t\t正确答案:" + EasyJudge.m_rightJudge3 + "您的答案:" + FeedBack.m_judge3 + "\n");break;case 4:textArea_mainFeedback.append(" 第一题: " + EasyJudge.textField_question1.getText() + "\t\t正确答案:" + EasyJudge.m_rightJudge1 + "您的答案:" + FeedBack.m_judge1 + "\n");textArea_mainFeedback.append(" 第二题: " + EasyJudge.textField_question2.getText() + "\t\t正确答案:" + EasyJudge.m_rightJudge2 + "您的答案:" + FeedBack.m_judge2 + "\n");textArea_mainFeedback.append(" 第三题: " + EasyJudge.textField_question3.getText() + "\t\t正确答案:" + EasyJudge.m_rightJudge3 + "您的答案:" + FeedBack.m_judge3 + "\n");textArea_mainFeedback.append(" 第四题: " + EasyJudge.textField_question4.getText() + "\t\t正确答案:" + EasyJudge.m_rightJudge4 + "您的答案:" + FeedBack.m_judge4 + "\n");break;case 5:textArea_mainFeedback.append(" 第一题: " + EasyJudge.textField_question1.getText() + "\t\t正确答案:" + EasyJudge.m_rightJudge1 + "您的答案:" + FeedBack.m_judge1 + "\n");textArea_mainFeedback.append(" 第二题: " + EasyJudge.textField_question2.getText() + "\t\t正确答案:" + EasyJudge.m_rightJudge2 + "您的答案:" + FeedBack.m_judge2 + "\n");textArea_mainFeedback.append(" 第三题: " + EasyJudge.textField_question3.getText() + "\t\t正确答案:" + EasyJudge.m_rightJudge3 + "您的答案:" + FeedBack.m_judge3 + "\n");textArea_mainFeedback.append(" 第四题: " + EasyJudge.textField_question4.getText() + "\t\t正确答案:" + EasyJudge.m_rightJudge4 + "您的答案:" + FeedBack.m_judge4 + "\n");textArea_mainFeedback.append(" 第五题: " + EasyJudge.textField_question5.getText() + "\t\t正确答案:" + EasyJudge.m_rightJudge5 + "您的答案:" + FeedBack.m_judge5 + "\n");break;case 6:textArea_mainFeedback.append(" 第一题: " + EasyJudge.textField_question1.getText() + "\t\t正确答案:" + EasyJudge.m_rightJudge1 + "您的答案:" + FeedBack.m_judge1 + "\n");textArea_mainFeedback.append(" 第二题: " + EasyJudge.textField_question2.getText() + "\t\t正确答案:" + EasyJudge.m_rightJudge2 + "您的答案:" + FeedBack.m_judge2 + "\n");textArea_mainFeedback.append(" 第三题: " + EasyJudge.textField_question3.getText() + "\t\t正确答案:" + EasyJudge.m_rightJudge3 + "您的答案:" + FeedBack.m_judge3 + "\n");textArea_mainFeedback.append(" 第四题: " + EasyJudge.textField_question4.getText() + "\t\t正确答案:" + EasyJudge.m_rightJudge4 + "您的答案:" + FeedBack.m_judge4 + "\n");textArea_mainFeedback.append(" 第五题: " + EasyJudge.textField_question5.getText() + "\t\t正确答案:" + EasyJudge.m_rightJudge5 + "您的答案:" + FeedBack.m_judge5 + "\n");textArea_mainFeedback.append(" 第六题: " + EasyJudge.textField_question6.getText() + "\t\t正确答案:" + EasyJudge.m_rightJudge6 + "您的答案:" + FeedBack.m_judge6 + "\n");break;case 7:textArea_mainFeedback.append(" 第一题: " + EasyJudge.textField_question1.getText() + "\t\t正确答案:" + EasyJudge.m_rightJudge1 + "您的答案:" + FeedBack.m_judge1 + "\n");textArea_mainFeedback.append(" 第二题: " + EasyJudge.textField_question2.getText() + "\t\t正确答案:" + EasyJudge.m_rightJudge2 + "您的答案:" + FeedBack.m_judge2 + "\n");textArea_mainFeedback.append(" 第三题: " + EasyJudge.textField_question3.getText() + "\t\t正确答案:" + EasyJudge.m_rightJudge3 + "您的答案:" + FeedBack.m_judge3 + "\n");textArea_mainFeedback.append(" 第四题: " + EasyJudge.textField_question4.getText() + "\t\t正确答案:" + EasyJudge.m_rightJudge4 + "您的答案:" + FeedBack.m_judge4 + "\n");textArea_mainFeedback.append(" 第五题: " + EasyJudge.textField_question5.getText() + "\t\t正确答案:" + EasyJudge.m_rightJudge5 + "您的答案:" + FeedBack.m_judge5 + "\n");textArea_mainFeedback.append(" 第六题: " + EasyJudge.textField_question6.getText() + "\t\t正确答案:" + EasyJudge.m_rightJudge6 + "您的答案:" + FeedBack.m_judge6 + "\n");textArea_mainFeedback.append(" 第七题: " + EasyJudge.textField_question7.getText() + "\t\t正确答案:" + EasyJudge.m_rightJudge7 + "您的答案:" + FeedBack.m_judge7 + "\n");break;case 8:textArea_mainFeedback.append(" 第一题: " + EasyJudge.textField_question1.getText() + "\t\t正确答案:" + EasyJudge.m_rightJudge1 + "您的答案:" + FeedBack.m_judge1 + "\n");textArea_mainFeedback.append(" 第二题: " + EasyJudge.textField_question2.getText() + "\t\t正确答案:" + EasyJudge.m_rightJudge2 + "您的答案:" + FeedBack.m_judge2 + "\n");textArea_mainFeedback.append(" 第三题: " + EasyJudge.textField_question3.getText() + "\t\t正确答案:" + EasyJudge.m_rightJudge3 + "您的答案:" + FeedBack.m_judge3 + "\n");textArea_mainFeedback.append(" 第四题: " + EasyJudge.textField_question4.getText() + "\t\t正确答案:" + EasyJudge.m_rightJudge4 + "您的答案:" + FeedBack.m_judge4 + "\n");textArea_mainFeedback.append(" 第五题: " + EasyJudge.textField_question5.getText() + "\t\t正确答案:" + EasyJudge.m_rightJudge5 + "您的答案:" + FeedBack.m_judge5 + "\n");textArea_mainFeedback.append(" 第六题: " + EasyJudge.textField_question6.getText() + "\t\t正确答案:" + EasyJudge.m_rightJudge6 + "您的答案:" + FeedBack.m_judge6 + "\n");textArea_mainFeedback.append(" 第七题: " + EasyJudge.textField_question7.getText() + "\t\t正确答案:" + EasyJudge.m_rightJudge7 + "您的答案:" + FeedBack.m_judge7 + "\n");textArea_mainFeedback.append(" 第八题: " + EasyJudge.textField_question8.getText() + "\t\t正确答案:" + EasyJudge.m_rightJudge8 + "您的答案:" + FeedBack.m_judge8 + "\n");break;case 9:textArea_mainFeedback.append(" 第一题: " + EasyJudge.textField_question1.getText() + "\t\t正确答案:" + EasyJudge.m_rightJudge1 + "您的答案:" + FeedBack.m_judge1 + "\n");textArea_mainFeedback.append(" 第二题: " + EasyJudge.textField_question2.getText() + "\t\t正确答案:" + EasyJudge.m_rightJudge2 + "您的答案:" + FeedBack.m_judge2 + "\n");textArea_mainFeedback.append(" 第三题: " + EasyJudge.textField_question3.getText() + "\t\t正确答案:" + EasyJudge.m_rightJudge3 + "您的答案:" + FeedBack.m_judge3 + "\n");textArea_mainFeedback.append(" 第四题: " + EasyJudge.textField_question4.getText() + "\t\t正确答案:" + EasyJudge.m_rightJudge4 + "您的答案:" + FeedBack.m_judge4 + "\n");textArea_mainFeedback.append(" 第五题: " + EasyJudge.textField_question5.getText() + "\t\t正确答案:" + EasyJudge.m_rightJudge5 + "您的答案:" + FeedBack.m_judge5 + "\n");textArea_mainFeedback.append(" 第六题: " + EasyJudge.textField_question6.getText() + "\t\t正确答案:" + EasyJudge.m_rightJudge6 + "您的答案:" + FeedBack.m_judge6 + "\n");textArea_mainFeedback.append(" 第七题: " + EasyJudge.textField_question7.getText() + "\t\t正确答案:" + EasyJudge.m_rightJudge7 + "您的答案:" + FeedBack.m_judge7 + "\n");textArea_mainFeedback.append(" 第八题: " + EasyJudge.textField_question8.getText() + "\t\t正确答案:" + EasyJudge.m_rightJudge8 + "您的答案:" + FeedBack.m_judge8 + "\n");textArea_mainFeedback.append(" 第九题: " + EasyJudge.textField_question9.getText() + "\t\t正确答案:" + EasyJudge.m_rightJudge9 + "您的答案:" + FeedBack.m_judge9 + "\n");break;case 10:textArea_mainFeedback.append(" 第一题: " + EasyJudge.textField_question1.getText() + "\t\t正确答案:" + EasyJudge.m_rightJudge1 + "您的答案:" + FeedBack.m_judge1 + "\n");textArea_mainFeedback.append(" 第二题: " + EasyJudge.textField_question2.getText() + "\t\t正确答案:" + EasyJudge.m_rightJudge2 + "您的答案:" + FeedBack.m_judge2 + "\n");textArea_mainFeedback.append(" 第三题: " + EasyJudge.textField_question3.getText() + "\t\t正确答案:" + EasyJudge.m_rightJudge3 + "您的答案:" + FeedBack.m_judge3 + "\n");textArea_mainFeedback.append(" 第四题: " + EasyJudge.textField_question4.getText() + "\t\t正确答案:" + EasyJudge.m_rightJudge4 + "您的答案:" + FeedBack.m_judge4 + "\n");textArea_mainFeedback.append(" 第五题: " + EasyJudge.textField_question5.getText() + "\t\t正确答案:" + EasyJudge.m_rightJudge5 + "您的答案:" + FeedBack.m_judge5 + "\n");textArea_mainFeedback.append(" 第六题: " + EasyJudge.textField_question6.getText() + "\t\t正确答案:" + EasyJudge.m_rightJudge6 + "您的答案:" + FeedBack.m_judge6 + "\n");textArea_mainFeedback.append(" 第七题: " + EasyJudge.textField_question7.getText() + "\t\t正确答案:" + EasyJudge.m_rightJudge7 + "您的答案:" + FeedBack.m_judge7 + "\n");textArea_mainFeedback.append(" 第八题: " + EasyJudge.textField_question8.getText() + "\t\t正确答案:" + EasyJudge.m_rightJudge8 + "您的答案:" + FeedBack.m_judge8 + "\n");textArea_mainFeedback.append(" 第九题: " + EasyJudge.textField_question9.getText() + "\t\t正确答案:" + EasyJudge.m_rightJudge9 + "您的答案:" + FeedBack.m_judge9 + "\n");textArea_mainFeedback.append(" 第十题: " + EasyJudge.textField_question10.getText() + "\t\t正确答案:" + EasyJudge.m_rightJudge10 + "您的答案:" + FeedBack.m_judge10 + "\n");break;default:break;} //switchtextArea_mainFeedback.append(EasyJudge.textField_feedback.getText() + "\n\n\n"); //正确率/***************************************************判断题反馈区*****************************************************/} //if if (m_mode.equals("困难")) {textArea_mainFeedback.append("填空题情况: \n");textArea_mainFeedback.append(" 一共 " + HardFillBlank.m_totalBlank + " 题\n");textArea_mainFeedback.append(" 答对 " + HardFillBlank.m_score + " 题\n"); switch(Settings.m_blankAmount) {case 0:break;case 1:textArea_mainFeedback.append(" 第一题: " + HardFillBlank.textField_question0.getText() + " \t正确答案: " + String.valueOf(HardFillBlank.m_right0) + "; 您的答案: " + HardFillBlank.textField_answer0.getText() + "\n"); break; case 2:textArea_mainFeedback.append(" 第一题: " + HardFillBlank.textField_question0.getText() + " \t正确答案: " + String.valueOf(HardFillBlank.m_right0) + "; 您的答案: " + HardFillBlank.textField_answer0.getText() + "\n");textArea_mainFeedback.append(" 第二题: " + HardFillBlank.textField_question5.getText() + "\t正确答案: " + String.valueOf(HardFillBlank.m_right5) + "; 您的答案: " + HardFillBlank.textField_answer5.getText() + "\n");break; case 3:textArea_mainFeedback.append(" 第一题: " + HardFillBlank.textField_question0.getText() + " \t正确答案: " + String.valueOf(HardFillBlank.m_right0) + "; 您的答案: " + HardFillBlank.textField_answer0.getText() + "\n");textArea_mainFeedback.append(" 第二题: " + HardFillBlank.textField_question5.getText() + "\t正确答案: " + String.valueOf(HardFillBlank.m_right5) + "; 您的答案: " + HardFillBlank.textField_answer5.getText() + "\n");textArea_mainFeedback.append(" 第三题: " + HardFillBlank.textField_question1.getText() + " \t正确答案: " + String.valueOf(HardFillBlank.m_right1) + "; 您的答案: " + HardFillBlank.textField_answer1.getText() + "\n");break; case 4:textArea_mainFeedback.append(" 第一题: " + HardFillBlank.textField_question0.getText() + " \t正确答案: " + String.valueOf(HardFillBlank.m_right0) + "; 您的答案: " + HardFillBlank.textField_answer0.getText() + "\n");textArea_mainFeedback.append(" 第二题: " + HardFillBlank.textField_question5.getText() + "\t正确答案: " + String.valueOf(HardFillBlank.m_right5) + "; 您的答案: " + HardFillBlank.textField_answer5.getText() + "\n");textArea_mainFeedback.append(" 第三题: " + HardFillBlank.textField_question1.getText() + " \t正确答案: " + String.valueOf(HardFillBlank.m_right1) + "; 您的答案: " + HardFillBlank.textField_answer1.getText() + "\n");textArea_mainFeedback.append(" 第四题: " + HardFillBlank.textField_question6.getText() + "\t正确答案: " + String.valueOf(HardFillBlank.m_right6) + "; 您的答案: " + HardFillBlank.textField_answer6.getText() + "\n");break;case 5:textArea_mainFeedback.append(" 第一题: " + HardFillBlank.textField_question0.getText() + " \t正确答案: " + String.valueOf(HardFillBlank.m_right0) + "; 您的答案: " + HardFillBlank.textField_answer0.getText() + "\n");textArea_mainFeedback.append(" 第二题: " + HardFillBlank.textField_question5.getText() + "\t正确答案: " + String.valueOf(HardFillBlank.m_right5) + "; 您的答案: " + HardFillBlank.textField_answer5.getText() + "\n");textArea_mainFeedback.append(" 第三题: " + HardFillBlank.textField_question1.getText() + " \t正确答案: " + String.valueOf(HardFillBlank.m_right1) + "; 您的答案: " + HardFillBlank.textField_answer1.getText() + "\n");textArea_mainFeedback.append(" 第四题: " + HardFillBlank.textField_question6.getText() + "\t正确答案: " + String.valueOf(HardFillBlank.m_right6) + "; 您的答案: " + HardFillBlank.textField_answer6.getText() + "\n");textArea_mainFeedback.append(" 第五题: " + HardFillBlank.textField_question2.getText() + "\t\t正确答案: " + String.valueOf(HardFillBlank.m_right2) + "; 您的答案: " + HardFillBlank.textField_answer2.getText() + "\n");break; case 6:textArea_mainFeedback.append(" 第一题: " + HardFillBlank.textField_question0.getText() + " \t正确答案: " + String.valueOf(HardFillBlank.m_right0) + "; 您的答案: " + HardFillBlank.textField_answer0.getText() + "\n");textArea_mainFeedback.append(" 第二题: " + HardFillBlank.textField_question5.getText() + "\t正确答案: " + String.valueOf(HardFillBlank.m_right5) + "; 您的答案: " + HardFillBlank.textField_answer5.getText() + "\n");textArea_mainFeedback.append(" 第三题: " + HardFillBlank.textField_question1.getText() + " \t正确答案: " + String.valueOf(HardFillBlank.m_right1) + "; 您的答案: " + HardFillBlank.textField_answer1.getText() + "\n");textArea_mainFeedback.append(" 第四题: " + HardFillBlank.textField_question6.getText() + "\t正确答案: " + String.valueOf(HardFillBlank.m_right6) + "; 您的答案: " + HardFillBlank.textField_answer6.getText() + "\n");textArea_mainFeedback.append(" 第五题: " + HardFillBlank.textField_question2.getText() + "\t\t正确答案: " + String.valueOf(HardFillBlank.m_right2) + "; 您的答案: " + HardFillBlank.textField_answer2.getText() + "\n");textArea_mainFeedback.append(" 第六题: " + HardFillBlank.textField_question7.getText() + "\t正确答案: " + String.valueOf(HardFillBlank.m_right7) + "; 您的答案: " + HardFillBlank.textField_answer7.getText() + "\n");break; case 7:textArea_mainFeedback.append(" 第一题: " + HardFillBlank.textField_question0.getText() + " \t正确答案: " + String.valueOf(HardFillBlank.m_right0) + "; 您的答案: " + HardFillBlank.textField_answer0.getText() + "\n");textArea_mainFeedback.append(" 第二题: " + HardFillBlank.textField_question5.getText() + "\t正确答案: " + String.valueOf(HardFillBlank.m_right5) + "; 您的答案: " + HardFillBlank.textField_answer5.getText() + "\n");textArea_mainFeedback.append(" 第三题: " + HardFillBlank.textField_question1.getText() + " \t正确答案: " + String.valueOf(HardFillBlank.m_right1) + "; 您的答案: " + HardFillBlank.textField_answer1.getText() + "\n");textArea_mainFeedback.append(" 第四题: " + HardFillBlank.textField_question6.getText() + "\t正确答案: " + String.valueOf(HardFillBlank.m_right6) + "; 您的答案: " + HardFillBlank.textField_answer6.getText() + "\n");textArea_mainFeedback.append(" 第五题: " + HardFillBlank.textField_question2.getText() + "\t\t正确答案: " + String.valueOf(HardFillBlank.m_right2) + "; 您的答案: " + HardFillBlank.textField_answer2.getText() + "\n");textArea_mainFeedback.append(" 第六题: " + HardFillBlank.textField_question7.getText() + "\t正确答案: " + String.valueOf(HardFillBlank.m_right7) + "; 您的答案: " + HardFillBlank.textField_answer7.getText() + "\n");textArea_mainFeedback.append(" 第七题: " + HardFillBlank.textField_question3.getText() + "\t\t正确答案: " + String.valueOf(HardFillBlank.m_right3) + "; 您的答案: " + HardFillBlank.textField_answer3.getText() + "\n");break;case 8:textArea_mainFeedback.append(" 第一题: " + HardFillBlank.textField_question0.getText() + " \t正确答案: " + String.valueOf(HardFillBlank.m_right0) + "; 您的答案: " + HardFillBlank.textField_answer0.getText() + "\n");textArea_mainFeedback.append(" 第二题: " + HardFillBlank.textField_question5.getText() + "\t正确答案: " + String.valueOf(HardFillBlank.m_right5) + "; 您的答案: " + HardFillBlank.textField_answer5.getText() + "\n");textArea_mainFeedback.append(" 第三题: " + HardFillBlank.textField_question1.getText() + " \t正确答案: " + String.valueOf(HardFillBlank.m_right1) + "; 您的答案: " + HardFillBlank.textField_answer1.getText() + "\n");textArea_mainFeedback.append(" 第四题: " + HardFillBlank.textField_question6.getText() + "\t正确答案: " + String.valueOf(HardFillBlank.m_right6) + "; 您的答案: " + HardFillBlank.textField_answer6.getText() + "\n");textArea_mainFeedback.append(" 第五题: " + HardFillBlank.textField_question2.getText() + "\t\t正确答案: " + String.valueOf(HardFillBlank.m_right2) + "; 您的答案: " + HardFillBlank.textField_answer2.getText() + "\n");textArea_mainFeedback.append(" 第六题: " + HardFillBlank.textField_question7.getText() + "\t正确答案: " + String.valueOf(HardFillBlank.m_right7) + "; 您的答案: " + HardFillBlank.textField_answer7.getText() + "\n");textArea_mainFeedback.append(" 第七题: " + HardFillBlank.textField_question3.getText() + "\t\t正确答案: " + String.valueOf(HardFillBlank.m_right3) + "; 您的答案: " + HardFillBlank.textField_answer3.getText() + "\n");textArea_mainFeedback.append(" 第八题: " + HardFillBlank.textField_question8.getText() + "\t正确答案: " + String.valueOf(HardFillBlank.m_right8) + "; 您的答案: " + HardFillBlank.textField_answer8.getText() + "\n");break;case 9:textArea_mainFeedback.append(" 第一题: " + HardFillBlank.textField_question0.getText() + " \t正确答案: " + String.valueOf(HardFillBlank.m_right0) + "; 您的答案: " + HardFillBlank.textField_answer0.getText() + "\n");textArea_mainFeedback.append(" 第二题: " + HardFillBlank.textField_question5.getText() + "\t正确答案: " + String.valueOf(HardFillBlank.m_right5) + "; 您的答案: " + HardFillBlank.textField_answer5.getText() + "\n");textArea_mainFeedback.append(" 第三题: " + HardFillBlank.textField_question1.getText() + " \t正确答案: " + String.valueOf(HardFillBlank.m_right1) + "; 您的答案: " + HardFillBlank.textField_answer1.getText() + "\n");textArea_mainFeedback.append(" 第四题: " + HardFillBlank.textField_question6.getText() + "\t正确答案: " + String.valueOf(HardFillBlank.m_right6) + "; 您的答案: " + HardFillBlank.textField_answer6.getText() + "\n");textArea_mainFeedback.append(" 第五题: " + HardFillBlank.textField_question2.getText() + "\t\t正确答案: " + String.valueOf(HardFillBlank.m_right2) + "; 您的答案: " + HardFillBlank.textField_answer2.getText() + "\n");textArea_mainFeedback.append(" 第六题: " + HardFillBlank.textField_question7.getText() + "\t正确答案: " + String.valueOf(HardFillBlank.m_right7) + "; 您的答案: " + HardFillBlank.textField_answer7.getText() + "\n");textArea_mainFeedback.append(" 第七题: " + HardFillBlank.textField_question3.getText() + "\t\t正确答案: " + String.valueOf(HardFillBlank.m_right3) + "; 您的答案: " + HardFillBlank.textField_answer3.getText() + "\n");textArea_mainFeedback.append(" 第八题: " + HardFillBlank.textField_question8.getText() + "\t正确答案: " + String.valueOf(HardFillBlank.m_right8) + "; 您的答案: " + HardFillBlank.textField_answer8.getText() + "\n");textArea_mainFeedback.append(" 第九题: " + HardFillBlank.textField_question4.getText() + "\t\t正确答案: " + String.valueOf(HardFillBlank.m_right4) + "; 您的答案: " + HardFillBlank.textField_answer4.getText() + "\n");break;case 10:textArea_mainFeedback.append(" 第一题: " + HardFillBlank.textField_question0.getText() + " \t正确答案: " + String.valueOf(HardFillBlank.m_right0) + "; 您的答案: " + HardFillBlank.textField_answer0.getText() + "\n");textArea_mainFeedback.append(" 第二题: " + HardFillBlank.textField_question5.getText() + "\t正确答案: " + String.valueOf(HardFillBlank.m_right5) + "; 您的答案: " + HardFillBlank.textField_answer5.getText() + "\n");textArea_mainFeedback.append(" 第三题: " + HardFillBlank.textField_question1.getText() + " \t正确答案: " + String.valueOf(HardFillBlank.m_right1) + "; 您的答案: " + HardFillBlank.textField_answer1.getText() + "\n");textArea_mainFeedback.append(" 第四题: " + HardFillBlank.textField_question6.getText() + "\t正确答案: " + String.valueOf(HardFillBlank.m_right6) + "; 您的答案: " + HardFillBlank.textField_answer6.getText() + "\n");textArea_mainFeedback.append(" 第五题: " + HardFillBlank.textField_question2.getText() + "\t\t正确答案: " + String.valueOf(HardFillBlank.m_right2) + "; 您的答案: " + HardFillBlank.textField_answer2.getText() + "\n");textArea_mainFeedback.append(" 第六题: " + HardFillBlank.textField_question7.getText() + "\t正确答案: " + String.valueOf(HardFillBlank.m_right7) + "; 您的答案: " + HardFillBlank.textField_answer7.getText() + "\n");textArea_mainFeedback.append(" 第七题: " + HardFillBlank.textField_question3.getText() + "\t\t正确答案: " + String.valueOf(HardFillBlank.m_right3) + "; 您的答案: " + HardFillBlank.textField_answer3.getText() + "\n");textArea_mainFeedback.append(" 第八题: " + HardFillBlank.textField_question8.getText() + "\t正确答案: " + String.valueOf(HardFillBlank.m_right8) + "; 您的答案: " + HardFillBlank.textField_answer8.getText() + "\n");textArea_mainFeedback.append(" 第九题: " + HardFillBlank.textField_question4.getText() + "\t\t正确答案: " + String.valueOf(HardFillBlank.m_right4) + "; 您的答案: " + HardFillBlank.textField_answer4.getText() + "\n");textArea_mainFeedback.append(" 第十题: " + HardFillBlank.textField_question9.getText() + "\t正确答案: " + String.valueOf(HardFillBlank.m_right9) + "; 您的答案: " + HardFillBlank.textField_answer9.getText() + "\n");break;}textArea_mainFeedback.append(HardFillBlank.textField_feedback.getText() + "\n\n\n"); //正确率textArea_mainFeedback.append("选择题情况: \n");textArea_mainFeedback.append(" 一共 " + HardChoice.m_totalChoice + " 题\n");textArea_mainFeedback.append(" 答对 " + HardChoice.m_score + " 题\n");switch (Settings.m_choiceAmount) {case 1:textArea_mainFeedback.append(" 第一题: " + HardChoice.textField_question1.getText() + m_optionContent1 + "\t正确答案:" + HardChoice.m_rightOption1 + "\t您的答案:" + FeedBack.m_choice1 + "\n");break;case 2:textArea_mainFeedback.append(" 第一题: " + HardChoice.textField_question1.getText() + m_optionContent1 + "\t正确答案:" + HardChoice.m_rightOption1 + "\t您的答案:" + FeedBack.m_choice1 + "\n");textArea_mainFeedback.append(" 第二题: " + HardChoice.textField_question2.getText() + m_optionContent2 + "\t正确答案:" + HardChoice.m_rightOption2 + "\t您的答案:" + FeedBack.m_choice2 + "\n");break;case 3:textArea_mainFeedback.append(" 第一题: " + HardChoice.textField_question1.getText() + m_optionContent1 + "\t正确答案:" + HardChoice.m_rightOption1 + "\t您的答案:" + FeedBack.m_choice1 + "\n");textArea_mainFeedback.append(" 第二题: " + HardChoice.textField_question2.getText() + m_optionContent2 + "\t正确答案:" + HardChoice.m_rightOption2 + "\t您的答案:" + FeedBack.m_choice2 + "\n");textArea_mainFeedback.append(" 第三题: " + HardChoice.textField_question3.getText() + m_optionContent3 + "\t正确答案:" + HardChoice.m_rightOption3 + "\t您的答案:" + FeedBack.m_choice3 + "\n");break;case 4:textArea_mainFeedback.append(" 第一题: " + HardChoice.textField_question1.getText() + m_optionContent1 + "\t正确答案:" + HardChoice.m_rightOption1 + "\t您的答案:" + FeedBack.m_choice1 + "\n");textArea_mainFeedback.append(" 第二题: " + HardChoice.textField_question2.getText() + m_optionContent2 + "\t正确答案:" + HardChoice.m_rightOption2 + "\t您的答案:" + FeedBack.m_choice2 + "\n");textArea_mainFeedback.append(" 第三题: " + HardChoice.textField_question3.getText() + m_optionContent3 + "\t正确答案:" + HardChoice.m_rightOption3 + "\t您的答案:" + FeedBack.m_choice3 + "\n");textArea_mainFeedback.append(" 第四题: " + HardChoice.textField_question4.getText() + m_optionContent4 + "\t正确答案:" + HardChoice.m_rightOption4 + "\t您的答案:" + FeedBack.m_choice4 + "\n");break;case 5:textArea_mainFeedback.append(" 第一题: " + HardChoice.textField_question1.getText() + m_optionContent1 + "\t正确答案:" + HardChoice.m_rightOption1 + "\t您的答案:" + FeedBack.m_choice1 + "\n");textArea_mainFeedback.append(" 第二题: " + HardChoice.textField_question2.getText() + m_optionContent2 + "\t正确答案:" + HardChoice.m_rightOption2 + "\t您的答案:" + FeedBack.m_choice2 + "\n");textArea_mainFeedback.append(" 第三题: " + HardChoice.textField_question3.getText() + m_optionContent3 + "\t正确答案:" + HardChoice.m_rightOption3 + "\t您的答案:" + FeedBack.m_choice3 + "\n");textArea_mainFeedback.append(" 第四题: " + HardChoice.textField_question4.getText() + m_optionContent4 + "\t正确答案:" + HardChoice.m_rightOption4 + "\t您的答案:" + FeedBack.m_choice4 + "\n");textArea_mainFeedback.append(" 第五题: " + HardChoice.textField_question5.getText() + m_optionContent5 + "\t正确答案:" + HardChoice.m_rightOption5 + "\t您的答案:" + FeedBack.m_choice5 + "\n");break;case 6:textArea_mainFeedback.append(" 第一题: " + HardChoice.textField_question1.getText() + m_optionContent1 + "\t正确答案:" + HardChoice.m_rightOption1 + "\t您的答案:" + FeedBack.m_choice1 + "\n");textArea_mainFeedback.append(" 第二题: " + HardChoice.textField_question2.getText() + m_optionContent2 + "\t正确答案:" + HardChoice.m_rightOption2 + "\t您的答案:" + FeedBack.m_choice2 + "\n");textArea_mainFeedback.append(" 第三题: " + HardChoice.textField_question3.getText() + m_optionContent3 + "\t正确答案:" + HardChoice.m_rightOption3 + "\t您的答案:" + FeedBack.m_choice3 + "\n");textArea_mainFeedback.append(" 第四题: " + HardChoice.textField_question4.getText() + m_optionContent4 + "\t正确答案:" + HardChoice.m_rightOption4 + "\t您的答案:" + FeedBack.m_choice4 + "\n");textArea_mainFeedback.append(" 第五题: " + HardChoice.textField_question5.getText() + m_optionContent5 + "\t正确答案:" + HardChoice.m_rightOption5 + "\t您的答案:" + FeedBack.m_choice5 + "\n");textArea_mainFeedback.append(" 第六题: " + HardChoice.textField_question6.getText() + m_optionContent6 + "\t正确答案:" + HardChoice.m_rightOption6 + "\t您的答案:" + FeedBack.m_choice6 + "\n");break;case 7:textArea_mainFeedback.append(" 第一题: " + HardChoice.textField_question1.getText() + m_optionContent1 + "\t正确答案:" + HardChoice.m_rightOption1 + "\t您的答案:" + FeedBack.m_choice1 + "\n");textArea_mainFeedback.append(" 第二题: " + HardChoice.textField_question2.getText() + m_optionContent2 + "\t正确答案:" + HardChoice.m_rightOption2 + "\t您的答案:" + FeedBack.m_choice2 + "\n");textArea_mainFeedback.append(" 第三题: " + HardChoice.textField_question3.getText() + m_optionContent3 + "\t正确答案:" + HardChoice.m_rightOption3 + "\t您的答案:" + FeedBack.m_choice3 + "\n");textArea_mainFeedback.append(" 第四题: " + HardChoice.textField_question4.getText() + m_optionContent4 + "\t正确答案:" + HardChoice.m_rightOption4 + "\t您的答案:" + FeedBack.m_choice4 + "\n");textArea_mainFeedback.append(" 第五题: " + HardChoice.textField_question5.getText() + m_optionContent5 + "\t正确答案:" + HardChoice.m_rightOption5 + "\t您的答案:" + FeedBack.m_choice5 + "\n");textArea_mainFeedback.append(" 第六题: " + HardChoice.textField_question6.getText() + m_optionContent6 + "\t正确答案:" + HardChoice.m_rightOption6 + "\t您的答案:" + FeedBack.m_choice6 + "\n");textArea_mainFeedback.append(" 第七题: " + HardChoice.textField_question7.getText() + m_optionContent7 + "\t正确答案:" + HardChoice.m_rightOption7 + "\t您的答案:" + FeedBack.m_choice7 + "\n");break;case 8:textArea_mainFeedback.append(" 第一题: " + HardChoice.textField_question1.getText() + m_optionContent1 + "\t正确答案:" + HardChoice.m_rightOption1 + "\t您的答案:" + FeedBack.m_choice1 + "\n");textArea_mainFeedback.append(" 第二题: " + HardChoice.textField_question2.getText() + m_optionContent2 + "\t正确答案:" + HardChoice.m_rightOption2 + "\t您的答案:" + FeedBack.m_choice2 + "\n");textArea_mainFeedback.append(" 第三题: " + HardChoice.textField_question3.getText() + m_optionContent3 + "\t正确答案:" + HardChoice.m_rightOption3 + "\t您的答案:" + FeedBack.m_choice3 + "\n");textArea_mainFeedback.append(" 第四题: " + HardChoice.textField_question4.getText() + m_optionContent4 + "\t正确答案:" + HardChoice.m_rightOption4 + "\t您的答案:" + FeedBack.m_choice4 + "\n");textArea_mainFeedback.append(" 第五题: " + HardChoice.textField_question5.getText() + m_optionContent5 + "\t正确答案:" + HardChoice.m_rightOption5 + "\t您的答案:" + FeedBack.m_choice5 + "\n");textArea_mainFeedback.append(" 第六题: " + HardChoice.textField_question6.getText() + m_optionContent6 + "\t正确答案:" + HardChoice.m_rightOption6 + "\t您的答案:" + FeedBack.m_choice6 + "\n");textArea_mainFeedback.append(" 第七题: " + HardChoice.textField_question7.getText() + m_optionContent7 + "\t正确答案:" + HardChoice.m_rightOption7 + "\t您的答案:" + FeedBack.m_choice7 + "\n");textArea_mainFeedback.append(" 第八题: " + HardChoice.textField_question8.getText() + m_optionContent8 + "\t正确答案:" + HardChoice.m_rightOption8 + "\t您的答案:" + FeedBack.m_choice8 + "\n");break;case 9:textArea_mainFeedback.append(" 第一题: " + HardChoice.textField_question1.getText() + m_optionContent1 + "\t正确答案:" + HardChoice.m_rightOption1 + "\t您的答案:" + FeedBack.m_choice1 + "\n");textArea_mainFeedback.append(" 第二题: " + HardChoice.textField_question2.getText() + m_optionContent2 + "\t正确答案:" + HardChoice.m_rightOption2 + "\t您的答案:" + FeedBack.m_choice2 + "\n");textArea_mainFeedback.append(" 第三题: " + HardChoice.textField_question3.getText() + m_optionContent3 + "\t正确答案:" + HardChoice.m_rightOption3 + "\t您的答案:" + FeedBack.m_choice3 + "\n");textArea_mainFeedback.append(" 第四题: " + HardChoice.textField_question4.getText() + m_optionContent4 + "\t正确答案:" + HardChoice.m_rightOption4 + "\t您的答案:" + FeedBack.m_choice4 + "\n");textArea_mainFeedback.append(" 第五题: " + HardChoice.textField_question5.getText() + m_optionContent5 + "\t正确答案:" + HardChoice.m_rightOption5 + "\t您的答案:" + FeedBack.m_choice5 + "\n");textArea_mainFeedback.append(" 第六题: " + HardChoice.textField_question6.getText() + m_optionContent6 + "\t正确答案:" + HardChoice.m_rightOption6 + "\t您的答案:" + FeedBack.m_choice6 + "\n");textArea_mainFeedback.append(" 第七题: " + HardChoice.textField_question7.getText() + m_optionContent7 + "\t正确答案:" + HardChoice.m_rightOption7 + "\t您的答案:" + FeedBack.m_choice7 + "\n");textArea_mainFeedback.append(" 第八题: " + HardChoice.textField_question8.getText() + m_optionContent8 + "\t正确答案:" + HardChoice.m_rightOption8 + "\t您的答案:" + FeedBack.m_choice8 + "\n");textArea_mainFeedback.append(" 第九题: " + HardChoice.textField_question9.getText() + m_optionContent9 + "\t正确答案:" + HardChoice.m_rightOption9 + "\t您的答案:" + FeedBack.m_choice9 + "\n");break;case 10:textArea_mainFeedback.append(" 第一题: " + HardChoice.textField_question1.getText() + m_optionContent1 + "\t正确答案:" + HardChoice.m_rightOption1 + "\t您的答案:" + FeedBack.m_choice1 + "\n");textArea_mainFeedback.append(" 第二题: " + HardChoice.textField_question2.getText() + m_optionContent2 + "\t正确答案:" + HardChoice.m_rightOption2 + "\t您的答案:" + FeedBack.m_choice2 + "\n");textArea_mainFeedback.append(" 第三题: " + HardChoice.textField_question3.getText() + m_optionContent3 + "\t正确答案:" + HardChoice.m_rightOption3 + "\t您的答案:" + FeedBack.m_choice3 + "\n");textArea_mainFeedback.append(" 第四题: " + HardChoice.textField_question4.getText() + m_optionContent4 + "\t正确答案:" + HardChoice.m_rightOption4 + "\t您的答案:" + FeedBack.m_choice4 + "\n");textArea_mainFeedback.append(" 第五题: " + HardChoice.textField_question5.getText() + m_optionContent5 + "\t正确答案:" + HardChoice.m_rightOption5 + "\t您的答案:" + FeedBack.m_choice5 + "\n");textArea_mainFeedback.append(" 第六题: " + HardChoice.textField_question6.getText() + m_optionContent6 + "\t正确答案:" + HardChoice.m_rightOption6 + "\t您的答案:" + FeedBack.m_choice6 + "\n");textArea_mainFeedback.append(" 第七题: " + HardChoice.textField_question7.getText() + m_optionContent7 + "\t正确答案:" + HardChoice.m_rightOption7 + "\t您的答案:" + FeedBack.m_choice7 + "\n");textArea_mainFeedback.append(" 第八题: " + HardChoice.textField_question8.getText() + m_optionContent8 + "\t正确答案:" + HardChoice.m_rightOption8 + "\t您的答案:" + FeedBack.m_choice8 + "\n");textArea_mainFeedback.append(" 第九题: " + HardChoice.textField_question9.getText() + m_optionContent9 + "\t正确答案:" + HardChoice.m_rightOption9 + "\t您的答案:" + FeedBack.m_choice9 + "\n");textArea_mainFeedback.append(" 第十题: " + HardChoice.textField_question10.getText() + m_optionContent10 + "\t正确答案:" + HardChoice.m_rightOption10 + "\t您的答案:" + FeedBack.m_choice10 + "\n");break;default:break;}textArea_mainFeedback.append(HardChoice.textField_feedback.getText() + "\n\n\n"); //正确率textArea_mainFeedback.append("判断题情况: \n");textArea_mainFeedback.append(" 一共 " + HardJudge.m_totalJudge + " 题\n");textArea_mainFeedback.append(" 答对 " + HardJudge.m_score + " 题\n");switch(Settings.m_judgeAmount) {case 1:textArea_mainFeedback.append(" 第一题: " + HardJudge.textField_question1.getText() + "\t\t正确答案:" + HardJudge.m_rightJudge1 + "您的答案:" + FeedBack.m_judge1 + "\n");break;case 2:textArea_mainFeedback.append(" 第一题: " + HardJudge.textField_question1.getText() + "\t\t正确答案:" + HardJudge.m_rightJudge1 + "您的答案:" + FeedBack.m_judge1 + "\n");textArea_mainFeedback.append(" 第二题: " + HardJudge.textField_question2.getText() + "\t\t正确答案:" + HardJudge.m_rightJudge2 + "您的答案:" + FeedBack.m_judge2 + "\n");break;case 3:textArea_mainFeedback.append(" 第一题: " + HardJudge.textField_question1.getText() + "\t\t正确答案:" + HardJudge.m_rightJudge1 + "您的答案:" + FeedBack.m_judge1 + "\n");textArea_mainFeedback.append(" 第二题: " + HardJudge.textField_question2.getText() + "\t\t正确答案:" + HardJudge.m_rightJudge2 + "您的答案:" + FeedBack.m_judge2 + "\n");textArea_mainFeedback.append(" 第三题: " + HardJudge.textField_question3.getText() + "\t\t正确答案:" + HardJudge.m_rightJudge3 + "您的答案:" + FeedBack.m_judge3 + "\n");break;case 4:textArea_mainFeedback.append(" 第一题: " + HardJudge.textField_question1.getText() + "\t\t正确答案:" + HardJudge.m_rightJudge1 + "您的答案:" + FeedBack.m_judge1 + "\n");textArea_mainFeedback.append(" 第二题: " + HardJudge.textField_question2.getText() + "\t\t正确答案:" + HardJudge.m_rightJudge2 + "您的答案:" + FeedBack.m_judge2 + "\n");textArea_mainFeedback.append(" 第三题: " + HardJudge.textField_question3.getText() + "\t\t正确答案:" + HardJudge.m_rightJudge3 + "您的答案:" + FeedBack.m_judge3 + "\n");textArea_mainFeedback.append(" 第四题: " + HardJudge.textField_question4.getText() + "\t\t正确答案:" + HardJudge.m_rightJudge4 + "您的答案:" + FeedBack.m_judge4 + "\n");break;case 5:textArea_mainFeedback.append(" 第一题: " + HardJudge.textField_question1.getText() + "\t\t正确答案:" + HardJudge.m_rightJudge1 + "您的答案:" + FeedBack.m_judge1 + "\n");textArea_mainFeedback.append(" 第二题: " + HardJudge.textField_question2.getText() + "\t\t正确答案:" + HardJudge.m_rightJudge2 + "您的答案:" + FeedBack.m_judge2 + "\n");textArea_mainFeedback.append(" 第三题: " + HardJudge.textField_question3.getText() + "\t\t正确答案:" + HardJudge.m_rightJudge3 + "您的答案:" + FeedBack.m_judge3 + "\n");textArea_mainFeedback.append(" 第四题: " + HardJudge.textField_question4.getText() + "\t\t正确答案:" + HardJudge.m_rightJudge4 + "您的答案:" + FeedBack.m_judge4 + "\n");textArea_mainFeedback.append(" 第五题: " + HardJudge.textField_question5.getText() + "\t\t正确答案:" + HardJudge.m_rightJudge5 + "您的答案:" + FeedBack.m_judge5 + "\n");break;case 6:textArea_mainFeedback.append(" 第一题: " + HardJudge.textField_question1.getText() + "\t\t正确答案:" + HardJudge.m_rightJudge1 + "您的答案:" + FeedBack.m_judge1 + "\n");textArea_mainFeedback.append(" 第二题: " + HardJudge.textField_question2.getText() + "\t\t正确答案:" + HardJudge.m_rightJudge2 + "您的答案:" + FeedBack.m_judge2 + "\n");textArea_mainFeedback.append(" 第三题: " + HardJudge.textField_question3.getText() + "\t\t正确答案:" + HardJudge.m_rightJudge3 + "您的答案:" + FeedBack.m_judge3 + "\n");textArea_mainFeedback.append(" 第四题: " + HardJudge.textField_question4.getText() + "\t\t正确答案:" + HardJudge.m_rightJudge4 + "您的答案:" + FeedBack.m_judge4 + "\n");textArea_mainFeedback.append(" 第五题: " + HardJudge.textField_question5.getText() + "\t\t正确答案:" + HardJudge.m_rightJudge5 + "您的答案:" + FeedBack.m_judge5 + "\n");textArea_mainFeedback.append(" 第六题: " + HardJudge.textField_question6.getText() + "\t\t正确答案:" + HardJudge.m_rightJudge6 + "您的答案:" + FeedBack.m_judge6 + "\n");break;case 7:textArea_mainFeedback.append(" 第一题: " + HardJudge.textField_question1.getText() + "\t\t正确答案:" + HardJudge.m_rightJudge1 + "您的答案:" + FeedBack.m_judge1 + "\n");textArea_mainFeedback.append(" 第二题: " + HardJudge.textField_question2.getText() + "\t\t正确答案:" + HardJudge.m_rightJudge2 + "您的答案:" + FeedBack.m_judge2 + "\n");textArea_mainFeedback.append(" 第三题: " + HardJudge.textField_question3.getText() + "\t\t正确答案:" + HardJudge.m_rightJudge3 + "您的答案:" + FeedBack.m_judge3 + "\n");textArea_mainFeedback.append(" 第四题: " + HardJudge.textField_question4.getText() + "\t\t正确答案:" + HardJudge.m_rightJudge4 + "您的答案:" + FeedBack.m_judge4 + "\n");textArea_mainFeedback.append(" 第五题: " + HardJudge.textField_question5.getText() + "\t\t正确答案:" + HardJudge.m_rightJudge5 + "您的答案:" + FeedBack.m_judge5 + "\n");textArea_mainFeedback.append(" 第六题: " + HardJudge.textField_question6.getText() + "\t\t正确答案:" + HardJudge.m_rightJudge6 + "您的答案:" + FeedBack.m_judge6 + "\n");textArea_mainFeedback.append(" 第七题: " + HardJudge.textField_question7.getText() + "\t\t正确答案:" + HardJudge.m_rightJudge7 + "您的答案:" + FeedBack.m_judge7 + "\n");break;case 8:textArea_mainFeedback.append(" 第一题: " + HardJudge.textField_question1.getText() + "\t\t正确答案:" + HardJudge.m_rightJudge1 + "您的答案:" + FeedBack.m_judge1 + "\n");textArea_mainFeedback.append(" 第二题: " + HardJudge.textField_question2.getText() + "\t\t正确答案:" + HardJudge.m_rightJudge2 + "您的答案:" + FeedBack.m_judge2 + "\n");textArea_mainFeedback.append(" 第三题: " + HardJudge.textField_question3.getText() + "\t\t正确答案:" + HardJudge.m_rightJudge3 + "您的答案:" + FeedBack.m_judge3 + "\n");textArea_mainFeedback.append(" 第四题: " + HardJudge.textField_question4.getText() + "\t\t正确答案:" + HardJudge.m_rightJudge4 + "您的答案:" + FeedBack.m_judge4 + "\n");textArea_mainFeedback.append(" 第五题: " + HardJudge.textField_question5.getText() + "\t\t正确答案:" + HardJudge.m_rightJudge5 + "您的答案:" + FeedBack.m_judge5 + "\n");textArea_mainFeedback.append(" 第六题: " + HardJudge.textField_question6.getText() + "\t\t正确答案:" + HardJudge.m_rightJudge6 + "您的答案:" + FeedBack.m_judge6 + "\n");textArea_mainFeedback.append(" 第七题: " + HardJudge.textField_question7.getText() + "\t\t正确答案:" + HardJudge.m_rightJudge7 + "您的答案:" + FeedBack.m_judge7 + "\n");textArea_mainFeedback.append(" 第八题: " + HardJudge.textField_question8.getText() + "\t\t正确答案:" + HardJudge.m_rightJudge8 + "您的答案:" + FeedBack.m_judge8 + "\n");break;case 9:textArea_mainFeedback.append(" 第一题: " + HardJudge.textField_question1.getText() + "\t\t正确答案:" + HardJudge.m_rightJudge1 + "您的答案:" + FeedBack.m_judge1 + "\n");textArea_mainFeedback.append(" 第二题: " + HardJudge.textField_question2.getText() + "\t\t正确答案:" + HardJudge.m_rightJudge2 + "您的答案:" + FeedBack.m_judge2 + "\n");textArea_mainFeedback.append(" 第三题: " + HardJudge.textField_question3.getText() + "\t\t正确答案:" + HardJudge.m_rightJudge3 + "您的答案:" + FeedBack.m_judge3 + "\n");textArea_mainFeedback.append(" 第四题: " + HardJudge.textField_question4.getText() + "\t\t正确答案:" + HardJudge.m_rightJudge4 + "您的答案:" + FeedBack.m_judge4 + "\n");textArea_mainFeedback.append(" 第五题: " + HardJudge.textField_question5.getText() + "\t\t正确答案:" + HardJudge.m_rightJudge5 + "您的答案:" + FeedBack.m_judge5 + "\n");textArea_mainFeedback.append(" 第六题: " + HardJudge.textField_question6.getText() + "\t\t正确答案:" + HardJudge.m_rightJudge6 + "您的答案:" + FeedBack.m_judge6 + "\n");textArea_mainFeedback.append(" 第七题: " + HardJudge.textField_question7.getText() + "\t\t正确答案:" + HardJudge.m_rightJudge7 + "您的答案:" + FeedBack.m_judge7 + "\n");textArea_mainFeedback.append(" 第八题: " + HardJudge.textField_question8.getText() + "\t\t正确答案:" + HardJudge.m_rightJudge8 + "您的答案:" + FeedBack.m_judge8 + "\n");textArea_mainFeedback.append(" 第九题: " + HardJudge.textField_question9.getText() + "\t\t正确答案:" + HardJudge.m_rightJudge9 + "您的答案:" + FeedBack.m_judge9 + "\n");break;case 10:textArea_mainFeedback.append(" 第一题: " + HardJudge.textField_question1.getText() + "\t\t正确答案:" + HardJudge.m_rightJudge1 + "您的答案:" + FeedBack.m_judge1 + "\n");textArea_mainFeedback.append(" 第二题: " + HardJudge.textField_question2.getText() + "\t\t正确答案:" + HardJudge.m_rightJudge2 + "您的答案:" + FeedBack.m_judge2 + "\n");textArea_mainFeedback.append(" 第三题: " + HardJudge.textField_question3.getText() + "\t\t正确答案:" + HardJudge.m_rightJudge3 + "您的答案:" + FeedBack.m_judge3 + "\n");textArea_mainFeedback.append(" 第四题: " + HardJudge.textField_question4.getText() + "\t\t正确答案:" + HardJudge.m_rightJudge4 + "您的答案:" + FeedBack.m_judge4 + "\n");textArea_mainFeedback.append(" 第五题: " + HardJudge.textField_question5.getText() + "\t\t正确答案:" + HardJudge.m_rightJudge5 + "您的答案:" + FeedBack.m_judge5 + "\n");textArea_mainFeedback.append(" 第六题: " + HardJudge.textField_question6.getText() + "\t\t正确答案:" + HardJudge.m_rightJudge6 + "您的答案:" + FeedBack.m_judge6 + "\n");textArea_mainFeedback.append(" 第七题: " + HardJudge.textField_question7.getText() + "\t\t正确答案:" + HardJudge.m_rightJudge7 + "您的答案:" + FeedBack.m_judge7 + "\n");textArea_mainFeedback.append(" 第八题: " + HardJudge.textField_question8.getText() + "\t\t正确答案:" + HardJudge.m_rightJudge8 + "您的答案:" + FeedBack.m_judge8 + "\n");textArea_mainFeedback.append(" 第九题: " + HardJudge.textField_question9.getText() + "\t\t正确答案:" + HardJudge.m_rightJudge9 + "您的答案:" + FeedBack.m_judge9 + "\n");textArea_mainFeedback.append(" 第十题: " + HardJudge.textField_question10.getText() + "\t\t正确答案:" + HardJudge.m_rightJudge10 + "您的答案:" + FeedBack.m_judge10 + "\n");break;default:break;} //switchtextArea_mainFeedback.append(HardJudge.textField_feedback.getText() + "\n\n\n"); //正确率} textArea_mainFeedback.setFont(new Font("Monospaced", Font.PLAIN, 22)); textArea_mainFeedback.setBackground(Color.WHITE); textArea_mainFeedback.setBounds(0, 80, 750, 275); /*使滚动条一开始出现在顶部,默认状态为出现在底部*/ textArea_mainFeedback.setSelectionStart(0); textArea_mainFeedback.setSelectionEnd(0); JScrollPane scrollPane = new JScrollPane(); scrollPane.setBounds(0, 80, 750, 524); f.getContentPane().add(scrollPane); scrollPane.setViewportView(textArea_mainFeedback); /******************************导出结果按钮**********************************/ JButton button_exportResult = new JButton("导出结果"); //导出的.txt文档存在D盘根目录下边 button_exportResult.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { File file_feedback = new File("D:/成绩反馈.txt"); try {FileOutputStream out = new FileOutputStream(file_feedback);try {byte[] fileContent = textArea_mainFeedback.getText().replaceAll("\n", "\r\n").getBytes();out.write(fileContent);} catch (IOException e) {e.printStackTrace();}} catch (FileNotFoundException e) {e.printStackTrace();} } }); button_exportResult.setFont(new Font("宋体", Font.PLAIN, 25)); button_exportResult.setBounds(86, 627, 140, 50); f.getContentPane().add(button_exportResult); /******************************导出结果按钮**********************************/ /******************************退出程序按钮**********************************/ JButton button_exit = new JButton("退出程序"); button_exit.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {f.dispose(); //关闭当前页面}}); button_exit.setFont(new Font("宋体", Font.PLAIN, 25)); button_exit.setBounds(508, 627, 140, 50); f.getContentPane().add(button_exit); } public static void main(String[] args) {giveFeedback();}}
阅读全文
0 0
- 用JavaSwing写一个小学生用的四则运算自测程序
- 小学生四则运算的出题程序,这回用的是android写的
- 用汇编语言写一个四则运算
- 用javaSwing和mysql数据库做的一个登录页面
- 偶写的一个对四则运算的表达式进行处理的小程序.
- 一个计算复数四则运算的小程序
- 小学生自测系统
- 小学生自测系统
- 自己写的一个复数四则运算的一个类
- 用C#写的四则运算类(包括括号运算)
- 用单片机加LCD写的混合四则运算计算器
- 用ASP写的一个转换程序
- 用java写的一个压缩程序
- 一个用JAVA写的画图程序
- 用php写的一个daemon程序
- 用VC写的一个恶作剧程序
- 用lucene写的一个小程序
- 用js写的一个红绿灯程序
- CS231n学习笔记
- NOIP Dp基本套路大全
- 爬取拉钩
- 例说STM32F7高速缓存——Cache一致性问题(三)
- Mysql插入数据 Incorrect string value: '\xF0\x9F\x98\x84
- 用JavaSwing写一个小学生用的四则运算自测程序
- 求最短通路值
- UVA 140 全排列+暴力
- Leetcode 56. Merge Intervals
- 深度探索C++ 对象模型【第二章2】
- 黑科技之手机与电脑之间的远程管理
- bzoj 3679: 数字之积
- msp430输出PWM波
- JavaScript