mirror of
https://github.com/This-weiyuqing/javaAutoScore.git
synced 2026-10-17 18:55:31 +08:00
update
I don't know what and why i update it.
This commit is contained in:
1 parent
38770ae9d6
commit
1347614e57
15 files changed
+145
-33
No files matched your search
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2020 魏遇卿 All Rights Reserved.
|
||||||
|
* FileName: a.java
|
||||||
|
* @author: 魏遇卿@date: 2020/6/19 下午8:02@version: 1.0
|
||||||
|
* E-mail:358614401@qq.com
|
||||||
|
* Code with UTF-8
|
||||||
|
*/
|
||||||
|
|
||||||
|
package autoScore;
|
||||||
|
|
||||||
|
public class a {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
int a=1;
|
||||||
|
if (a <10) {
|
||||||
|
a++;
|
||||||
|
|
||||||
|
}
|
||||||
|
System.out.println(a);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,5 +8,34 @@
|
|||||||
|
|
||||||
package autoScore;
|
package autoScore;
|
||||||
|
|
||||||
|
import java.io.*;
|
||||||
|
|
||||||
public class answer {
|
public class answer {
|
||||||
}
|
public static File answer(int i) {
|
||||||
|
File srcFile = new File("D:\\WindowsCToD\\fire\\GeneticsMultipleChoice\\Answer");
|
||||||
|
File[] fileArr = srcFile.listFiles();
|
||||||
|
return fileArr[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static char readFireAnswer(int q) throws FileNotFoundException, IOException {
|
||||||
|
File filepath = answer(q);
|
||||||
|
FileReader rader = new FileReader(filepath);
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
String s = "";
|
||||||
|
BufferedReader br = new BufferedReader(new FileReader(filepath));
|
||||||
|
|
||||||
|
while ((s = br.readLine()) != null) {
|
||||||
|
sb.append(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
br.close();
|
||||||
|
String str = sb.toString();
|
||||||
|
char ch[]=str.toCharArray();
|
||||||
|
char answer = ch[0];
|
||||||
|
return answer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) throws IOException {
|
||||||
|
System.out.println(readFireAnswer(0));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,14 +7,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
package autoScore;
|
package autoScore;
|
||||||
import autoScore.userIn;
|
|
||||||
import autoScore.*;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class mainDo{
|
public class mainDo{
|
||||||
public static void main(String[] args) throws IOException {
|
public static void main(String[] args) throws IOException {
|
||||||
int score=0;
|
//int score=0;
|
||||||
mainGUI gui=new mainGUI();
|
mainGUI gui=new mainGUI();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+83
-27
@@ -14,27 +14,33 @@ import java.awt.event.ActionEvent;
|
|||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import static autoScore.answer.readFireAnswer;
|
||||||
import static autoScore.question.readFile;
|
import static autoScore.question.readFile;
|
||||||
import static autoScore.score.getScore;
|
import static autoScore.score.getScore;
|
||||||
|
|
||||||
public class mainGUI extends JFrame implements ActionListener {
|
public class mainGUI extends JFrame implements ActionListener {
|
||||||
|
// public static JTextField questionStudent;
|
||||||
|
JTextField questionStudent = new JTextField("问题的位置");
|
||||||
|
//GridBagLayout questionText =new GridBagLayout();
|
||||||
|
// questionStudent.setLineWrap(true);
|
||||||
|
int score;
|
||||||
|
Container c;//创建主容器
|
||||||
private JTextArea question;
|
private JTextArea question;
|
||||||
private JButton A;
|
private JButton A;
|
||||||
private JButton B;
|
private JButton B;
|
||||||
private JButton C;
|
private JButton C;
|
||||||
private JButton D;
|
private JButton D;
|
||||||
int score;
|
|
||||||
Container c;//创建主容器
|
|
||||||
//构造方法
|
//构造方法
|
||||||
public mainGUI() throws IOException {
|
public mainGUI() throws IOException {
|
||||||
//创建窗口容器
|
//创建窗口容器
|
||||||
super("Auto score to exam");
|
super("Auto score to exam");
|
||||||
/* this.setBounds(100,100,100,100);*/
|
/* this.setBounds(100,100,100,100);*/
|
||||||
//获取主容器并设置为网格组布局
|
//获取主容器并设置为网格组布局
|
||||||
c=this.getContentPane();
|
c = this.getContentPane();
|
||||||
c.setLayout(null);
|
c.setLayout(null);
|
||||||
this.setVisible(true);
|
this.setVisible(true);
|
||||||
this.setSize(900,300);//设置窗口大小
|
this.setSize(900, 300);//设置窗口大小
|
||||||
this.setResizable(false);//设置窗口固定大小
|
this.setResizable(false);//设置窗口固定大小
|
||||||
this.setLocationRelativeTo(null);//设置窗口居中
|
this.setLocationRelativeTo(null);//设置窗口居中
|
||||||
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//设置默认关闭操作
|
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//设置默认关闭操作
|
||||||
@@ -42,11 +48,12 @@ public class mainGUI extends JFrame implements ActionListener {
|
|||||||
//网格组布局管理器
|
//网格组布局管理器
|
||||||
|
|
||||||
//创建问题显示位置
|
//创建问题显示位置
|
||||||
JTextArea questionStudent = new JTextArea("这是问题的位置andFuckJavaGUI");
|
//JTextArea questionStudent = new JTextArea("这是问题的位置andFuckJavaGUI");
|
||||||
GridBagLayout questtionText = new GridBagLayout();
|
// questionStudent
|
||||||
questionStudent.setBounds(0,0,900,200);
|
//GridBagLayout questtionText = new GridBagLayout();
|
||||||
questionStudent.setText(readFile(11));//更改标签内容
|
questionStudent.setBounds(0, 0, 900, 200);
|
||||||
questionStudent.setLineWrap(true);
|
questionStudent.setText(readFile(0));//更改标签内容
|
||||||
|
//questionStudent.setLineWrap(true);
|
||||||
questionStudent.setEditable(false);
|
questionStudent.setEditable(false);
|
||||||
/* JTextField textAreaOutput = new JTextField();
|
/* JTextField textAreaOutput = new JTextField();
|
||||||
questionStudent.add(new JScrollPane(textAreaOutput));*/
|
questionStudent.add(new JScrollPane(textAreaOutput));*/
|
||||||
@@ -56,9 +63,9 @@ public class mainGUI extends JFrame implements ActionListener {
|
|||||||
|
|
||||||
//pack();
|
//pack();
|
||||||
//字体
|
//字体
|
||||||
questionStudent.setFont(new Font("微软雅黑",Font.BOLD,20));
|
questionStudent.setFont(new Font("微软雅黑", Font.BOLD, 20));
|
||||||
|
|
||||||
// setLayout(null);
|
// setLayout(null);
|
||||||
|
|
||||||
A = new JButton("A");
|
A = new JButton("A");
|
||||||
A.addActionListener(this);
|
A.addActionListener(this);
|
||||||
@@ -87,27 +94,76 @@ public class mainGUI extends JFrame implements ActionListener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
String str = new String();
|
//int用来存储现在是第几题
|
||||||
if(e.getActionCommand().equals("A")){
|
int whatQuestionW = 0;
|
||||||
str= "A";
|
if (whatQuestionW < 20) {
|
||||||
getScore(score,A,anwer);
|
|
||||||
}
|
|
||||||
if (e.getActionCommand().equals("B")){
|
|
||||||
str= "B";
|
|
||||||
|
|
||||||
}
|
|
||||||
if (e.getActionCommand().equals("C")){
|
|
||||||
str= "C";
|
|
||||||
|
|
||||||
}
|
//int whatQuestionW =0;
|
||||||
if (e.getActionCommand().equals("D")){
|
String str = new String();
|
||||||
str= "D";
|
if (e.getActionCommand().equals("A")) {
|
||||||
|
str = "A";
|
||||||
|
chooseDo(str, whatQuestionW);
|
||||||
|
}
|
||||||
|
/*str = "A";
|
||||||
|
char ch[] = str.toCharArray();
|
||||||
|
char answer = ch[0];
|
||||||
|
|
||||||
|
try {
|
||||||
|
getScore(score, answer, readFireAnswer(whatQuestionW));
|
||||||
|
} catch (IOException ioException) {
|
||||||
|
ioException.printStackTrace();
|
||||||
|
}
|
||||||
|
whatQuestionW++;
|
||||||
|
System.out.println(whatQuestionW);
|
||||||
|
try {
|
||||||
|
questionStudent.setText(readFile(1));
|
||||||
|
} catch (IOException ioException) {
|
||||||
|
ioException.printStackTrace();
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
if (e.getActionCommand().equals("B")) {
|
||||||
|
str = "B";
|
||||||
|
chooseDo(str, whatQuestionW);
|
||||||
|
// System.out.println(whatQuestionW);
|
||||||
|
}
|
||||||
|
if (e.getActionCommand().equals("C")) {
|
||||||
|
str = "C";
|
||||||
|
chooseDo(str, whatQuestionW);
|
||||||
|
}
|
||||||
|
if (e.getActionCommand().equals("D")) {
|
||||||
|
str = "D";
|
||||||
|
chooseDo(str, whatQuestionW);
|
||||||
|
}
|
||||||
|
whatQuestionW++;
|
||||||
|
} else {
|
||||||
|
//这里写最后结果被写入文件夹啊
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//按键之后要做的事
|
||||||
|
public void chooseDo(String str, int whatQuestionW) {
|
||||||
|
//str = "A";
|
||||||
|
char ch[] = str.toCharArray();
|
||||||
|
char answer = ch[0];
|
||||||
|
|
||||||
|
try {
|
||||||
|
getScore(score, answer, readFireAnswer(whatQuestionW));
|
||||||
|
} catch (IOException ioException) {
|
||||||
|
ioException.printStackTrace();
|
||||||
|
}
|
||||||
|
whatQuestionW++;
|
||||||
|
System.out.println(whatQuestionW);
|
||||||
|
try {
|
||||||
|
questionStudent.setText(readFile(1));
|
||||||
|
} catch (IOException ioException) {
|
||||||
|
ioException.printStackTrace();
|
||||||
|
}
|
||||||
|
//mainGUI=new mainGUI();
|
||||||
|
//actionPerformed(ActionEvent e);
|
||||||
|
}
|
||||||
|
}
|
||||||
/*public clstatic void main(String[] args) throws IOException {
|
/*public clstatic void main(String[] args) throws IOException {
|
||||||
mainGUI mainGUI= new mainGUI();
|
mainGUI mainGUI= new mainGUI();
|
||||||
}*/
|
}*/
|
||||||
|
|||||||
@@ -9,4 +9,7 @@ public class score {
|
|||||||
return score;
|
return score;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public static void scoreToTxt(/*String name*,*/int score){
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -16,6 +16,7 @@ import java.awt.event.ActionEvent;
|
|||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
import java.awt.event.MouseAdapter;
|
import java.awt.event.MouseAdapter;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
public class userIn extends JFrame implements ActionListener {
|
public class userIn extends JFrame implements ActionListener {
|
||||||
//设置组件
|
//设置组件
|
||||||
@@ -85,6 +86,12 @@ public class userIn extends JFrame implements ActionListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
/*login.addMouseListener(new MouseAdapter() {
|
||||||
|
public void mouseClicked(MouseAdapter e) throws IOException {]
|
||||||
|
int c=e.getButton();
|
||||||
|
mainGUI a=new mainGUI();
|
||||||
|
}
|
||||||
|
});*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in new issue
Block a user