mirror of
https://github.com/This-weiyuqing/javaAutoScore.git
synced 2026-10-17 18:55:31 +08:00
Initial commit
This commit is contained in:
commit
ada5d75de7
27 files changed
+491
No files matched your search
@@ -0,0 +1,2 @@
|
|||||||
|
# Auto detect text files and perform LF normalization
|
||||||
|
* text=auto
|
||||||
Generated
+10
@@ -0,0 +1,10 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
||||||
|
# Zeppelin ignored files
|
||||||
|
/ZeppelinRemoteNotebooks/
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
||||||
Generated
+5
@@ -0,0 +1,5 @@
|
|||||||
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
|
<state>
|
||||||
|
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
|
||||||
|
</state>
|
||||||
|
</component>
|
||||||
Generated
+6
@@ -0,0 +1,6 @@
|
|||||||
|
<component name="CopyrightManager">
|
||||||
|
<copyright>
|
||||||
|
<option name="notice" value="Copyright (c) 2020 魏遇卿 All Rights Reserved. FileName: &#36;file.fileName @author: 魏遇卿@date: &#36;today@version: 1.0 E-mail:358614401@qq.com Code with UTF-8" />
|
||||||
|
<option name="myName" value="魏遇卿" />
|
||||||
|
</copyright>
|
||||||
|
</component>
|
||||||
Generated
+7
@@ -0,0 +1,7 @@
|
|||||||
|
<component name="CopyrightManager">
|
||||||
|
<settings default="魏遇卿">
|
||||||
|
<module2copyright>
|
||||||
|
<element module="All" copyright="魏遇卿" />
|
||||||
|
</module2copyright>
|
||||||
|
</settings>
|
||||||
|
</component>
|
||||||
+36
@@ -0,0 +1,36 @@
|
|||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<profile version="1.0">
|
||||||
|
<option name="myName" value="Project Default" />
|
||||||
|
<inspection_tool class="JavaDoc" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<option name="TOP_LEVEL_CLASS_OPTIONS">
|
||||||
|
<value>
|
||||||
|
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||||
|
<option name="REQUIRED_TAGS" value="" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="INNER_CLASS_OPTIONS">
|
||||||
|
<value>
|
||||||
|
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||||
|
<option name="REQUIRED_TAGS" value="" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="METHOD_OPTIONS">
|
||||||
|
<value>
|
||||||
|
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||||
|
<option name="REQUIRED_TAGS" value="@return@param@throws or @exception" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="FIELD_OPTIONS">
|
||||||
|
<value>
|
||||||
|
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||||
|
<option name="REQUIRED_TAGS" value="" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="IGNORE_DEPRECATED" value="false" />
|
||||||
|
<option name="IGNORE_JAVADOC_PERIOD" value="true" />
|
||||||
|
<option name="IGNORE_DUPLICATED_THROWS" value="false" />
|
||||||
|
<option name="IGNORE_POINT_TO_ITSELF" value="false" />
|
||||||
|
<option name="myAdditionalJavadocTags" value="date" />
|
||||||
|
</inspection_tool>
|
||||||
|
</profile>
|
||||||
|
</component>
|
||||||
Generated
+6
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_14" default="true" project-jdk-name="14" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
Generated
+8
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/fuckJavaGui.iml" filepath="$PROJECT_DIR$/fuckJavaGui.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
Generated
+124
@@ -0,0 +1,124 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Palette2">
|
||||||
|
<group name="Swing">
|
||||||
|
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="Button" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="RadioButton" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="CheckBox" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="Label" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||||
|
<preferred-size width="200" height="200" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||||
|
<preferred-size width="200" height="200" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||||
|
<preferred-size width="-1" height="20" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||||
|
</item>
|
||||||
|
</group>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
Generated
+6
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$/FirstJavaApp" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="JAVA_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
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.
Binary file not shown.
@@ -0,0 +1,16 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2020 魏遇卿 All Rights Reserved.
|
||||||
|
* FileName: asdf.java
|
||||||
|
* @author: 魏遇卿@date: 2020/6/11 下午4:50@version: 1.0
|
||||||
|
* E-mail:358614401@qq.com
|
||||||
|
* Code with UTF-8
|
||||||
|
*/
|
||||||
|
|
||||||
|
package autoScore;
|
||||||
|
import autoScore.userIn;
|
||||||
|
import autoScore.*;
|
||||||
|
public class mainDo{
|
||||||
|
public static void main(String[] args) {
|
||||||
|
mainGUI gui=new mainGUI();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,92 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2020 魏遇卿 All Rights Reserved.
|
||||||
|
* FileName: asdf.java
|
||||||
|
* @author: 魏遇卿@date: 2020/6/11 下午4:50@version: 1.0
|
||||||
|
* E-mail:358614401@qq.com
|
||||||
|
* Code with UTF-8
|
||||||
|
*/
|
||||||
|
|
||||||
|
package autoScore;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
|
|
||||||
|
public class mainGUI extends JFrame implements ActionListener {
|
||||||
|
private JTextField question;
|
||||||
|
private JButton A,B,C,D;
|
||||||
|
Container c;//创建主容器
|
||||||
|
//构造方法
|
||||||
|
public mainGUI(){
|
||||||
|
//创建窗口容器
|
||||||
|
super("Auto score to exam");
|
||||||
|
/* this.setBounds(100,100,100,100);*/
|
||||||
|
//获取主容器并设置为网格组布局
|
||||||
|
c=this.getContentPane();
|
||||||
|
c.setLayout(null);
|
||||||
|
this.setVisible(true);
|
||||||
|
this.setSize(900,300);//设置窗口大小
|
||||||
|
this.setResizable(false);//设置窗口固定大小
|
||||||
|
this.setLocationRelativeTo(null);//设置窗口居中
|
||||||
|
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//设置默认关闭操作
|
||||||
|
|
||||||
|
//网格组布局管理器
|
||||||
|
|
||||||
|
//创建问题显示位置
|
||||||
|
JLabel questionStudent = new JLabel("这是问题的位置andFuckJavaGUI");
|
||||||
|
GridBagLayout questtionText = new GridBagLayout();
|
||||||
|
questionStudent.setBounds(0,0,900,200);
|
||||||
|
questionStudent.setText("fuckJavaGUI");//更改标签内容
|
||||||
|
this.add(questionStudent);
|
||||||
|
//字体
|
||||||
|
questionStudent.setFont(new Font("微软雅黑",Font.BOLD,20));
|
||||||
|
|
||||||
|
// setLayout(null);
|
||||||
|
|
||||||
|
A = new JButton("A");
|
||||||
|
A.addActionListener(this);
|
||||||
|
this.add(A);
|
||||||
|
A.setBounds(100, 200, 100, 50);
|
||||||
|
|
||||||
|
B = new JButton("B");
|
||||||
|
this.add(B);
|
||||||
|
B.addActionListener(this);
|
||||||
|
B.setBounds(300, 200, 100, 50);
|
||||||
|
|
||||||
|
C = new JButton("C");
|
||||||
|
this.add(C);
|
||||||
|
C.addActionListener(this);
|
||||||
|
C.setBounds(500, 200, 100, 50);
|
||||||
|
|
||||||
|
D = new JButton("D");
|
||||||
|
D.addActionListener(this);
|
||||||
|
this.add(D);
|
||||||
|
D.setBounds(700, 200, 100, 50);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*private class panelABCD extends JPanel implements ActionListener{
|
||||||
|
|
||||||
|
}*/
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
if(e.getActionCommand().equals("A")){
|
||||||
|
// return "A";
|
||||||
|
}
|
||||||
|
if (e.getActionCommand().equals("B")){
|
||||||
|
// return "B";
|
||||||
|
}
|
||||||
|
if (e.getActionCommand().equals("B")){
|
||||||
|
// return "C";
|
||||||
|
}
|
||||||
|
if (e.getActionCommand().equals("B")){
|
||||||
|
// return "D";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/*public static void main(String[] args) {
|
||||||
|
mainGUI mainGUI= new mainGUI();
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package autoScore;
|
||||||
|
|
||||||
|
import java.io.*;
|
||||||
|
|
||||||
|
public class question {
|
||||||
|
public static File question(int i) {
|
||||||
|
File srcFile = new File("D:\\WindowsCToD\\fire\\GeneticsMultipleChoice\\Question");
|
||||||
|
File[] fileArr = srcFile.listFiles();
|
||||||
|
//System.out.println(fileArr[i]);
|
||||||
|
return fileArr[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* public static void questiontext() {
|
||||||
|
File fireName=question(0);
|
||||||
|
InputStream in;
|
||||||
|
InputStreamReader reader=new InputStreamReader(new FileInputStream(fireName));
|
||||||
|
}*/
|
||||||
|
public static void readFile() {
|
||||||
|
File pathname = question(0);
|
||||||
|
try (FileReader reader = new FileReader(pathname);
|
||||||
|
BufferedReader br = new BufferedReader(reader) // 建立一个对象,它把文件内容转成计算机能读懂的语言
|
||||||
|
) {
|
||||||
|
String line;
|
||||||
|
//网友推荐更加简洁的写法
|
||||||
|
while ((line = br.readLine()) != null) {
|
||||||
|
// 一次读入一行数据
|
||||||
|
System.out.println(line);
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
question(0);
|
||||||
|
System.out.println(question(0));
|
||||||
|
readFile();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package autoScore;
|
||||||
|
|
||||||
|
public class score {
|
||||||
|
public int getScore (int score,char choose,char anwser){
|
||||||
|
if (choose ==anwser ) {
|
||||||
|
score++;
|
||||||
|
return score;
|
||||||
|
}else {
|
||||||
|
return score;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2020 魏遇卿 All Rights Reserved.
|
||||||
|
* FileName: asdf.java
|
||||||
|
* @author: 魏遇卿@date: 2020/6/11 下午4:50@version: 1.0
|
||||||
|
* E-mail:358614401@qq.com
|
||||||
|
* Code with UTF-8
|
||||||
|
*/
|
||||||
|
|
||||||
|
package autoScore;
|
||||||
|
|
||||||
|
public class useInDemo {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
userIn GUI=new userIn();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,96 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2020 魏遇卿 All Rights Reserved.
|
||||||
|
* FileName: asdf.java
|
||||||
|
* @author: 魏遇卿@date: 2020/6/11 下午4:50@version: 1.0
|
||||||
|
* E-mail:358614401@qq.com
|
||||||
|
* Code with UTF-8
|
||||||
|
*/
|
||||||
|
|
||||||
|
package autoScore;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import javax.swing.event.CaretEvent;
|
||||||
|
import javax.swing.event.CaretListener;
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
|
import java.awt.event.MouseAdapter;
|
||||||
|
import java.awt.event.MouseEvent;
|
||||||
|
|
||||||
|
public class userIn extends JFrame implements ActionListener {
|
||||||
|
//设置组件
|
||||||
|
private JButton
|
||||||
|
//创建窗体
|
||||||
|
login = new JButton("login");
|
||||||
|
private JTextField
|
||||||
|
//创建组件
|
||||||
|
admin = new JTextField(),
|
||||||
|
password = new JTextField();
|
||||||
|
private JPanel contentPanel=new JPanel();
|
||||||
|
|
||||||
|
public userIn() {
|
||||||
|
super("Auto score to exam");
|
||||||
|
/* this.setBounds(100,100,100,100);*/
|
||||||
|
//获取主容器并设置为网格组布局
|
||||||
|
// contentPanel = this.getContentPane();
|
||||||
|
contentPanel.setLayout(null);
|
||||||
|
this.setVisible(true);
|
||||||
|
this.setSize(500, 350);//设置窗口大小
|
||||||
|
this.setResizable(false);//设置窗口固定大小
|
||||||
|
this.setLocationRelativeTo(null);//设置窗口居中
|
||||||
|
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//设置默认关闭操作
|
||||||
|
|
||||||
|
admin.setText("学号");
|
||||||
|
password.setText("password");
|
||||||
|
|
||||||
|
//添加组件
|
||||||
|
contentPanel.setLayout(null);
|
||||||
|
add(admin);
|
||||||
|
add(password);
|
||||||
|
add(login);
|
||||||
|
|
||||||
|
//组件位置
|
||||||
|
admin.setBounds(95,130,300,25);
|
||||||
|
password.setBounds(95,154,300,25);
|
||||||
|
login.setBounds(315,225,90,20);
|
||||||
|
//显示组件
|
||||||
|
admin.setOpaque(false);
|
||||||
|
password.setOpaque(false);
|
||||||
|
login.setOpaque(false);
|
||||||
|
|
||||||
|
//设置监听(鼠标点击之后输入密码
|
||||||
|
admin.addMouseListener(new MouseAdapter(){
|
||||||
|
@Override
|
||||||
|
public void mouseClicked(MouseEvent e){
|
||||||
|
int c = e.getButton();
|
||||||
|
if(c == MouseEvent.BUTTON1 && admin.getText().equals("学号") &&e.getClickCount()==1) {
|
||||||
|
admin.setText(null);
|
||||||
|
/* password.setText("password");*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
admin.addCaretListener(new CaretListener(){
|
||||||
|
@Override
|
||||||
|
public void caretUpdate(CaretEvent e){
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
password.addMouseListener(new MouseAdapter(){
|
||||||
|
@Override
|
||||||
|
public void mouseClicked(MouseEvent e){
|
||||||
|
int c = e.getButton();
|
||||||
|
if(c == MouseEvent.BUTTON1 && password.getText().equals("password") &&e.getClickCount()==1) {
|
||||||
|
password.setText(null);
|
||||||
|
/* admin.setText("学号");*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
Reference in new issue
Block a user