mirror of
https://github.com/This-weiyuqing/javaAutoScore.git
synced 2026-10-19 03:33:41 +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
@@ -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;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
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;
|
||||
import autoScore.userIn;
|
||||
import autoScore.*;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class mainDo{
|
||||
public static void main(String[] args) throws IOException {
|
||||
int score=0;
|
||||
//int score=0;
|
||||
mainGUI gui=new mainGUI();
|
||||
}
|
||||
}
|
||||
}
|
||||
+83
-27
@@ -14,27 +14,33 @@ import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.IOException;
|
||||
|
||||
import static autoScore.answer.readFireAnswer;
|
||||
import static autoScore.question.readFile;
|
||||
import static autoScore.score.getScore;
|
||||
|
||||
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 JButton A;
|
||||
private JButton B;
|
||||
private JButton C;
|
||||
private JButton D;
|
||||
int score;
|
||||
Container c;//创建主容器
|
||||
|
||||
//构造方法
|
||||
public mainGUI() throws IOException {
|
||||
//创建窗口容器
|
||||
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);
|
||||
this.setVisible(true);
|
||||
this.setSize(900,300);//设置窗口大小
|
||||
this.setSize(900, 300);//设置窗口大小
|
||||
this.setResizable(false);//设置窗口固定大小
|
||||
this.setLocationRelativeTo(null);//设置窗口居中
|
||||
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//设置默认关闭操作
|
||||
@@ -42,11 +48,12 @@ public class mainGUI extends JFrame implements ActionListener {
|
||||
//网格组布局管理器
|
||||
|
||||
//创建问题显示位置
|
||||
JTextArea questionStudent = new JTextArea("这是问题的位置andFuckJavaGUI");
|
||||
GridBagLayout questtionText = new GridBagLayout();
|
||||
questionStudent.setBounds(0,0,900,200);
|
||||
questionStudent.setText(readFile(11));//更改标签内容
|
||||
questionStudent.setLineWrap(true);
|
||||
//JTextArea questionStudent = new JTextArea("这是问题的位置andFuckJavaGUI");
|
||||
// questionStudent
|
||||
//GridBagLayout questtionText = new GridBagLayout();
|
||||
questionStudent.setBounds(0, 0, 900, 200);
|
||||
questionStudent.setText(readFile(0));//更改标签内容
|
||||
//questionStudent.setLineWrap(true);
|
||||
questionStudent.setEditable(false);
|
||||
/* JTextField textAreaOutput = new JTextField();
|
||||
questionStudent.add(new JScrollPane(textAreaOutput));*/
|
||||
@@ -56,9 +63,9 @@ public class mainGUI extends JFrame implements ActionListener {
|
||||
|
||||
//pack();
|
||||
//字体
|
||||
questionStudent.setFont(new Font("微软雅黑",Font.BOLD,20));
|
||||
questionStudent.setFont(new Font("微软雅黑", Font.BOLD, 20));
|
||||
|
||||
// setLayout(null);
|
||||
// setLayout(null);
|
||||
|
||||
A = new JButton("A");
|
||||
A.addActionListener(this);
|
||||
@@ -87,27 +94,76 @@ public class mainGUI extends JFrame implements ActionListener {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
String str = new String();
|
||||
if(e.getActionCommand().equals("A")){
|
||||
str= "A";
|
||||
getScore(score,A,anwer);
|
||||
}
|
||||
if (e.getActionCommand().equals("B")){
|
||||
str= "B";
|
||||
//int用来存储现在是第几题
|
||||
int whatQuestionW = 0;
|
||||
if (whatQuestionW < 20) {
|
||||
|
||||
}
|
||||
if (e.getActionCommand().equals("C")){
|
||||
str= "C";
|
||||
|
||||
}
|
||||
if (e.getActionCommand().equals("D")){
|
||||
str= "D";
|
||||
//int whatQuestionW =0;
|
||||
String str = new String();
|
||||
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 {
|
||||
mainGUI mainGUI= new mainGUI();
|
||||
}*/
|
||||
|
||||
@@ -9,4 +9,7 @@ public class 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.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.io.IOException;
|
||||
|
||||
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
|
||||
|
||||
Reference in new issue
Block a user