Publish the code
This commit is contained in:
commit
a70e809e07
66 changed files with 2034 additions and 0 deletions
41
.gitignore
vendored
Normal file
41
.gitignore
vendored
Normal file
|
@ -0,0 +1,41 @@
|
|||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
backup/
|
||||
*.db
|
||||
*.log
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea/modules.xml
|
||||
.idea/jarRepositories.xml
|
||||
.idea/compiler.xml
|
||||
.idea/libraries/
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### Eclipse ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
|
||||
### Mac OS ###
|
||||
.DS_Store
|
8
.idea/.gitignore
vendored
Normal file
8
.idea/.gitignore
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
17
.idea/dataSources.xml
Normal file
17
.idea/dataSources.xml
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||
<data-source source="LOCAL" name="student" uuid="c914c7f0-082a-4e99-9125-15ce7d15b98f">
|
||||
<driver-ref>sqlite.xerial</driver-ref>
|
||||
<synchronize>true</synchronize>
|
||||
<jdbc-driver>org.sqlite.JDBC</jdbc-driver>
|
||||
<jdbc-url>jdbc:sqlite:C:\Users\BobMaster\IdeaProjects\StudentSystem\student.db</jdbc-url>
|
||||
<working-dir>$ProjectFileDir$</working-dir>
|
||||
<libraries>
|
||||
<library>
|
||||
<url>file://$APPLICATION_CONFIG_DIR$/jdbc-drivers/Xerial SQLiteJDBC/3.40.1/org/xerial/sqlite-jdbc/3.40.1.0/sqlite-jdbc-3.40.1.0.jar</url>
|
||||
</library>
|
||||
</libraries>
|
||||
</data-source>
|
||||
</component>
|
||||
</project>
|
7
.idea/encodings.xml
Normal file
7
.idea/encodings.xml
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
14
.idea/misc.xml
Normal file
14
.idea/misc.xml
Normal file
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="MavenProjectsManager">
|
||||
<option name="originalFiles">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_20" default="true" project-jdk-name="20" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
7
.idea/sqldialects.xml
Normal file
7
.idea/sqldialects.xml
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="SqlDialectMappings">
|
||||
<file url="file://$PROJECT_DIR$/src/main/java/com/bobmaster/studentsystem/util/DBUtil.java" dialect="GenericSQL" />
|
||||
<file url="PROJECT" dialect="SQLite" />
|
||||
</component>
|
||||
</project>
|
124
.idea/uiDesigner.xml
Normal file
124
.idea/uiDesigner.xml
Normal file
|
@ -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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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>
|
6
.idea/vcs.xml
Normal file
6
.idea/vcs.xml
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
BIN
.mvn/wrapper/maven-wrapper.jar
vendored
Normal file
BIN
.mvn/wrapper/maven-wrapper.jar
vendored
Normal file
Binary file not shown.
2
.mvn/wrapper/maven-wrapper.properties
vendored
Normal file
2
.mvn/wrapper/maven-wrapper.properties
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.5/apache-maven-3.8.5-bin.zip
|
||||
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar
|
BIN
JavaStudentManageSystem.pdf
Normal file
BIN
JavaStudentManageSystem.pdf
Normal file
Binary file not shown.
3
README.md
Normal file
3
README.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
Java学生成绩管理系统课程设计
|
||||
|
||||
课设报告:[JavaStudentManageSystem.pdf](JavaStudentManageSystem.pdf)
|
BIN
lib/SparseBitSet-1.2.jar
Normal file
BIN
lib/SparseBitSet-1.2.jar
Normal file
Binary file not shown.
BIN
lib/bootstrapfx-core-0.4.0.jar
Normal file
BIN
lib/bootstrapfx-core-0.4.0.jar
Normal file
Binary file not shown.
BIN
lib/commons-codec-1.15.jar
Normal file
BIN
lib/commons-codec-1.15.jar
Normal file
Binary file not shown.
BIN
lib/commons-collections4-4.4.jar
Normal file
BIN
lib/commons-collections4-4.4.jar
Normal file
Binary file not shown.
BIN
lib/commons-compress-1.21.jar
Normal file
BIN
lib/commons-compress-1.21.jar
Normal file
Binary file not shown.
BIN
lib/commons-io-2.11.0.jar
Normal file
BIN
lib/commons-io-2.11.0.jar
Normal file
Binary file not shown.
BIN
lib/commons-math3-3.6.1.jar
Normal file
BIN
lib/commons-math3-3.6.1.jar
Normal file
Binary file not shown.
BIN
lib/curvesapi-1.07.jar
Normal file
BIN
lib/curvesapi-1.07.jar
Normal file
Binary file not shown.
BIN
lib/ikonli-core-12.2.0.jar
Normal file
BIN
lib/ikonli-core-12.2.0.jar
Normal file
Binary file not shown.
BIN
lib/ikonli-core-12.3.1.jar
Normal file
BIN
lib/ikonli-core-12.3.1.jar
Normal file
Binary file not shown.
BIN
lib/ikonli-materialdesign2-pack-12.2.0.jar
Normal file
BIN
lib/ikonli-materialdesign2-pack-12.2.0.jar
Normal file
Binary file not shown.
BIN
lib/jackson-annotations-2.15.2.jar
Normal file
BIN
lib/jackson-annotations-2.15.2.jar
Normal file
Binary file not shown.
BIN
lib/jackson-core-2.14.1.jar
Normal file
BIN
lib/jackson-core-2.14.1.jar
Normal file
Binary file not shown.
BIN
lib/jackson-core-2.15.2.jar
Normal file
BIN
lib/jackson-core-2.15.2.jar
Normal file
Binary file not shown.
BIN
lib/jackson-databind-2.15.2.jar
Normal file
BIN
lib/jackson-databind-2.15.2.jar
Normal file
Binary file not shown.
BIN
lib/jackson-dataformat-xml-2.15.2.jar
Normal file
BIN
lib/jackson-dataformat-xml-2.15.2.jar
Normal file
Binary file not shown.
BIN
lib/log4j-1.2-api-2.19.0.jar
Normal file
BIN
lib/log4j-1.2-api-2.19.0.jar
Normal file
Binary file not shown.
BIN
lib/log4j-api-2.18.0.jar
Normal file
BIN
lib/log4j-api-2.18.0.jar
Normal file
Binary file not shown.
BIN
lib/log4j-api-2.19.0.jar
Normal file
BIN
lib/log4j-api-2.19.0.jar
Normal file
Binary file not shown.
BIN
lib/log4j-api-2.20.0.jar
Normal file
BIN
lib/log4j-api-2.20.0.jar
Normal file
Binary file not shown.
BIN
lib/log4j-core-2.20.0.jar
Normal file
BIN
lib/log4j-core-2.20.0.jar
Normal file
Binary file not shown.
BIN
lib/poi-5.2.3.jar
Normal file
BIN
lib/poi-5.2.3.jar
Normal file
Binary file not shown.
BIN
lib/poi-ooxml-5.2.3.jar
Normal file
BIN
lib/poi-ooxml-5.2.3.jar
Normal file
Binary file not shown.
BIN
lib/poi-ooxml-lite-5.2.3.jar
Normal file
BIN
lib/poi-ooxml-lite-5.2.3.jar
Normal file
Binary file not shown.
BIN
lib/sqlite-jdbc-3.42.0.0.jar
Normal file
BIN
lib/sqlite-jdbc-3.42.0.0.jar
Normal file
Binary file not shown.
BIN
lib/stax2-api-4.2.1.jar
Normal file
BIN
lib/stax2-api-4.2.1.jar
Normal file
Binary file not shown.
BIN
lib/woodstox-core-6.5.1.jar
Normal file
BIN
lib/woodstox-core-6.5.1.jar
Normal file
Binary file not shown.
BIN
lib/xmlbeans-5.1.1.jar
Normal file
BIN
lib/xmlbeans-5.1.1.jar
Normal file
Binary file not shown.
316
mvnw
vendored
Normal file
316
mvnw
vendored
Normal file
|
@ -0,0 +1,316 @@
|
|||
#!/bin/sh
|
||||
# ----------------------------------------------------------------------------
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Maven Start Up Batch script
|
||||
#
|
||||
# Required ENV vars:
|
||||
# ------------------
|
||||
# JAVA_HOME - location of a JDK home dir
|
||||
#
|
||||
# Optional ENV vars
|
||||
# -----------------
|
||||
# M2_HOME - location of maven2's installed home dir
|
||||
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
||||
# e.g. to debug Maven itself, use
|
||||
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
||||
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
if [ -z "$MAVEN_SKIP_RC" ] ; then
|
||||
|
||||
if [ -f /usr/local/etc/mavenrc ] ; then
|
||||
. /usr/local/etc/mavenrc
|
||||
fi
|
||||
|
||||
if [ -f /etc/mavenrc ] ; then
|
||||
. /etc/mavenrc
|
||||
fi
|
||||
|
||||
if [ -f "$HOME/.mavenrc" ] ; then
|
||||
. "$HOME/.mavenrc"
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
# OS specific support. $var _must_ be set to either true or false.
|
||||
cygwin=false;
|
||||
darwin=false;
|
||||
mingw=false
|
||||
case "`uname`" in
|
||||
CYGWIN*) cygwin=true ;;
|
||||
MINGW*) mingw=true;;
|
||||
Darwin*) darwin=true
|
||||
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
|
||||
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
|
||||
if [ -z "$JAVA_HOME" ]; then
|
||||
if [ -x "/usr/libexec/java_home" ]; then
|
||||
export JAVA_HOME="`/usr/libexec/java_home`"
|
||||
else
|
||||
export JAVA_HOME="/Library/Java/Home"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -z "$JAVA_HOME" ] ; then
|
||||
if [ -r /etc/gentoo-release ] ; then
|
||||
JAVA_HOME=`java-config --jre-home`
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$M2_HOME" ] ; then
|
||||
## resolve links - $0 may be a link to maven's home
|
||||
PRG="$0"
|
||||
|
||||
# need this for relative symlinks
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG="`dirname "$PRG"`/$link"
|
||||
fi
|
||||
done
|
||||
|
||||
saveddir=`pwd`
|
||||
|
||||
M2_HOME=`dirname "$PRG"`/..
|
||||
|
||||
# make it fully qualified
|
||||
M2_HOME=`cd "$M2_HOME" && pwd`
|
||||
|
||||
cd "$saveddir"
|
||||
# echo Using m2 at $M2_HOME
|
||||
fi
|
||||
|
||||
# For Cygwin, ensure paths are in UNIX format before anything is touched
|
||||
if $cygwin ; then
|
||||
[ -n "$M2_HOME" ] &&
|
||||
M2_HOME=`cygpath --unix "$M2_HOME"`
|
||||
[ -n "$JAVA_HOME" ] &&
|
||||
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
|
||||
[ -n "$CLASSPATH" ] &&
|
||||
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
|
||||
fi
|
||||
|
||||
# For Mingw, ensure paths are in UNIX format before anything is touched
|
||||
if $mingw ; then
|
||||
[ -n "$M2_HOME" ] &&
|
||||
M2_HOME="`(cd "$M2_HOME"; pwd)`"
|
||||
[ -n "$JAVA_HOME" ] &&
|
||||
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
|
||||
fi
|
||||
|
||||
if [ -z "$JAVA_HOME" ]; then
|
||||
javaExecutable="`which javac`"
|
||||
if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
|
||||
# readlink(1) is not available as standard on Solaris 10.
|
||||
readLink=`which readlink`
|
||||
if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
|
||||
if $darwin ; then
|
||||
javaHome="`dirname \"$javaExecutable\"`"
|
||||
javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
|
||||
else
|
||||
javaExecutable="`readlink -f \"$javaExecutable\"`"
|
||||
fi
|
||||
javaHome="`dirname \"$javaExecutable\"`"
|
||||
javaHome=`expr "$javaHome" : '\(.*\)/bin'`
|
||||
JAVA_HOME="$javaHome"
|
||||
export JAVA_HOME
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$JAVACMD" ] ; then
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
else
|
||||
JAVACMD="`\\unset -f command; \\command -v java`"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
echo "Error: JAVA_HOME is not defined correctly." >&2
|
||||
echo " We cannot execute $JAVACMD" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$JAVA_HOME" ] ; then
|
||||
echo "Warning: JAVA_HOME environment variable is not set."
|
||||
fi
|
||||
|
||||
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
|
||||
|
||||
# traverses directory structure from process work directory to filesystem root
|
||||
# first directory with .mvn subdirectory is considered project base directory
|
||||
find_maven_basedir() {
|
||||
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo "Path not specified to find_maven_basedir"
|
||||
return 1
|
||||
fi
|
||||
|
||||
basedir="$1"
|
||||
wdir="$1"
|
||||
while [ "$wdir" != '/' ] ; do
|
||||
if [ -d "$wdir"/.mvn ] ; then
|
||||
basedir=$wdir
|
||||
break
|
||||
fi
|
||||
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
|
||||
if [ -d "${wdir}" ]; then
|
||||
wdir=`cd "$wdir/.."; pwd`
|
||||
fi
|
||||
# end of workaround
|
||||
done
|
||||
echo "${basedir}"
|
||||
}
|
||||
|
||||
# concatenates all lines of a file
|
||||
concat_lines() {
|
||||
if [ -f "$1" ]; then
|
||||
echo "$(tr -s '\n' ' ' < "$1")"
|
||||
fi
|
||||
}
|
||||
|
||||
BASE_DIR=`find_maven_basedir "$(pwd)"`
|
||||
if [ -z "$BASE_DIR" ]; then
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
##########################################################################################
|
||||
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
|
||||
# This allows using the maven wrapper in projects that prohibit checking in binary data.
|
||||
##########################################################################################
|
||||
if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo "Found .mvn/wrapper/maven-wrapper.jar"
|
||||
fi
|
||||
else
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
|
||||
fi
|
||||
if [ -n "$MVNW_REPOURL" ]; then
|
||||
jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
|
||||
else
|
||||
jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
|
||||
fi
|
||||
while IFS="=" read key value; do
|
||||
case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
|
||||
esac
|
||||
done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo "Downloading from: $jarUrl"
|
||||
fi
|
||||
wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
|
||||
if $cygwin; then
|
||||
wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
|
||||
fi
|
||||
|
||||
if command -v wget > /dev/null; then
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo "Found wget ... using wget"
|
||||
fi
|
||||
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
||||
wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
|
||||
else
|
||||
wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
|
||||
fi
|
||||
elif command -v curl > /dev/null; then
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo "Found curl ... using curl"
|
||||
fi
|
||||
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
||||
curl -o "$wrapperJarPath" "$jarUrl" -f
|
||||
else
|
||||
curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
|
||||
fi
|
||||
|
||||
else
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo "Falling back to using Java to download"
|
||||
fi
|
||||
javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
|
||||
# For Cygwin, switch paths to Windows format before running javac
|
||||
if $cygwin; then
|
||||
javaClass=`cygpath --path --windows "$javaClass"`
|
||||
fi
|
||||
if [ -e "$javaClass" ]; then
|
||||
if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo " - Compiling MavenWrapperDownloader.java ..."
|
||||
fi
|
||||
# Compiling the Java class
|
||||
("$JAVA_HOME/bin/javac" "$javaClass")
|
||||
fi
|
||||
if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
|
||||
# Running the downloader
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo " - Running MavenWrapperDownloader.java ..."
|
||||
fi
|
||||
("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
##########################################################################################
|
||||
# End of extension
|
||||
##########################################################################################
|
||||
|
||||
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo $MAVEN_PROJECTBASEDIR
|
||||
fi
|
||||
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin; then
|
||||
[ -n "$M2_HOME" ] &&
|
||||
M2_HOME=`cygpath --path --windows "$M2_HOME"`
|
||||
[ -n "$JAVA_HOME" ] &&
|
||||
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
|
||||
[ -n "$CLASSPATH" ] &&
|
||||
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
|
||||
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
|
||||
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
|
||||
fi
|
||||
|
||||
# Provide a "standardized" way to retrieve the CLI args that will
|
||||
# work with both Windows and non-Windows executions.
|
||||
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
|
||||
export MAVEN_CMD_LINE_ARGS
|
||||
|
||||
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
||||
|
||||
exec "$JAVACMD" \
|
||||
$MAVEN_OPTS \
|
||||
$MAVEN_DEBUG_OPTS \
|
||||
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
|
||||
"-Dmaven.home=${M2_HOME}" \
|
||||
"-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
|
||||
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
|
188
mvnw.cmd
vendored
Normal file
188
mvnw.cmd
vendored
Normal file
|
@ -0,0 +1,188 @@
|
|||
@REM ----------------------------------------------------------------------------
|
||||
@REM Licensed to the Apache Software Foundation (ASF) under one
|
||||
@REM or more contributor license agreements. See the NOTICE file
|
||||
@REM distributed with this work for additional information
|
||||
@REM regarding copyright ownership. The ASF licenses this file
|
||||
@REM to you under the Apache License, Version 2.0 (the
|
||||
@REM "License"); you may not use this file except in compliance
|
||||
@REM with the License. You may obtain a copy of the License at
|
||||
@REM
|
||||
@REM https://www.apache.org/licenses/LICENSE-2.0
|
||||
@REM
|
||||
@REM Unless required by applicable law or agreed to in writing,
|
||||
@REM software distributed under the License is distributed on an
|
||||
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
@REM KIND, either express or implied. See the License for the
|
||||
@REM specific language governing permissions and limitations
|
||||
@REM under the License.
|
||||
@REM ----------------------------------------------------------------------------
|
||||
|
||||
@REM ----------------------------------------------------------------------------
|
||||
@REM Maven Start Up Batch script
|
||||
@REM
|
||||
@REM Required ENV vars:
|
||||
@REM JAVA_HOME - location of a JDK home dir
|
||||
@REM
|
||||
@REM Optional ENV vars
|
||||
@REM M2_HOME - location of maven2's installed home dir
|
||||
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
|
||||
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
|
||||
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
||||
@REM e.g. to debug Maven itself, use
|
||||
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
||||
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
||||
@REM ----------------------------------------------------------------------------
|
||||
|
||||
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
|
||||
@echo off
|
||||
@REM set title of command window
|
||||
title %0
|
||||
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
|
||||
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
|
||||
|
||||
@REM set %HOME% to equivalent of $HOME
|
||||
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
|
||||
|
||||
@REM Execute a user defined script before this one
|
||||
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
|
||||
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
|
||||
if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
|
||||
if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %*
|
||||
:skipRcPre
|
||||
|
||||
@setlocal
|
||||
|
||||
set ERROR_CODE=0
|
||||
|
||||
@REM To isolate internal variables from possible post scripts, we use another setlocal
|
||||
@setlocal
|
||||
|
||||
@REM ==== START VALIDATION ====
|
||||
if not "%JAVA_HOME%" == "" goto OkJHome
|
||||
|
||||
echo.
|
||||
echo Error: JAVA_HOME not found in your environment. >&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
||||
echo location of your Java installation. >&2
|
||||
echo.
|
||||
goto error
|
||||
|
||||
:OkJHome
|
||||
if exist "%JAVA_HOME%\bin\java.exe" goto init
|
||||
|
||||
echo.
|
||||
echo Error: JAVA_HOME is set to an invalid directory. >&2
|
||||
echo JAVA_HOME = "%JAVA_HOME%" >&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
||||
echo location of your Java installation. >&2
|
||||
echo.
|
||||
goto error
|
||||
|
||||
@REM ==== END VALIDATION ====
|
||||
|
||||
:init
|
||||
|
||||
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
|
||||
@REM Fallback to current working directory if not found.
|
||||
|
||||
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
|
||||
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
|
||||
|
||||
set EXEC_DIR=%CD%
|
||||
set WDIR=%EXEC_DIR%
|
||||
:findBaseDir
|
||||
IF EXIST "%WDIR%"\.mvn goto baseDirFound
|
||||
cd ..
|
||||
IF "%WDIR%"=="%CD%" goto baseDirNotFound
|
||||
set WDIR=%CD%
|
||||
goto findBaseDir
|
||||
|
||||
:baseDirFound
|
||||
set MAVEN_PROJECTBASEDIR=%WDIR%
|
||||
cd "%EXEC_DIR%"
|
||||
goto endDetectBaseDir
|
||||
|
||||
:baseDirNotFound
|
||||
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
|
||||
cd "%EXEC_DIR%"
|
||||
|
||||
:endDetectBaseDir
|
||||
|
||||
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
|
||||
|
||||
@setlocal EnableExtensions EnableDelayedExpansion
|
||||
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
|
||||
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
|
||||
|
||||
:endReadAdditionalConfig
|
||||
|
||||
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
|
||||
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
|
||||
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
||||
|
||||
set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
|
||||
|
||||
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
|
||||
IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
|
||||
)
|
||||
|
||||
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
|
||||
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
|
||||
if exist %WRAPPER_JAR% (
|
||||
if "%MVNW_VERBOSE%" == "true" (
|
||||
echo Found %WRAPPER_JAR%
|
||||
)
|
||||
) else (
|
||||
if not "%MVNW_REPOURL%" == "" (
|
||||
SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
|
||||
)
|
||||
if "%MVNW_VERBOSE%" == "true" (
|
||||
echo Couldn't find %WRAPPER_JAR%, downloading it ...
|
||||
echo Downloading from: %DOWNLOAD_URL%
|
||||
)
|
||||
|
||||
powershell -Command "&{"^
|
||||
"$webclient = new-object System.Net.WebClient;"^
|
||||
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
|
||||
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
|
||||
"}"^
|
||||
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
|
||||
"}"
|
||||
if "%MVNW_VERBOSE%" == "true" (
|
||||
echo Finished downloading %WRAPPER_JAR%
|
||||
)
|
||||
)
|
||||
@REM End of extension
|
||||
|
||||
@REM Provide a "standardized" way to retrieve the CLI args that will
|
||||
@REM work with both Windows and non-Windows executions.
|
||||
set MAVEN_CMD_LINE_ARGS=%*
|
||||
|
||||
%MAVEN_JAVA_EXE% ^
|
||||
%JVM_CONFIG_MAVEN_PROPS% ^
|
||||
%MAVEN_OPTS% ^
|
||||
%MAVEN_DEBUG_OPTS% ^
|
||||
-classpath %WRAPPER_JAR% ^
|
||||
"-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
|
||||
%WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
|
||||
if ERRORLEVEL 1 goto error
|
||||
goto end
|
||||
|
||||
:error
|
||||
set ERROR_CODE=1
|
||||
|
||||
:end
|
||||
@endlocal & set ERROR_CODE=%ERROR_CODE%
|
||||
|
||||
if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
|
||||
@REM check for post script, once with legacy .bat ending and once with .cmd ending
|
||||
if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
|
||||
if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
|
||||
:skipRcPost
|
||||
|
||||
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
|
||||
if "%MAVEN_BATCH_PAUSE%"=="on" pause
|
||||
|
||||
if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%
|
||||
|
||||
cmd /C exit /B %ERROR_CODE%
|
86
pom.xml
Normal file
86
pom.xml
Normal file
|
@ -0,0 +1,86 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.bobmaster</groupId>
|
||||
<artifactId>StudentSystem</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<name>StudentSystem</name>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<junit.version>5.9.2</junit.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.openjfx</groupId>
|
||||
<artifactId>javafx-controls</artifactId>
|
||||
<version>20</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.openjfx</groupId>
|
||||
<artifactId>javafx-fxml</artifactId>
|
||||
<version>20</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.controlsfx</groupId>
|
||||
<artifactId>controlsfx</artifactId>
|
||||
<version>11.1.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.kordamp.ikonli</groupId>
|
||||
<artifactId>ikonli-javafx</artifactId>
|
||||
<version>12.3.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-api</artifactId>
|
||||
<version>${junit.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-engine</artifactId>
|
||||
<version>${junit.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.11.0</version>
|
||||
<configuration>
|
||||
<source>20</source>
|
||||
<target>20</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.openjfx</groupId>
|
||||
<artifactId>javafx-maven-plugin</artifactId>
|
||||
<version>0.0.8</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<!-- Default configuration for running with: mvn clean javafx:run -->
|
||||
<id>default-cli</id>
|
||||
<configuration>
|
||||
<mainClass>com.bobmaster.studentsystem/com.bobmaster.studentsystem.HelloApplication
|
||||
</mainClass>
|
||||
<launcher>app</launcher>
|
||||
<jlinkZipName>app</jlinkZipName>
|
||||
<jlinkImageName>app</jlinkImageName>
|
||||
<noManPages>true</noManPages>
|
||||
<stripDebug>true</stripDebug>
|
||||
<noHeaderFiles>true</noHeaderFiles>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
29
src/main/java/com/bobmaster/studentsystem/Config.java
Normal file
29
src/main/java/com/bobmaster/studentsystem/Config.java
Normal file
|
@ -0,0 +1,29 @@
|
|||
package com.bobmaster.studentsystem;
|
||||
import com.bobmaster.studentsystem.util.GetCWD;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class Config {
|
||||
public static void SaveConfig(Object object) throws IOException {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
objectMapper.writeValue(new File(GetCWD.getCWD() + "\\config.json"), object);
|
||||
}
|
||||
|
||||
public static Object LoadConfig(Class<?> clazz) throws IOException {
|
||||
File file = new File(GetCWD.getCWD() + "\\config.json");
|
||||
if (!file.exists()) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("backupPath", GetCWD.getCWD() + "\\backup");
|
||||
map.put("backupInterval", 60);
|
||||
SaveConfig(map);
|
||||
}
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
return objectMapper.readValue(file, clazz);
|
||||
}
|
||||
|
||||
|
||||
}
|
122
src/main/java/com/bobmaster/studentsystem/Main.java
Normal file
122
src/main/java/com/bobmaster/studentsystem/Main.java
Normal file
|
@ -0,0 +1,122 @@
|
|||
package com.bobmaster.studentsystem;
|
||||
|
||||
import com.bobmaster.studentsystem.model.Student;
|
||||
import com.bobmaster.studentsystem.util.DBUtil;
|
||||
import com.bobmaster.studentsystem.util.ExportToExcel;
|
||||
import com.bobmaster.studentsystem.util.GenerateRandomTime;
|
||||
import com.bobmaster.studentsystem.util.Revoke;
|
||||
import javafx.application.Application;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.input.KeyCode;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.stage.Stage;
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Map;
|
||||
import java.util.Stack;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
|
||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
|
||||
|
||||
public class Main extends Application {
|
||||
private Stage primaryStage;
|
||||
private AnchorPane rootLayout;
|
||||
private Scene scene;
|
||||
// DbPath stack
|
||||
public static Stack<String> dbPathStack = new Stack<>();
|
||||
|
||||
public static final Logger logger = LogManager.getLogger(Main.class);
|
||||
|
||||
@Override
|
||||
public void start(Stage primaryStage) throws IOException {
|
||||
this.primaryStage = primaryStage;
|
||||
this.primaryStage.setTitle("学生管理系统");
|
||||
this.primaryStage.getIcons().add(new Image("file:src/main/resources/images/icon.png"));
|
||||
initRootLayout();
|
||||
|
||||
Map <String, Object> map = (Map<String, Object>) Config.LoadConfig(Map.class);
|
||||
|
||||
// Create Schedule backup task
|
||||
ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
|
||||
scheduler.scheduleAtFixedRate(() -> {
|
||||
try {
|
||||
String dbPath = map.get("backupPath").toString() + "\\" +
|
||||
GenerateRandomTime.Generate() + "\\student.db";
|
||||
DBUtil.dbBackup(dbPath);
|
||||
logger.info("Regular Backup Success: " + dbPath);
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}, 0, Long.parseLong(map.get("backupInterval").toString()), SECONDS);
|
||||
// close scheduler when RootLayout exit
|
||||
primaryStage.setOnCloseRequest(event -> {
|
||||
scheduler.shutdown();
|
||||
logger.info("Program Exit");
|
||||
});
|
||||
}
|
||||
|
||||
private void initRootLayout() {
|
||||
try {
|
||||
FXMLLoader loader = new FXMLLoader();
|
||||
loader.setLocation(Main.class.getResource("RootLayout.fxml"));
|
||||
rootLayout = loader.load();
|
||||
|
||||
// keybinding
|
||||
initKeyBinding();
|
||||
|
||||
scene = new Scene(rootLayout);
|
||||
primaryStage.setScene(scene);
|
||||
primaryStage.setResizable(false);
|
||||
primaryStage.show();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void initKeyBinding() {
|
||||
rootLayout.setOnKeyPressed(event -> {
|
||||
// exit when press Ctrl+Q
|
||||
if (event.isControlDown() && event.getCode().equals(KeyCode.Q)) {
|
||||
try {
|
||||
DBUtil.dbDisconnect();
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
logger.info("Program Exit");
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
// export to excel when press Ctrl+S
|
||||
if (event.isControlDown() && event.getCode().equals(KeyCode.S)) {
|
||||
ExportToExcel.exportToExcel();
|
||||
}
|
||||
|
||||
// revoke when press Ctrl+Z
|
||||
if (event.isControlDown() && event.getCode().equals(KeyCode.Z)) {
|
||||
try {
|
||||
TableView<Student> node = (TableView<Student>) scene.lookup("#studentTable");
|
||||
Revoke.revokeEdit(dbPathStack, node);
|
||||
} catch (SQLException | ClassCastException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) throws SQLException{
|
||||
DBUtil.dbInit();
|
||||
launch(args);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.bobmaster.studentsystem.controller;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
|
||||
public class AboutPage {
|
||||
@FXML
|
||||
public AnchorPane aboutPagePane;
|
||||
|
||||
public void handleHideAboutPage(MouseEvent mouseEvent) {
|
||||
aboutPagePane.getScene().getWindow().hide();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,298 @@
|
|||
package com.bobmaster.studentsystem.controller;
|
||||
|
||||
import com.bobmaster.studentsystem.Main;
|
||||
import com.bobmaster.studentsystem.model.Student;
|
||||
import com.bobmaster.studentsystem.model.StudentDAO;
|
||||
import com.bobmaster.studentsystem.util.*;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.chart.PieChart;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.stage.FileChooser;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class RootLayout {
|
||||
@FXML
|
||||
public TextField nameText;
|
||||
@FXML
|
||||
public TextField idText;
|
||||
@FXML
|
||||
public TextField genderText;
|
||||
@FXML
|
||||
public TextField scoreText;
|
||||
@FXML
|
||||
public TableView<Student> studentTable;
|
||||
@FXML
|
||||
public TableColumn<Student, String> stuNameColumn;
|
||||
@FXML
|
||||
public TableColumn<Student, String> stuIdColumn;
|
||||
@FXML
|
||||
public TableColumn<Student, String> stuGenderColumn;
|
||||
@FXML
|
||||
public TableColumn<Student, Double> stuScoreColumn;
|
||||
@FXML
|
||||
public PieChart scorePieChart;
|
||||
|
||||
public void handleAboutPage(ActionEvent actionEvent) {
|
||||
try {
|
||||
FXMLLoader loader = new FXMLLoader();
|
||||
loader.setLocation(Main.class.getResource("AboutPage.fxml"));
|
||||
AnchorPane root = loader.load();
|
||||
Stage stage = new Stage();
|
||||
stage.setTitle("关于");
|
||||
stage.getIcons().add(new Image("file:src/main/resources/images/icon.png"));
|
||||
stage.setScene(new Scene(root));
|
||||
stage.show();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void handleSettingPage(ActionEvent actionEvent) {
|
||||
try {
|
||||
FXMLLoader loader = new FXMLLoader();
|
||||
loader.setLocation(Main.class.getResource("SettingPage.fxml"));
|
||||
AnchorPane root = loader.load();
|
||||
Stage stage = new Stage();
|
||||
stage.setTitle("设置");
|
||||
stage.getIcons().add(new Image("file:src/main/resources/images/setting.png"));
|
||||
stage.setScene(new Scene(root));
|
||||
stage.show();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void handleExit(ActionEvent actionEvent) {
|
||||
Main.logger.info("Program Exit");
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
public void handleExportToExcel(ActionEvent actionEvent) {
|
||||
ExportToExcel.exportToExcel();
|
||||
}
|
||||
|
||||
// initialize the controller class
|
||||
@FXML
|
||||
public void initialize() {
|
||||
// initialize the student table with the four columns
|
||||
stuNameColumn.setCellValueFactory(cellData -> cellData.getValue().studentNameProperty());
|
||||
stuIdColumn.setCellValueFactory(cellData -> cellData.getValue().studentIdProperty());
|
||||
stuGenderColumn.setCellValueFactory(cellData -> cellData.getValue().studentGenderProperty());
|
||||
stuScoreColumn.setCellValueFactory(cellData -> cellData.getValue().studentScoreProperty().asObject());
|
||||
try {
|
||||
ObservableList<Student> studentData = StudentDAO.searchStudents();
|
||||
populateStudents(studentData);
|
||||
// PieChart
|
||||
UpdatePieChart.updatePieChart(scorePieChart);
|
||||
} catch (SQLException | IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// populate the student table with the data
|
||||
private void populateStudents(ObservableList<Student> studentData) {
|
||||
studentTable.setItems(studentData);
|
||||
}
|
||||
|
||||
// Insert a student
|
||||
@FXML
|
||||
public void handleAddStudent(MouseEvent mouseEvent) throws SQLException{
|
||||
// if all the text fields are not empty
|
||||
if (!nameText.getText().isEmpty() && !idText.getText().isEmpty()
|
||||
&& !genderText.getText().isEmpty() && !scoreText.getText().isEmpty()) {
|
||||
// check if the student Score is a number
|
||||
try {
|
||||
Double.parseDouble(scoreText.getText());
|
||||
// if the student id is not in the database
|
||||
if (StudentDAO.searchStudent(idText.getText()) == null) {
|
||||
try {
|
||||
// backup the database
|
||||
String DbPath = GetCWD.getCWD() + "\\backup\\" + GenerateRandomTime.Generate() + ".db";
|
||||
Main.dbPathStack.push(DbPath);
|
||||
DBUtil.dbBackup(DbPath);
|
||||
StudentDAO.insertStudent(nameText.getText(),
|
||||
genderText.getText(),
|
||||
idText.getText(),
|
||||
Double.parseDouble(scoreText.getText()));
|
||||
// clear the text fields
|
||||
nameText.clear();
|
||||
genderText.clear();
|
||||
idText.clear();
|
||||
scoreText.clear();
|
||||
Main.logger.info("成功添加学生-" + nameText.getText());
|
||||
ShowMessage.showAlert(Alert.AlertType.INFORMATION, "成功", "添加学生数据成功!");
|
||||
// PieChart
|
||||
UpdatePieChart.updatePieChart(scorePieChart);
|
||||
} catch (SQLException | IOException e) {
|
||||
Main.logger.error("添加学生数据失败!");
|
||||
ShowMessage.showErrorAlert("错误", "添加学生数据失败!");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
ObservableList<Student> studentData = StudentDAO.searchStudents();
|
||||
populateStudents(studentData);
|
||||
} else {
|
||||
// if the student id is in the database
|
||||
ShowMessage.showErrorAlert("错误", "该学号已存在!");
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
ShowMessage.showErrorAlert("错误", "成绩必须为数字!");
|
||||
}
|
||||
} else {
|
||||
// if any of the text fields is empty
|
||||
ShowMessage.showErrorAlert("错误", "请填写完整!");
|
||||
}
|
||||
}
|
||||
|
||||
// Delete a student
|
||||
@FXML
|
||||
public void handleDeleteStudent(MouseEvent mouseEvent) {
|
||||
Student selectedStudent = studentTable.getSelectionModel().getSelectedItem();
|
||||
if (selectedStudent != null) {
|
||||
try {
|
||||
// backup the database
|
||||
String DbPath = GetCWD.getCWD() + "\\backup\\" + GenerateRandomTime.Generate() + ".db";
|
||||
Main.dbPathStack.push(DbPath);
|
||||
DBUtil.dbBackup(DbPath);
|
||||
StudentDAO.deleteStudent(selectedStudent.getStudentId());
|
||||
Main.logger.info("成功删除学生-" + selectedStudent.getName());
|
||||
ShowMessage.showAlert(Alert.AlertType.INFORMATION, "成功", "学生" +
|
||||
selectedStudent.getName() + "的数据删除成功!");
|
||||
// PieChart
|
||||
UpdatePieChart.updatePieChart(scorePieChart);
|
||||
} catch (SQLException | IOException e) {
|
||||
Main.logger.error("删除学生数据失败!");
|
||||
ShowMessage.showErrorAlert("错误", "删除学生数据失败!");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
try {
|
||||
ObservableList<Student> studentData = StudentDAO.searchStudents();
|
||||
populateStudents(studentData);
|
||||
} catch (SQLException e) {
|
||||
ShowMessage.showErrorAlert("错误", e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else {
|
||||
ShowMessage.showErrorAlert("错误", "请选择要删除的学生!");
|
||||
}
|
||||
}
|
||||
|
||||
// Update a student
|
||||
@FXML
|
||||
public void handleUpdateStudent(MouseEvent mouseEvent) {
|
||||
Student selectedStudent = studentTable.getSelectionModel().getSelectedItem();
|
||||
if (selectedStudent != null) {
|
||||
Dialog<Student> dialog = new Dialog<>();
|
||||
dialog.setTitle("信息修改");
|
||||
|
||||
ButtonType modifyButtonType = new ButtonType("修改", ButtonBar.ButtonData.OK_DONE);
|
||||
dialog.getDialogPane().getButtonTypes().addAll(modifyButtonType, ButtonType.CANCEL);
|
||||
|
||||
GridPane gridPane = new GridPane();
|
||||
gridPane.setPadding(new Insets(10));
|
||||
gridPane.setHgap(10);
|
||||
gridPane.setVgap(10);
|
||||
|
||||
TextField nameTextField = new TextField(selectedStudent.getName());
|
||||
nameTextField.setDisable(true);
|
||||
TextField genderTextField = new TextField(selectedStudent.getGender());
|
||||
genderTextField.setDisable(true);
|
||||
TextField studentIdTextField = new TextField(selectedStudent.getStudentId());
|
||||
studentIdTextField.setDisable(true);
|
||||
TextField scoreTextField = new TextField(Double.toString(selectedStudent.getScore()));
|
||||
|
||||
gridPane.add(new Label("Name:"), 0, 0);
|
||||
gridPane.add(nameTextField, 1, 0);
|
||||
gridPane.add(new Label("Gender:"), 0, 1);
|
||||
gridPane.add(genderTextField, 1, 1);
|
||||
gridPane.add(new Label("Student ID:"), 0, 2);
|
||||
gridPane.add(studentIdTextField, 1, 2);
|
||||
gridPane.add(new Label("Score:"), 0, 3);
|
||||
gridPane.add(scoreTextField, 1, 3);
|
||||
|
||||
dialog.getDialogPane().setContent(gridPane);
|
||||
|
||||
dialog.setResultConverter(dialogButton -> {
|
||||
if (dialogButton == modifyButtonType) {
|
||||
selectedStudent.setScore(Double.parseDouble(scoreTextField.getText()));
|
||||
try {
|
||||
// backup the database
|
||||
String DbPath = GetCWD.getCWD() + "\\backup\\" + GenerateRandomTime.Generate() + ".db";
|
||||
Main.dbPathStack.push(DbPath);
|
||||
DBUtil.dbBackup(DbPath);
|
||||
// update the student score
|
||||
StudentDAO.updateScore(selectedStudent.getStudentId(), selectedStudent.getScore());
|
||||
Main.logger.info("学生" + selectedStudent.getName() + "的成绩被修改为: "
|
||||
+ selectedStudent.getScore());
|
||||
// PieChart
|
||||
UpdatePieChart.updatePieChart(scorePieChart);
|
||||
} catch (SQLException | IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return selectedStudent;
|
||||
}
|
||||
return null;
|
||||
});
|
||||
|
||||
dialog.showAndWait().ifPresent(result -> {
|
||||
studentTable.refresh();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// handle Revoke
|
||||
@FXML
|
||||
public void handleRevoke(ActionEvent actionEvent) {
|
||||
try {
|
||||
Revoke.revokeEdit(Main.dbPathStack, studentTable);
|
||||
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
// restore DB
|
||||
public void handleRestoreDB(ActionEvent actionEvent) {
|
||||
FileChooser fileChooser = new FileChooser();
|
||||
fileChooser.setTitle("选择数据库文件");
|
||||
fileChooser.getExtensionFilters().addAll(
|
||||
new FileChooser.ExtensionFilter("DB Files", "*.db")
|
||||
);
|
||||
fileChooser.setInitialDirectory(new File(GetCWD.getCWD() + "\\backup\\"));
|
||||
File file = fileChooser.showOpenDialog(null);
|
||||
if (file != null) {
|
||||
try {
|
||||
DBUtil.dbRestore(file.getAbsolutePath());
|
||||
Main.logger.info("成功恢复数据库");
|
||||
ShowMessage.showAlert(Alert.AlertType.INFORMATION, "成功", "数据库恢复成功!");
|
||||
|
||||
ObservableList<Student> studentData = StudentDAO.searchStudents();
|
||||
populateStudents(studentData);
|
||||
// PieChart
|
||||
UpdatePieChart.updatePieChart(scorePieChart);
|
||||
} catch (IOException | SQLException e) {
|
||||
Main.logger.error("数据库恢复失败");
|
||||
ShowMessage.showErrorAlert("错误", "数据库恢复失败!");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package com.bobmaster.studentsystem.controller;
|
||||
|
||||
import com.bobmaster.studentsystem.Config;
|
||||
import com.bobmaster.studentsystem.util.ShowMessage;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.Alert;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.stage.DirectoryChooser;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
public class SettingPageLayout {
|
||||
@FXML
|
||||
public TextField backUpPathText;
|
||||
|
||||
@FXML
|
||||
public TextField backUpIntervalText;
|
||||
|
||||
@FXML
|
||||
public Map<String, Object> map = null;
|
||||
|
||||
@FXML
|
||||
public void initialize() throws IOException {
|
||||
map = (Map<String, Object>) Config.LoadConfig(Map.class);
|
||||
backUpPathText.setText(map.get("backupPath").toString());
|
||||
backUpIntervalText.setText(map.get("backupInterval").toString());
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void handleSettingBackUpPath(MouseEvent mouseEvent) {
|
||||
// popup a directory chooser dialog
|
||||
DirectoryChooser directoryChooser = new DirectoryChooser();
|
||||
directoryChooser.setTitle("选择备份路径");
|
||||
File file = directoryChooser.showDialog(null);
|
||||
if (file != null) {
|
||||
backUpPathText.setText(file.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void handleSettingSave(MouseEvent mouseEvent) throws IOException {
|
||||
map.put("backupPath", backUpPathText.getText());
|
||||
map.put("backupInterval", Integer.parseInt(backUpIntervalText.getText()));
|
||||
Config.SaveConfig(map);
|
||||
ShowMessage.showAlert(Alert.AlertType.INFORMATION, "保存成功", "定时任务间隔重启生效");
|
||||
backUpPathText.getScene().getWindow().hide();
|
||||
}
|
||||
}
|
68
src/main/java/com/bobmaster/studentsystem/model/Student.java
Normal file
68
src/main/java/com/bobmaster/studentsystem/model/Student.java
Normal file
|
@ -0,0 +1,68 @@
|
|||
package com.bobmaster.studentsystem.model;
|
||||
import javafx.beans.property.*;
|
||||
public class Student {
|
||||
// Declare Students Table Columns
|
||||
private final StringProperty name;
|
||||
private final StringProperty gender;
|
||||
private final StringProperty studentId;
|
||||
private final DoubleProperty score;
|
||||
|
||||
// Constructor
|
||||
public Student() {
|
||||
this.name = new SimpleStringProperty();
|
||||
this.gender = new SimpleStringProperty();
|
||||
this.studentId = new SimpleStringProperty();
|
||||
this.score = new SimpleDoubleProperty();
|
||||
}
|
||||
|
||||
// name
|
||||
public String getName() {
|
||||
return name.get();
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name.set(name);
|
||||
}
|
||||
|
||||
public StringProperty studentNameProperty() {
|
||||
return name;
|
||||
}
|
||||
// gender
|
||||
public String getGender() {
|
||||
return gender.get();
|
||||
}
|
||||
|
||||
public void setGender(String gender) {
|
||||
this.gender.set(gender);
|
||||
}
|
||||
|
||||
public StringProperty studentGenderProperty() {
|
||||
return gender;
|
||||
}
|
||||
|
||||
// studentId
|
||||
public String getStudentId() {
|
||||
return studentId.get();
|
||||
}
|
||||
|
||||
public void setStudentId(String studentId) {
|
||||
this.studentId.set(studentId);
|
||||
}
|
||||
|
||||
public StringProperty studentIdProperty() {
|
||||
return studentId;
|
||||
}
|
||||
|
||||
// score
|
||||
public double getScore() {
|
||||
return score.get();
|
||||
}
|
||||
|
||||
public void setScore(double score) {
|
||||
this.score.set(score);
|
||||
}
|
||||
|
||||
public DoubleProperty studentScoreProperty() {
|
||||
return score;
|
||||
}
|
||||
}
|
138
src/main/java/com/bobmaster/studentsystem/model/StudentDAO.java
Normal file
138
src/main/java/com/bobmaster/studentsystem/model/StudentDAO.java
Normal file
|
@ -0,0 +1,138 @@
|
|||
package com.bobmaster.studentsystem.model;
|
||||
|
||||
import com.bobmaster.studentsystem.util.DBUtil;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
|
||||
import java.sql.*;
|
||||
|
||||
public class StudentDAO {
|
||||
// *******************************
|
||||
// select a student
|
||||
// *******************************
|
||||
public static Student searchStudent(String studentId) throws SQLException {
|
||||
// Declare a SELECT statement
|
||||
String selectStmt = "SELECT * FROM student WHERE studentId = '" + studentId + "'";
|
||||
|
||||
// Execute SELECT statement
|
||||
try {
|
||||
// Get ResultSet from dbExecuteQuery method
|
||||
ResultSet rsStudent = DBUtil.dbExecuteQuery(selectStmt);
|
||||
|
||||
// Return student object
|
||||
return getStudentFromResultSet(rsStudent);
|
||||
} catch (SQLException e) {
|
||||
System.out.println("While searching a student with " + studentId + " id, an error occurred: " + e);
|
||||
// Return exception
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
// use ResultSet from DB as parameter and set Student Object's attributes and return student object.
|
||||
private static Student getStudentFromResultSet(ResultSet rs) throws SQLException {
|
||||
Student stu = null;
|
||||
if (rs.next()) {
|
||||
stu = new Student();
|
||||
stu.setName(rs.getString("name"));
|
||||
stu.setGender(rs.getString("gender"));
|
||||
stu.setStudentId(rs.getString("studentId"));
|
||||
stu.setScore(rs.getDouble("score"));
|
||||
}
|
||||
return stu;
|
||||
}
|
||||
|
||||
// *******************************
|
||||
// select all students
|
||||
// *******************************
|
||||
public static ObservableList<Student> searchStudents() throws SQLException {
|
||||
// Declare a SELECT statement
|
||||
String selectStmt = "SELECT * FROM student";
|
||||
|
||||
// Execute SELECT statement
|
||||
try {
|
||||
// Get ResultSet from dbExecuteQuery method
|
||||
ResultSet rsStudents = DBUtil.dbExecuteQuery(selectStmt);
|
||||
// Send ResultSet to the getStudentList method and get student object
|
||||
ObservableList<Student> studentList = getStudentList(rsStudents);
|
||||
|
||||
// Return student object
|
||||
return studentList;
|
||||
} catch (SQLException e) {
|
||||
System.out.println("SQL select operation has been failed: " + e);
|
||||
// Return exception
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
// Select * from students operation
|
||||
private static ObservableList<Student> getStudentList(ResultSet rs) throws SQLException {
|
||||
ObservableList<Student> studentList = FXCollections.observableArrayList();
|
||||
while (rs.next()) {
|
||||
Student stu = new Student();
|
||||
stu.setName(rs.getString("name"));
|
||||
stu.setGender(rs.getString("gender"));
|
||||
stu.setStudentId(rs.getString("studentId"));
|
||||
stu.setScore(rs.getDouble("score"));
|
||||
// Add student to the ObservableList
|
||||
studentList.add(stu);
|
||||
}
|
||||
return studentList;
|
||||
}
|
||||
|
||||
// *******************************
|
||||
// insert a student
|
||||
// *******************************
|
||||
public static void insertStudent(String name, String gender, String studentId, double score) throws SQLException {
|
||||
// Declare a Insert statement
|
||||
String insertStmt =
|
||||
"INSERT INTO student\n" +
|
||||
"(name, gender, studentId, score)\n" +
|
||||
"VALUES\n" +
|
||||
"('"+name+"',"+"'"+gender+"',"+"'"+studentId+"',"+score+");";
|
||||
// Execute INSERT operation
|
||||
try {
|
||||
DBUtil.dbExecuteUpdate(insertStmt);
|
||||
} catch (SQLException e) {
|
||||
System.out.print("Error occurred while INSERT Operation: " + e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
// *******************************
|
||||
// update a student
|
||||
// *******************************
|
||||
public static void updateScore(String studentId, double score) throws SQLException {
|
||||
// Declare a UPDATE statement
|
||||
String updateStmt =
|
||||
"BEGIN TRANSACTION;\n" +
|
||||
"UPDATE student\n" +
|
||||
"SET score = "+score+"\n" +
|
||||
"WHERE studentId = '"+studentId+"';\n" +
|
||||
"COMMIT;";
|
||||
// Execute UPDATE operation
|
||||
try {
|
||||
DBUtil.dbExecuteUpdate(updateStmt);
|
||||
} catch (SQLException e) {
|
||||
System.out.print("Error occurred while UPDATE Operation: " + e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
// *******************************
|
||||
// delete a student
|
||||
// *******************************
|
||||
public static void deleteStudent(String studentId) throws SQLException{
|
||||
// Declare a DELETE statement
|
||||
String deleteStmt =
|
||||
"BEGIN TRANSACTION;\n" +
|
||||
"DELETE FROM student\n" +
|
||||
"WHERE studentId = '"+studentId+"';\n" +
|
||||
"COMMIT;";
|
||||
// Execute DELETE operation
|
||||
try {
|
||||
DBUtil.dbExecuteUpdate(deleteStmt);
|
||||
} catch (SQLException e) {
|
||||
System.out.print("Error occurred while DELETE Operation: " + e);
|
||||
}
|
||||
}
|
||||
}
|
113
src/main/java/com/bobmaster/studentsystem/util/DBUtil.java
Normal file
113
src/main/java/com/bobmaster/studentsystem/util/DBUtil.java
Normal file
|
@ -0,0 +1,113 @@
|
|||
package com.bobmaster.studentsystem.util;
|
||||
import java.io.File;
|
||||
import java.sql.*;
|
||||
public class DBUtil {
|
||||
// Declare sqlite3 URL
|
||||
private static final String DB_URL = "jdbc:sqlite:student.db";
|
||||
|
||||
// Connection
|
||||
private static Connection conn = null;
|
||||
|
||||
// Connect to database
|
||||
public static void dbConnect() throws SQLException {
|
||||
try {
|
||||
conn = DriverManager.getConnection(DB_URL);
|
||||
} catch (SQLException e) {
|
||||
System.out.println("Connection failed: " + e.getMessage());
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
// Close connection
|
||||
public static void dbDisconnect() throws SQLException {
|
||||
try {
|
||||
if (conn != null && !conn.isClosed()) {
|
||||
conn.close();
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
System.out.println("Disconnection failed: " + e.getMessage());
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
// DB Execute Query Operation
|
||||
public static ResultSet dbExecuteQuery(String queryStmt) throws SQLException {
|
||||
Statement stmt = null;
|
||||
ResultSet resultSet = null;
|
||||
try {
|
||||
dbConnect();
|
||||
stmt = conn.createStatement();
|
||||
resultSet = stmt.executeQuery(queryStmt);
|
||||
} catch (SQLException e) {
|
||||
System.out.println("Problem occurred at executeQuery operation: " + e.getMessage());
|
||||
throw e;
|
||||
}
|
||||
return resultSet;
|
||||
}
|
||||
|
||||
// DB Execute Update Operation (For Update/Insert/Delete)
|
||||
public static void dbExecuteUpdate(String sqlStmt) throws SQLException {
|
||||
Statement stmt = null;
|
||||
try {
|
||||
dbConnect();
|
||||
stmt = conn.createStatement();
|
||||
stmt.executeUpdate(sqlStmt);
|
||||
} catch (SQLException e) {
|
||||
System.out.println("Problem occurred at executeUpdate operation: " + e.getMessage());
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
// DB initialize
|
||||
public static void dbInit() throws SQLException {
|
||||
Statement stmt = null;
|
||||
try {
|
||||
dbConnect();
|
||||
stmt = conn.createStatement();
|
||||
stmt.execute("CREATE TABLE IF NOT EXISTS student (" +
|
||||
"id INTEGER PRIMARY KEY AUTOINCREMENT," +
|
||||
"name TEXT," +
|
||||
"gender TEXT," +
|
||||
"studentId TEXT," +
|
||||
"score REAL"+
|
||||
");"
|
||||
);
|
||||
} catch (SQLException e) {
|
||||
System.out.println("Problem occurred at dbInit operation: " + e.getMessage());
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
// DB backup
|
||||
public static void dbBackup(String path) throws SQLException {
|
||||
// check if directory exists, if not create it
|
||||
String dir = path.substring(0, path.lastIndexOf("\\"));
|
||||
File file = new File(dir);
|
||||
if (!file.exists()) {
|
||||
file.mkdirs();
|
||||
}
|
||||
|
||||
Statement stmt = null;
|
||||
try {
|
||||
dbConnect();
|
||||
stmt = conn.createStatement();
|
||||
stmt.execute("backup to " + path);
|
||||
} catch (SQLException e) {
|
||||
System.out.println("Problem occurred at dbBackup operation: " + e.getMessage());
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
// DB restore
|
||||
public static void dbRestore(String path) throws SQLException {
|
||||
Statement stmt = null;
|
||||
try {
|
||||
dbConnect();
|
||||
stmt = conn.createStatement();
|
||||
stmt.execute("restore from " + path);
|
||||
} catch (SQLException e) {
|
||||
System.out.println("Problem occurred at dbRestore operation: " + e.getMessage());
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
package com.bobmaster.studentsystem.util;
|
||||
import com.bobmaster.studentsystem.Main;
|
||||
import javafx.scene.control.Alert;
|
||||
import javafx.stage.FileChooser;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Date;
|
||||
import java.util.Optional;
|
||||
|
||||
public class ExportToExcel {
|
||||
public static void exportToExcel() {
|
||||
FileChooser fileChooser = new FileChooser();
|
||||
fileChooser.setTitle("导出为Excel");
|
||||
fileChooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("Excel Files", "*.xlsx"));
|
||||
fileChooser.setInitialFileName("学生信息_" + GenerateRandomTime.Generate()
|
||||
+ ".xlsx");
|
||||
|
||||
File file = fileChooser.showSaveDialog(null);
|
||||
if (file != null) {
|
||||
try {
|
||||
ResultSet rs = DBUtil.dbExecuteQuery("SELECT name, gender, studentId, " +
|
||||
"score FROM student ORDER BY score DESC");
|
||||
XSSFWorkbook workbook = new XSSFWorkbook();
|
||||
workbook.getProperties().getCoreProperties().setCreator("龚智勋");
|
||||
workbook.getProperties().getCoreProperties().setCreated(Optional.of(new Date()));
|
||||
Sheet sheet = workbook.createSheet("学生综合信息表");
|
||||
|
||||
// Create header row
|
||||
Row headerRow = sheet.createRow(0);
|
||||
headerRow.createCell(0).setCellValue("姓名");
|
||||
headerRow.createCell(1).setCellValue("性别");
|
||||
headerRow.createCell(2).setCellValue("学号");
|
||||
headerRow.createCell(3).setCellValue("JP成绩");
|
||||
|
||||
// Write student data
|
||||
int rowNum = 1;
|
||||
while (rs.next()) {
|
||||
String name = rs.getString("name");
|
||||
String gender = rs.getString("gender");
|
||||
String studentId = rs.getString("studentId");
|
||||
double score = rs.getDouble("score");
|
||||
|
||||
Row row = sheet.createRow(rowNum++);
|
||||
row.createCell(0).setCellValue(name);
|
||||
row.createCell(1).setCellValue(gender);
|
||||
row.createCell(2).setCellValue(studentId);
|
||||
row.createCell(3).setCellValue(score);
|
||||
}
|
||||
|
||||
// Auto size columns
|
||||
for (int i = 0; i < 4; i++) {
|
||||
// sheet.autoSizeColumn(i);
|
||||
if (i == 0) {
|
||||
sheet.setColumnWidth(i, 256 * 6);
|
||||
} else if (i == 1) {
|
||||
sheet.setColumnWidth(i, 256 * 6);
|
||||
} else if (i == 2) {
|
||||
sheet.setColumnWidth(i, 256 * 12);
|
||||
} else {
|
||||
sheet.setColumnWidth(i, 256 * 6);
|
||||
}
|
||||
}
|
||||
|
||||
// Write workbook to file
|
||||
try {
|
||||
FileOutputStream fileOutputStream = new FileOutputStream(file);
|
||||
workbook.write(fileOutputStream);
|
||||
workbook.close();
|
||||
} catch (IOException e) {
|
||||
ShowMessage.showErrorAlert("导出失败", "Excel文件导出失败"+e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
Main.logger.info("学生信息导出至: "+file.getAbsolutePath());
|
||||
ShowMessage.showAlert(Alert.AlertType.INFORMATION, "导出成功", "Excel文件导出至: "+
|
||||
file.getAbsolutePath());
|
||||
|
||||
} catch (SQLException e ) {
|
||||
ShowMessage.showErrorAlert("导出失败", "Excel文件导出失败"+e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package com.bobmaster.studentsystem.util;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
public class GenerateRandomTime {
|
||||
public static String Generate() {
|
||||
return new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss").format(new Date());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package com.bobmaster.studentsystem.util;
|
||||
|
||||
import java.nio.file.Paths;
|
||||
|
||||
public class GetCWD {
|
||||
public static String getCWD() {
|
||||
return Paths.get("").toAbsolutePath().toString();
|
||||
}
|
||||
}
|
28
src/main/java/com/bobmaster/studentsystem/util/Revoke.java
Normal file
28
src/main/java/com/bobmaster/studentsystem/util/Revoke.java
Normal file
|
@ -0,0 +1,28 @@
|
|||
package com.bobmaster.studentsystem.util;
|
||||
import com.bobmaster.studentsystem.model.Student;
|
||||
import com.bobmaster.studentsystem.model.StudentDAO;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.chart.PieChart;
|
||||
import javafx.scene.control.Alert;
|
||||
import javafx.scene.control.TableView;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Stack;
|
||||
|
||||
public class Revoke {
|
||||
public static void revokeEdit(Stack<String> stack, TableView<Student> studentTableView) throws SQLException, IOException {
|
||||
if (stack.size() != 0) {
|
||||
String dbPath = stack.pop();
|
||||
DBUtil.dbRestore(dbPath);
|
||||
ObservableList<Student> studentData = StudentDAO.searchStudents();
|
||||
studentTableView.setItems(studentData);
|
||||
// Update pieChart
|
||||
Scene scene = studentTableView.getScene();
|
||||
UpdatePieChart.updatePieChart((PieChart) scene.lookup("#scorePieChart"));
|
||||
} else {
|
||||
ShowMessage.showAlert(Alert.AlertType.WARNING, "撤销失败", "没有可撤销的操作");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.bobmaster.studentsystem.util;
|
||||
|
||||
import javafx.scene.control.Alert;
|
||||
|
||||
public class ShowMessage {
|
||||
public static void showAlert(Alert.AlertType alertType, String title, String message) {
|
||||
Alert alert = new Alert(alertType);
|
||||
alert.setTitle(title);
|
||||
alert.setHeaderText(null);
|
||||
alert.setContentText(message);
|
||||
alert.showAndWait();
|
||||
}
|
||||
|
||||
public static void showErrorAlert(String title, String message) {
|
||||
showAlert(Alert.AlertType.ERROR, title, message);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package com.bobmaster.studentsystem.util;
|
||||
|
||||
import com.bobmaster.studentsystem.Main;
|
||||
import com.bobmaster.studentsystem.controller.RootLayout;
|
||||
import com.bobmaster.studentsystem.model.StudentDAO;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.chart.PieChart;
|
||||
import javafx.scene.control.Label;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class UpdatePieChart {
|
||||
public static void updatePieChart(PieChart pieChart) throws SQLException, IOException {
|
||||
ObservableList<PieChart.Data> pieChartData = FXCollections.observableArrayList();
|
||||
// calculate the number of students in each score range
|
||||
int[] scoreRange = new int[6];
|
||||
for (int i = 0; i < 5; i++) {
|
||||
scoreRange[i] = 0;
|
||||
}
|
||||
for (int i = 0; i < StudentDAO.searchStudents().size(); i++) {
|
||||
if (StudentDAO.searchStudents().get(i).getScore() < 60) {
|
||||
scoreRange[0]++;
|
||||
} else if (StudentDAO.searchStudents().get(i).getScore() < 70) {
|
||||
scoreRange[1]++;
|
||||
} else if (StudentDAO.searchStudents().get(i).getScore() < 80) {
|
||||
scoreRange[2]++;
|
||||
} else if (StudentDAO.searchStudents().get(i).getScore() < 90) {
|
||||
scoreRange[3]++;
|
||||
} else if (StudentDAO.searchStudents().get(i).getScore() <= 100) {
|
||||
scoreRange[4]++;
|
||||
}
|
||||
}
|
||||
int total = 0;
|
||||
for (int i = 0; i < 5; i++) {
|
||||
total += scoreRange[i];
|
||||
}
|
||||
// add data to pie chart
|
||||
pieChartData.add(new PieChart.Data("0-60(" + scoreRange[0]*100/total + "%)", scoreRange[0]));
|
||||
pieChartData.add(new PieChart.Data("60-70(" + scoreRange[1]*100/total + "%)", scoreRange[1]));
|
||||
pieChartData.add(new PieChart.Data("70-80(" + scoreRange[2]*100/total + "%)", scoreRange[2]));
|
||||
pieChartData.add(new PieChart.Data("80-90(" + scoreRange[3]*100/total + "%)", scoreRange[3]));
|
||||
pieChartData.add(new PieChart.Data("90-100(" + scoreRange[4]*100/total + "%)", scoreRange[4]));
|
||||
|
||||
// set pieChart data
|
||||
pieChart.setData(pieChartData);
|
||||
}
|
||||
}
|
19
src/main/java/module-info.java
Normal file
19
src/main/java/module-info.java
Normal file
|
@ -0,0 +1,19 @@
|
|||
module com.bobmaster.studentsystem {
|
||||
requires javafx.controls;
|
||||
requires javafx.fxml;
|
||||
|
||||
requires org.controlsfx.controls;
|
||||
requires org.kordamp.ikonli.javafx;
|
||||
requires java.sql;
|
||||
requires org.apache.poi.poi;
|
||||
requires org.apache.poi.ooxml;
|
||||
requires com.fasterxml.jackson.databind;
|
||||
requires org.apache.logging.log4j;
|
||||
requires org.apache.logging.log4j.core;
|
||||
|
||||
opens com.bobmaster.studentsystem to javafx.fxml;
|
||||
exports com.bobmaster.studentsystem;
|
||||
exports com.bobmaster.studentsystem.controller;
|
||||
exports com.bobmaster.studentsystem.model;
|
||||
exports com.bobmaster.studentsystem.util;
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.image.Image?>
|
||||
<?import javafx.scene.image.ImageView?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
<?import javafx.scene.text.Font?>
|
||||
|
||||
<AnchorPane fx:id="aboutPagePane" minHeight="0.0" minWidth="0.0" onMouseClicked="#handleHideAboutPage" prefHeight="259.0" prefWidth="416.0" xmlns="http://javafx.com/javafx/20.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.bobmaster.studentsystem.controller.AboutPage">
|
||||
<children>
|
||||
<ImageView fitHeight="176.0" fitWidth="154.0" layoutX="14.0" layoutY="27.0" pickOnBounds="true" preserveRatio="true">
|
||||
<image>
|
||||
<Image url="@assets/aboutPage.png" />
|
||||
</image>
|
||||
</ImageView>
|
||||
<Label layoutX="168.0" layoutY="14.0" prefHeight="37.0" prefWidth="196.0" text="学生成绩管理系统 ">
|
||||
<font>
|
||||
<Font name="System Bold" size="24.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label layoutX="316.0" layoutY="228.0" prefHeight="17.0" prefWidth="63.0" text="版本: v0.0.1" />
|
||||
<Label layoutX="96.0" layoutY="228.0" prefHeight="17.0" prefWidth="187.0" text="Powered by openjdk20.0.1+javaFX" />
|
||||
<Label layoutX="220.0" layoutY="51.0" prefHeight="17.0" prefWidth="73.0" text="Java课设作品" />
|
||||
<Label layoutX="214.0" layoutY="68.0" text="通信2102龚智勋" />
|
||||
</children>
|
||||
</AnchorPane>
|
|
@ -0,0 +1,81 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.Cursor?>
|
||||
<?import javafx.scene.Group?>
|
||||
<?import javafx.scene.chart.PieChart?>
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.Menu?>
|
||||
<?import javafx.scene.control.MenuBar?>
|
||||
<?import javafx.scene.control.MenuItem?>
|
||||
<?import javafx.scene.control.TableColumn?>
|
||||
<?import javafx.scene.control.TableView?>
|
||||
<?import javafx.scene.control.TextField?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
|
||||
<AnchorPane focusTraversable="true" prefHeight="472.0" prefWidth="637.0" stylesheets="@style.css" xmlns="http://javafx.com/javafx/20.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.bobmaster.studentsystem.controller.RootLayout">
|
||||
<children>
|
||||
<Group layoutX="405.0" layoutY="260.0">
|
||||
<children>
|
||||
<Label layoutY="4.0" text="姓名:">
|
||||
<opaqueInsets>
|
||||
<Insets />
|
||||
</opaqueInsets>
|
||||
</Label>
|
||||
<TextField fx:id="nameText" layoutX="35.0" prefHeight="25.0" prefWidth="142.0" />
|
||||
<Label layoutY="41.0" text="性别:" />
|
||||
<TextField fx:id="genderText" layoutX="35.0" layoutY="37.0" prefHeight="25.0" prefWidth="142.0" />
|
||||
<Label layoutY="80.0" text="学号:" />
|
||||
<TextField fx:id="idText" layoutX="35.0" layoutY="76.0" prefHeight="25.0" prefWidth="142.0" />
|
||||
<Label layoutX="-5.0" layoutY="113.0" text="JP成绩:" />
|
||||
<TextField fx:id="scoreText" layoutX="35.0" layoutY="109.0" prefHeight="25.0" prefWidth="141.0" />
|
||||
</children>
|
||||
</Group>
|
||||
<HBox layoutY="31.0" prefHeight="440.0" prefWidth="356.0">
|
||||
<children>
|
||||
<TableView fx:id="studentTable" editable="true" prefHeight="455.0" prefWidth="356.0">
|
||||
<columns>
|
||||
<TableColumn fx:id="stuNameColumn" prefWidth="75.0" text="姓名" />
|
||||
<TableColumn fx:id="stuGenderColumn" prefWidth="42.000030517578125" text="性别" />
|
||||
<TableColumn fx:id="stuIdColumn" prefWidth="75.0" text="学号" />
|
||||
<TableColumn fx:id="stuScoreColumn" prefWidth="75.0" text="JP成绩" />
|
||||
</columns>
|
||||
</TableView>
|
||||
</children>
|
||||
</HBox>
|
||||
<MenuBar layoutY="1.0" opacity="0.67" prefHeight="31.0" prefWidth="637.0">
|
||||
<menus>
|
||||
<Menu mnemonicParsing="false" text="File">
|
||||
<items>
|
||||
<MenuItem mnemonicParsing="false" onAction="#handleExportToExcel" text="导出为Excel CTRL+S" />
|
||||
<MenuItem fx:id="quit" mnemonicParsing="false" onAction="#handleExit" text="退出 CTRL+Q" />
|
||||
</items>
|
||||
</Menu>
|
||||
<Menu mnemonicParsing="false" text="Edit">
|
||||
<items>
|
||||
<MenuItem mnemonicParsing="false" onAction="#handleSettingPage" text="设置" />
|
||||
<MenuItem mnemonicParsing="false" onAction="#handleRevoke" text="撤销 CTRL+Z" />
|
||||
<MenuItem mnemonicParsing="false" onAction="#handleRestoreDB" text="还原数据库" />
|
||||
</items>
|
||||
</Menu>
|
||||
<Menu mnemonicParsing="false" text="Help">
|
||||
<items>
|
||||
<MenuItem mnemonicParsing="false" onAction="#handleAboutPage" text="关于" />
|
||||
</items></Menu>
|
||||
</menus>
|
||||
<padding>
|
||||
<Insets bottom="5.0" />
|
||||
</padding>
|
||||
<cursor>
|
||||
<Cursor fx:constant="HAND" />
|
||||
</cursor>
|
||||
</MenuBar>
|
||||
<PieChart fx:id="scorePieChart" layoutX="371.0" layoutY="40.0" legendSide="RIGHT" prefHeight="202.0" prefWidth="249.0" title="成绩分布" />
|
||||
<Button fx:id="addStudentBtn" layoutX="437.0" layoutY="410.0" mnemonicParsing="false" onMouseClicked="#handleAddStudent" text="添加">
|
||||
</Button>
|
||||
<Button fx:id="updateStudentBtn" layoutX="491.0" layoutY="410.0" mnemonicParsing="false" onMouseClicked="#handleUpdateStudent" text="修改" />
|
||||
<Button fx:id="deleteStudentBtn" layoutX="542.0" layoutY="410.0" mnemonicParsing="false" onMouseClicked="#handleDeleteStudent" text="删除" />
|
||||
</children>
|
||||
</AnchorPane>
|
|
@ -0,0 +1,26 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.TextField?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
<?import javafx.scene.text.Font?>
|
||||
|
||||
<AnchorPane prefHeight="286.0" prefWidth="399.0" xmlns="http://javafx.com/javafx/20.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.bobmaster.studentsystem.controller.SettingPageLayout">
|
||||
<children>
|
||||
<Label layoutX="46.0" layoutY="57.0" text="备份存储路径">
|
||||
<font>
|
||||
<Font size="16.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label layoutX="46.0" layoutY="172.0" text="自动备份时间间隔">
|
||||
<font>
|
||||
<Font size="16.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<TextField fx:id="backUpIntervalText" layoutX="200.0" layoutY="172.0" promptText="60秒" />
|
||||
<TextField fx:id="backUpPathText" layoutX="149.0" layoutY="57.0" prefHeight="25.0" prefWidth="128.0" />
|
||||
<Button layoutX="289.0" layoutY="57.0" mnemonicParsing="false" onMouseClicked="#handleSettingBackUpPath" text="选择" />
|
||||
<Button layoutX="174.0" layoutY="228.0" mnemonicParsing="false" onMouseClicked="#handleSettingSave" prefHeight="25.0" prefWidth="62.0" text="保存" />
|
||||
</children>
|
||||
</AnchorPane>
|
Binary file not shown.
After Width: | Height: | Size: 3.6 KiB |
9
src/main/resources/com/bobmaster/studentsystem/style.css
Normal file
9
src/main/resources/com/bobmaster/studentsystem/style.css
Normal file
|
@ -0,0 +1,9 @@
|
|||
.menuItem {
|
||||
-fx-background-radius: 5;
|
||||
}
|
||||
|
||||
.context-menu {
|
||||
-fx-background-insets: 0, 1, 2;
|
||||
-fx-background-radius: 0 6 6 6, 0 5 5 5, 0 4 4 4;
|
||||
-fx-padding: 0.333333em 0.083333em 0.666667em 0.083333em; /* 4 1 8 1 */
|
||||
}
|
BIN
src/main/resources/images/icon.png
Normal file
BIN
src/main/resources/images/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.6 KiB |
BIN
src/main/resources/images/setting.png
Normal file
BIN
src/main/resources/images/setting.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.3 KiB |
14
src/main/resources/log4j2.properties
Normal file
14
src/main/resources/log4j2.properties
Normal file
|
@ -0,0 +1,14 @@
|
|||
appender.file.type = File
|
||||
appender.file.name = LOGFILE
|
||||
appender.file.fileName = Program.log
|
||||
appender.file.layout.type = PatternLayout
|
||||
appender.file.layout.pattern = [%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n
|
||||
appender.file.filter.threshold.type = ThresholdFilter
|
||||
appender.file.filter.threshold.level = info
|
||||
|
||||
appender.console.type = Console
|
||||
appender.console.name = STDOUT
|
||||
appender.console.layout.type = PatternLayout
|
||||
appender.console.layout.pattern = [%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n
|
||||
|
||||
rootLogger = debug, STDOUT, LOGFILE
|
Loading…
Reference in a new issue