项目重启
This commit is contained in:
+26
@@ -0,0 +1,26 @@
|
||||
# Compiled class file
|
||||
*.class
|
||||
|
||||
# Log file
|
||||
*.log
|
||||
|
||||
# BlueJ files
|
||||
*.ctxt
|
||||
|
||||
# Mobile Tools for Java (J2ME)
|
||||
.mtj.tmp/
|
||||
|
||||
# Package Files #
|
||||
*.jar
|
||||
*.war
|
||||
*.nar
|
||||
*.ear
|
||||
*.zip
|
||||
*.tar.gz
|
||||
*.rar
|
||||
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
hs_err_pid*
|
||||
|
||||
# My own password
|
||||
src/com/msksbr/SQL/PassWord.java
|
||||
Generated
+8
@@ -0,0 +1,8 @@
|
||||
# 默认忽略的文件
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# 基于编辑器的 HTTP 客户端请求
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
Generated
+13
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<annotationProcessing>
|
||||
<profile name="Maven default annotation processors profile" enabled="true">
|
||||
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||
<outputRelativeToContentRoot value="true" />
|
||||
<module name="system-homework-in-the-library" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
</component>
|
||||
</project>
|
||||
Generated
+20
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RemoteRepositoriesConfiguration">
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Central Repository" />
|
||||
<option name="url" value="https://repo.maven.apache.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Maven Central repository" />
|
||||
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="jboss.community" />
|
||||
<option name="name" value="JBoss Community repository" />
|
||||
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||
</remote-repository>
|
||||
</component>
|
||||
</project>
|
||||
Generated
+9
@@ -0,0 +1,9 @@
|
||||
<component name="libraryTable">
|
||||
<library name="flatlaf-3.2">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/flatlaf-3.2.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
<component name="libraryTable">
|
||||
<library name="mysql-connector-j-8.4.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/mysql-connector-j-8.4.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
<component name="libraryTable">
|
||||
<library name="mysql-connector-j-8.4.0 (2)">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/mysql-connector-j-8.4.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
<component name="libraryTable">
|
||||
<library name="mysql-connector-j-8.4.0 (3)">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/mysql-connector-j-8.4.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
<component name="libraryTable">
|
||||
<library name="mysql-connector-j-8.4.0 (4)">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/mysql-connector-j-8.4.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
<component name="libraryTable">
|
||||
<library name="mysql-connector-j-8.4.0 (5)">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/mysql-connector-j-8.4.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
<component name="libraryTable">
|
||||
<library name="mysql-connector-j-8.4.0 (6)">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/mysql-connector-j-8.4.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
||||
Generated
+14
@@ -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_17" project-jdk-name="17" 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$/system-homework-in-the-library.iml" filepath="$PROJECT_DIR$/system-homework-in-the-library.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
Generated
+127
@@ -0,0 +1,127 @@
|
||||
<?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>
|
||||
<component name="uidesigner-configuration">
|
||||
<option name="DEFAULT_LAYOUT_MANAGER" value="BorderLayout" />
|
||||
</component>
|
||||
</project>
|
||||
Generated
+6
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2024 御坂昴
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.1 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 111 KiB |
Binary file not shown.
@@ -0,0 +1,128 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.msksbr.LoginFrm.LoginFrm">
|
||||
<grid id="27dc6" binding="panel1" default-binding="true" layout-manager="BorderLayout" hgap="0" vgap="0">
|
||||
<constraints>
|
||||
<xy x="74" y="20" width="446" height="204"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<font name="PingFang SC"/>
|
||||
</properties>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="1e979" binding="titlePanel" layout-manager="FlowLayout" hgap="5" vgap="5" flow-align="1">
|
||||
<constraints border-constraint="North"/>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="4318d" class="javax.swing.JLabel" binding="titleLabel">
|
||||
<constraints/>
|
||||
<properties>
|
||||
<font name="PingFang SC" size="36" style="1"/>
|
||||
<text value="登录"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="a0f72" binding="bodyPanel" layout-manager="BorderLayout" hgap="0" vgap="0">
|
||||
<constraints border-constraint="Center"/>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="40c81" binding="labelPanel" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints border-constraint="West"/>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="a09bf" binding="uLabelPanel" layout-manager="FlowLayout" hgap="5" vgap="5" flow-align="2">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="c9cc0" class="javax.swing.JLabel" binding="uLabel">
|
||||
<constraints/>
|
||||
<properties>
|
||||
<font name="PingFang SC" size="18" style="1"/>
|
||||
<text value="用户名:"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="29291" binding="pLabelPanel" layout-manager="FlowLayout" hgap="5" vgap="5" flow-align="2">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="dada" class="javax.swing.JLabel" binding="pLabel">
|
||||
<constraints/>
|
||||
<properties>
|
||||
<font name="PingFang SC" size="18" style="1"/>
|
||||
<horizontalAlignment value="10"/>
|
||||
<text value="密码:"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="8481c" binding="fieldPanel" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints border-constraint="Center"/>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="4d39" layout-manager="FlowLayout" hgap="5" vgap="5" flow-align="0">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="fc448" class="javax.swing.JTextField" binding="uField">
|
||||
<constraints/>
|
||||
<properties>
|
||||
<font name="PingFang SC" style="1"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="f1071" layout-manager="FlowLayout" hgap="5" vgap="5" flow-align="0">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="5fc4f" class="javax.swing.JPasswordField" binding="pField">
|
||||
<constraints/>
|
||||
<properties>
|
||||
<font name="PingFang SC" style="1"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="2e911" binding="bottomPanel" layout-manager="FlowLayout" hgap="5" vgap="5" flow-align="1">
|
||||
<constraints border-constraint="South"/>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="fbf4e" class="javax.swing.JButton" binding="commitButton">
|
||||
<constraints/>
|
||||
<properties>
|
||||
<font name="PingFang SC" size="18" style="1"/>
|
||||
<text value="登录"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
@@ -0,0 +1,118 @@
|
||||
package com.msksbr.LoginFrm;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import com.msksbr.MainFrm.MainFrm;
|
||||
import com.msksbr.SQL.Connector;
|
||||
|
||||
public class LoginFrm extends javax.swing.JFrame {
|
||||
private final Connector connector;
|
||||
private final LoginMessangeExpection loginMessangeExpection;
|
||||
private JPanel panel1;
|
||||
private JPanel titlePanel;
|
||||
private JLabel titleLabel;
|
||||
private JPanel bodyPanel;
|
||||
private JPanel bottomPanel;
|
||||
private JButton commitButton;
|
||||
private JPanel labelPanel;
|
||||
private JPanel fieldPanel;
|
||||
private JPanel uLabelPanel;
|
||||
private JPanel pLabelPanel;
|
||||
private JLabel uLabel;
|
||||
private JLabel pLabel;
|
||||
private JTextField uField;
|
||||
private JPasswordField pField;
|
||||
private String username;
|
||||
private String password;
|
||||
|
||||
public LoginFrm() {
|
||||
loginMessangeExpection = new LoginMessangeExpection();
|
||||
|
||||
try {
|
||||
connector = new Connector();
|
||||
} catch (ClassNotFoundException | SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
setTitle("登录到图书管理系统");
|
||||
setContentPane(panel1);
|
||||
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||
pack();
|
||||
setVisible(true);
|
||||
setSize(400, 250);
|
||||
setResizable(false);
|
||||
|
||||
Dimension fieldDimension = new Dimension(250, 30);
|
||||
this.uField.setPreferredSize(fieldDimension);
|
||||
this.pField.setPreferredSize(fieldDimension);
|
||||
|
||||
this.pField.addKeyListener(new KeyAdapter() {
|
||||
@Override
|
||||
public void keyPressed(KeyEvent e) {
|
||||
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
|
||||
loginMessangeEntered();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.commitButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
|
||||
this.commitButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
loginMessangeEntered();
|
||||
}
|
||||
});
|
||||
|
||||
setLocation();
|
||||
setDialogLocation();
|
||||
}
|
||||
|
||||
private void setLocation() {
|
||||
ScreenSize screenSize = new ScreenSize();
|
||||
setLocation(screenSize.width / 2 - getWidth() / 2, screenSize.height / 2 - getHeight() / 2);
|
||||
}
|
||||
|
||||
private void setDialogLocation() {
|
||||
loginMessangeExpection.setLocation(getX() + getWidth() / 4, getY() + getHeight() / 4);
|
||||
}
|
||||
|
||||
private void loginMessangeEntered() {
|
||||
username = uField.getText();
|
||||
password = new String(pField.getPassword());
|
||||
Boolean ISMessageTrue = isLoginMessageTrue();
|
||||
if (ISMessageTrue) {
|
||||
dispose();
|
||||
try {
|
||||
new MainFrm();
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
} else {
|
||||
loginMessangeExpection.setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
private Boolean isLoginMessageTrue() {
|
||||
try {
|
||||
ResultSet resultSet = connector.executeQuery("SELECT * FROM users WHERE username = '" + username + "'");
|
||||
if (resultSet != null && resultSet.next()) { // 检查结果集是否不为空
|
||||
if (resultSet.getString("password").equals(password)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.msksbr.LoginFrm.LoginMessangeExpection">
|
||||
<grid id="cbd77" binding="contentPane" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="10" left="10" bottom="10" right="10"/>
|
||||
<constraints>
|
||||
<xy x="248" y="54" width="236" height="131"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="94766" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="9538f" layout-manager="FlowLayout" hgap="5" vgap="5" flow-align="1">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="e7465" class="javax.swing.JButton" binding="buttonOK">
|
||||
<constraints/>
|
||||
<properties>
|
||||
<font name="PingFang SC" size="14" style="1"/>
|
||||
<text value="确认"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="e3588" layout-manager="GridBagLayout">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="42fcc" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
|
||||
<gridbag weightx="1.0" weighty="0.0"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<font name="PingFang SC" size="14" style="1"/>
|
||||
<text value="用户名或密码错误"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.msksbr.LoginFrm;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.*;
|
||||
|
||||
public class LoginMessangeExpection extends JDialog {
|
||||
private JPanel contentPane;
|
||||
private JButton buttonOK;
|
||||
|
||||
public LoginMessangeExpection() {
|
||||
setContentPane(contentPane);
|
||||
setModal(true);
|
||||
getRootPane().setDefaultButton(buttonOK);
|
||||
setResizable(false);
|
||||
setSize(200, 150);
|
||||
|
||||
setTitle("登录失败");
|
||||
|
||||
buttonOK.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
onOK();
|
||||
onCancel();
|
||||
}
|
||||
});
|
||||
|
||||
// 点击 X 时调用 onCancel()
|
||||
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
|
||||
addWindowListener(new WindowAdapter() {
|
||||
public void windowClosing(WindowEvent e) {
|
||||
onCancel();
|
||||
}
|
||||
});
|
||||
|
||||
// 遇到 ESCAPE 时调用 onCancel()
|
||||
contentPane.registerKeyboardAction(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
onCancel();
|
||||
}
|
||||
}, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
|
||||
}
|
||||
|
||||
private void onOK() {
|
||||
// 在此处添加您的代码
|
||||
dispose();
|
||||
}
|
||||
|
||||
private void onCancel() {
|
||||
// 必要时在此处添加您的代码
|
||||
dispose();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.msksbr.LoginFrm;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public class ScreenSize {
|
||||
public int width;
|
||||
public int height;
|
||||
public Dimension screenSize;
|
||||
|
||||
public ScreenSize() {
|
||||
screenSize = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
width = screenSize.width;
|
||||
height = screenSize.height;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.msksbr.Main;
|
||||
|
||||
import com.formdev.flatlaf.FlatDarculaLaf;
|
||||
|
||||
import com.msksbr.LoginFrm.LoginFrm;
|
||||
import com.msksbr.MainFrm.MainFrm;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
|
||||
FlatDarculaLaf.install();
|
||||
//new LoginFrm();
|
||||
try {
|
||||
new MainFrm();
|
||||
} catch (SQLException | ClassNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.msksbr.Main;
|
||||
|
||||
import com.msksbr.MainFrm.MainFrm;
|
||||
import com.msksbr.SQL.Connector;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class test {
|
||||
public static void main(String[] args) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.msksbr.MainFrm.MainFrm">
|
||||
<grid id="27dc6" binding="panel1" default-binding="true" layout-manager="BorderLayout" hgap="0" vgap="0">
|
||||
<constraints>
|
||||
<xy x="20" y="20" width="742" height="409"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="3e1f8" layout-manager="FlowLayout" hgap="5" vgap="5" flow-align="1">
|
||||
<constraints border-constraint="North"/>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children/>
|
||||
</grid>
|
||||
<grid id="a9381" binding="tablePanel" layout-manager="GridBagLayout">
|
||||
<constraints border-constraint="Center"/>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="b90f2" class="javax.swing.JLabel" binding="backLabel">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
<gridbag weightx="0.0" weighty="0.0"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value=""/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="4f963" binding="bottomPanel" layout-manager="FlowLayout" hgap="5" vgap="5" flow-align="2">
|
||||
<constraints border-constraint="South"/>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children/>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.msksbr.MainFrm;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
import com.msksbr.LoginFrm.ScreenSize;
|
||||
import com.msksbr.SQL.Connector;
|
||||
|
||||
import java.awt.event.*;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class MainFrm extends JFrame {
|
||||
private Connector connector;
|
||||
private JPanel panel1;
|
||||
private JPanel tablePanel;
|
||||
private JPanel bottomPanel;
|
||||
private JLabel backLabel;
|
||||
private JLabel countMessage = new JLabel();
|
||||
private MenuBar menuBar;
|
||||
|
||||
public MainFrm() throws SQLException, ClassNotFoundException {
|
||||
connector = new Connector();
|
||||
setTitle("图书管理系统");
|
||||
setContentPane(panel1);
|
||||
pack();
|
||||
|
||||
menuBar = new MenuBar();
|
||||
|
||||
|
||||
setJMenuBar(menuBar);
|
||||
setDefaultCloseOperation(EXIT_ON_CLOSE);
|
||||
setSize(960, 720);
|
||||
setVisible(true);
|
||||
|
||||
String countData = "本馆共藏书" + getCount("books") + "本,共记录学生信息" + getCount("students") + "条,已借阅" + getCount("rents") + "本书,人均借阅" + (double) getCount("rents") / getCount("students") + "本";
|
||||
countMessage.setText(countData);
|
||||
bottomPanel.add(countMessage);
|
||||
ImageIcon imageIcon = new ImageIcon("src/com/msksbr/images/backGround.png");
|
||||
addComponentListener(new ComponentAdapter() {
|
||||
public void componentResized(ComponentEvent e) {
|
||||
int imageSize = getWidth() < getHeight() ? getWidth() : getHeight();
|
||||
imageIcon.setImage(imageIcon.getImage().getScaledInstance(imageSize / 2, imageSize / 2, 0));
|
||||
}
|
||||
});
|
||||
int imageSize = getWidth() < getHeight() ? getWidth() : getHeight();
|
||||
imageIcon.setImage(imageIcon.getImage().getScaledInstance(imageSize / 2, imageSize / 2, 0));
|
||||
|
||||
backLabel.setIcon(imageIcon);
|
||||
|
||||
setLocation();
|
||||
initDialogs();
|
||||
}
|
||||
|
||||
|
||||
private void setLocation() {
|
||||
ScreenSize screenSize = new ScreenSize();
|
||||
setLocation(screenSize.width / 2 - getWidth() / 2, screenSize.height / 2 - getHeight() / 2);
|
||||
}
|
||||
|
||||
|
||||
private void initDialogs() {
|
||||
menuBar.exitItem.addActionListener(
|
||||
new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
private int getCount(String table) throws SQLException {
|
||||
ResultSet rs = connector.executeQuery("SELECT COUNT(*) FROM " + table + ";");
|
||||
rs.next();
|
||||
return rs.getInt("COUNT(*)");
|
||||
}
|
||||
|
||||
public int getBookMaxID() throws SQLException {
|
||||
ResultSet rs = connector.executeQuery("SELECT MAX(book_id) FROM books;");
|
||||
rs.next();
|
||||
return rs.getInt("MAX(book_id)");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package com.msksbr.MainFrm;
|
||||
|
||||
import com.msksbr.MainFrm.MenuItemDiaog.Adder.StudentAdder;
|
||||
import com.msksbr.MainFrm.MenuItemDiaog.AuthorDIalog;
|
||||
import com.msksbr.MainFrm.MenuItemDiaog.SearchDIalog;
|
||||
import com.msksbr.MainFrm.MenuItemDiaog.aboutDIalog;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
public class MenuBar extends JMenuBar {
|
||||
public JMenuItem exitItem;
|
||||
protected com.msksbr.MainFrm.MenuItemDiaog.aboutDIalog aboutDIalog;
|
||||
protected AuthorDIalog authorDIalog;
|
||||
|
||||
public MenuBar() {
|
||||
// “文件“菜单
|
||||
JMenu fileMenu = new JMenu("文件");
|
||||
exitItem = new JMenuItem("退出");
|
||||
fileMenu.add(exitItem);
|
||||
|
||||
// ”查询“菜单
|
||||
JMenu searchMenu = new JMenu("查询");
|
||||
JMenuItem bookSearch = new JMenuItem("查询图书信息");
|
||||
bookSearch.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
new SearchDIalog("books");
|
||||
}
|
||||
}
|
||||
);
|
||||
JMenuItem studentSearch = new JMenuItem("查询学生信息");
|
||||
studentSearch.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
new SearchDIalog("students");
|
||||
}
|
||||
});
|
||||
JMenuItem rentSearch = new JMenuItem("查询借阅信息");
|
||||
rentSearch.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
new SearchDIalog("rents");
|
||||
}
|
||||
});
|
||||
searchMenu.add(bookSearch);
|
||||
searchMenu.add(studentSearch);
|
||||
searchMenu.add(rentSearch);
|
||||
|
||||
// ”添加“菜单
|
||||
JMenu addMenu = new JMenu("添加");
|
||||
JMenuItem bookAdd = new JMenuItem("添加图书信息");
|
||||
JMenuItem studentAdd = new JMenuItem("添加学生信息");
|
||||
studentAdd.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
new StudentAdder();
|
||||
}
|
||||
});
|
||||
JMenuItem rentAdd = new JMenuItem("添加借阅信息");
|
||||
addMenu.add(bookAdd);
|
||||
addMenu.add(studentAdd);
|
||||
addMenu.add(rentAdd);
|
||||
|
||||
// ”删除“菜单
|
||||
JMenu removeMenu = new JMenu("删除");
|
||||
JMenuItem bookRemove = new JMenuItem("删除图书信息");
|
||||
JMenuItem studentRemove = new JMenuItem("删除学生信息");
|
||||
JMenuItem rentRemove = new JMenuItem("删除借阅信息");
|
||||
removeMenu.add(bookRemove);
|
||||
removeMenu.add(studentRemove);
|
||||
removeMenu.add(rentRemove);
|
||||
|
||||
// ”关于“菜单
|
||||
JMenu aboutMenu = new JMenu("关于");
|
||||
JMenuItem about = new JMenuItem("关于软件");
|
||||
aboutDIalog = new aboutDIalog();
|
||||
about.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
aboutDIalog.setVisible(true);
|
||||
}
|
||||
});
|
||||
JMenuItem author = new JMenuItem("作者");
|
||||
authorDIalog = new AuthorDIalog();
|
||||
author.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
authorDIalog.setVisible(true);
|
||||
}
|
||||
});
|
||||
aboutMenu.add(about);
|
||||
aboutMenu.add(author);
|
||||
|
||||
//将菜单加入菜单栏
|
||||
add(fileMenu);
|
||||
add(searchMenu);
|
||||
add(addMenu);
|
||||
add(removeMenu);
|
||||
add(aboutMenu);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,166 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.msksbr.MainFrm.MenuItemDiaog.Adder.StudentAdder">
|
||||
<grid id="cbd77" binding="contentPane" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="10" left="10" bottom="10" right="10"/>
|
||||
<constraints>
|
||||
<xy x="48" y="54" width="436" height="297"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="94766" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="9538f" layout-manager="FlowLayout" hgap="5" vgap="5" flow-align="1">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="e7465" class="javax.swing.JButton" binding="buttonOK">
|
||||
<constraints/>
|
||||
<properties>
|
||||
<text value="添加"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="e3588" layout-manager="GridLayoutManager" row-count="4" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="5c571" layout-manager="BorderLayout" hgap="0" vgap="0">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="8e179" class="javax.swing.JLabel">
|
||||
<constraints border-constraint="West"/>
|
||||
<properties>
|
||||
<text value="姓名:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<grid id="19f7f" layout-manager="FlowLayout" hgap="5" vgap="5" flow-align="0">
|
||||
<constraints border-constraint="Center"/>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="e5161" class="javax.swing.JTextField" binding="textField1" default-binding="true">
|
||||
<constraints/>
|
||||
<properties>
|
||||
<columns value="15"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="4197b" layout-manager="BorderLayout" hgap="0" vgap="0">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="a91a6" class="javax.swing.JLabel">
|
||||
<constraints border-constraint="West"/>
|
||||
<properties>
|
||||
<text value="学号:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<grid id="6cf70" layout-manager="FlowLayout" hgap="5" vgap="5" flow-align="0">
|
||||
<constraints border-constraint="Center"/>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="32fcc" class="javax.swing.JTextField" binding="IDField">
|
||||
<constraints/>
|
||||
<properties>
|
||||
<columns value="15"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="d8df3" layout-manager="BorderLayout" hgap="0" vgap="0">
|
||||
<constraints>
|
||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="adb15" class="javax.swing.JLabel">
|
||||
<constraints border-constraint="West"/>
|
||||
<properties>
|
||||
<text value="班级:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<grid id="cd800" layout-manager="FlowLayout" hgap="5" vgap="5" flow-align="0">
|
||||
<constraints border-constraint="Center"/>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="e20a7" class="javax.swing.JTextField" binding="textField3" default-binding="true">
|
||||
<constraints/>
|
||||
<properties>
|
||||
<columns value="15"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="9af6b" layout-manager="BorderLayout" hgap="0" vgap="0">
|
||||
<constraints>
|
||||
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="bd9ba" class="javax.swing.JLabel">
|
||||
<constraints border-constraint="West"/>
|
||||
<properties>
|
||||
<text value="性别:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<grid id="d4804" layout-manager="FlowLayout" hgap="5" vgap="5" flow-align="0">
|
||||
<constraints border-constraint="Center"/>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="8ce32" class="javax.swing.JRadioButton" binding="maleRadioButton">
|
||||
<constraints/>
|
||||
<properties>
|
||||
<text value="男"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="27c62" class="javax.swing.JRadioButton" binding="femaleRadioButton">
|
||||
<constraints/>
|
||||
<properties>
|
||||
<text value="女"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
@@ -0,0 +1,98 @@
|
||||
package com.msksbr.MainFrm.MenuItemDiaog.Adder;
|
||||
|
||||
import com.msksbr.LoginFrm.ScreenSize;
|
||||
import com.msksbr.SQL.Connector;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class StudentAdder extends JDialog {
|
||||
private JPanel contentPane;
|
||||
private JButton buttonOK;
|
||||
private JTextField textField1;
|
||||
private JTextField IDField;
|
||||
private JTextField textField3;
|
||||
private JRadioButton maleRadioButton;
|
||||
private JRadioButton femaleRadioButton;
|
||||
private Connector connector;
|
||||
private String sName;
|
||||
private int sID;
|
||||
private String sClass;
|
||||
private String sGender;
|
||||
private ButtonGroup genderGroup;
|
||||
private String sql;
|
||||
|
||||
public StudentAdder() {
|
||||
|
||||
try {
|
||||
connector = new Connector();
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
genderGroup = new ButtonGroup();
|
||||
genderGroup.add(maleRadioButton);
|
||||
genderGroup.add(femaleRadioButton);
|
||||
|
||||
buttonOK.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
onOK();
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
sID = getStudentMaxID() + 1;
|
||||
IDField.setText(String.valueOf(sID));
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
IDField.setEditable(false);
|
||||
|
||||
setTitle("添加学生信息");
|
||||
setContentPane(contentPane);
|
||||
setModal(true);
|
||||
getRootPane().setDefaultButton(buttonOK);
|
||||
|
||||
setSize(new Dimension(260, 265));
|
||||
setResizable(false);
|
||||
pack();
|
||||
setLocation();
|
||||
setVisible(true);
|
||||
|
||||
}
|
||||
|
||||
public void setLocation() {
|
||||
setLocation(new ScreenSize().width / 2 - getWidth() / 2, new ScreenSize().height / 2 - getHeight() / 2);
|
||||
}
|
||||
|
||||
private void onOK() {
|
||||
// 在此处添加您的代码
|
||||
sName = textField1.getText();
|
||||
sClass = textField3.getText();
|
||||
sGender = maleRadioButton.isSelected() ? "男" : "女";
|
||||
sql = "INSERT INTO students (student_name,student_id,student_class,student_gender) VALUES ('" + sName + "'," + sID + ",'" + sClass + "','" + sGender + "');";
|
||||
commit2SQL();
|
||||
dispose();
|
||||
}
|
||||
|
||||
private void commit2SQL() {
|
||||
try {
|
||||
connector.executeUpdate(sql);
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
;
|
||||
}
|
||||
|
||||
public int getStudentMaxID() throws SQLException {
|
||||
ResultSet rs = connector.executeQuery("SELECT MAX(student_id) FROM students;");
|
||||
rs.next();
|
||||
return rs.getInt("MAX(student_id)");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.msksbr.MainFrm.MenuItemDiaog.AuthorDIalog">
|
||||
<grid id="cbd77" binding="contentPane" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="10" left="10" bottom="10" right="10"/>
|
||||
<constraints>
|
||||
<xy x="48" y="54" width="436" height="297"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="94766" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="9538f" layout-manager="FlowLayout" hgap="5" vgap="5" flow-align="1">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="e7465" class="javax.swing.JButton" binding="buttonOK">
|
||||
<constraints/>
|
||||
<properties>
|
||||
<text value="确认"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="e3588" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="fe414" layout-manager="BorderLayout" hgap="0" vgap="0">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="56d70" layout-manager="FlowLayout" hgap="5" vgap="5" flow-align="1">
|
||||
<constraints border-constraint="South"/>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="1c1ff" class="javax.swing.JLabel">
|
||||
<constraints/>
|
||||
<properties>
|
||||
<font name="PingFang SC" size="14"/>
|
||||
<text value="https://gitee.com/msksbr"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="da859" layout-manager="BorderLayout" hgap="0" vgap="0">
|
||||
<constraints border-constraint="Center"/>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="1727d" layout-manager="FlowLayout" hgap="5" vgap="5" flow-align="1">
|
||||
<constraints border-constraint="South"/>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="a162d" class="javax.swing.JLabel">
|
||||
<constraints/>
|
||||
<properties>
|
||||
<font name="PingFang SC" size="16" style="1"/>
|
||||
<text value="御坂昴"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="e09f1" binding="iconPanel" layout-manager="GridBagLayout">
|
||||
<constraints border-constraint="Center"/>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children/>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.msksbr.MainFrm.MenuItemDiaog;
|
||||
|
||||
import com.msksbr.LoginFrm.ScreenSize;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
public class AuthorDIalog extends JDialog {
|
||||
private JPanel contentPane;
|
||||
private JButton buttonOK;
|
||||
private JPanel iconPanel;
|
||||
|
||||
public AuthorDIalog() {
|
||||
setContentPane(contentPane);
|
||||
setModal(false);
|
||||
getRootPane().setDefaultButton(buttonOK);
|
||||
setVisible(false);
|
||||
JLabel authorLabel = new JLabel();
|
||||
authorLabel.setIcon(new ImageIcon("src/com/msksbr/images/AuthorProfile.jpg"));
|
||||
iconPanel.add(authorLabel);
|
||||
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
||||
setTitle("作者");
|
||||
buttonOK.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
dispose();
|
||||
}
|
||||
});
|
||||
setResizable(false);
|
||||
setAlwaysOnTop(true);
|
||||
pack();
|
||||
setLocation();
|
||||
}
|
||||
|
||||
public void setLocation() {
|
||||
setLocation(new ScreenSize().width / 2 - getWidth() / 2, new ScreenSize().height / 2 - getHeight() / 2);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.msksbr.MainFrm.MenuItemDiaog.SearchDIalog">
|
||||
<grid id="cbd77" binding="contentPane" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="10" left="10" bottom="10" right="10"/>
|
||||
<constraints>
|
||||
<xy x="48" y="54" width="436" height="297"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="94766" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="9538f" layout-manager="FlowLayout" hgap="5" vgap="5" flow-align="1">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="e7465" class="javax.swing.JButton" binding="buttonOK">
|
||||
<constraints/>
|
||||
<properties>
|
||||
<text value="OK"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="e3588" layout-manager="BorderLayout" hgap="0" vgap="0">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="8f9fb" layout-manager="GridBagLayout">
|
||||
<constraints border-constraint="West"/>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="a8662" class="javax.swing.JLabel" binding="messageLabel">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
<gridbag weightx="0.0" weighty="0.0"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="请输入学号:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<hspacer id="c8446">
|
||||
<constraints>
|
||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
<gridbag weightx="0.0" weighty="0.0"/>
|
||||
</constraints>
|
||||
</hspacer>
|
||||
<vspacer id="36605">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
<gridbag weightx="0.0" weighty="0.0"/>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="87c34" layout-manager="GridBagLayout">
|
||||
<constraints border-constraint="Center"/>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="90640" class="javax.swing.JTextField" binding="idFIeld">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="150" height="-1"/>
|
||||
</grid>
|
||||
<gridbag weightx="0.0" weighty="0.0"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<columns value="10"/>
|
||||
</properties>
|
||||
</component>
|
||||
<hspacer id="a6bdf">
|
||||
<constraints>
|
||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
<gridbag weightx="0.0" weighty="0.0"/>
|
||||
</constraints>
|
||||
</hspacer>
|
||||
<vspacer id="ceec6">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
<gridbag weightx="0.0" weighty="0.0"/>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
@@ -0,0 +1,116 @@
|
||||
package com.msksbr.MainFrm.MenuItemDiaog;
|
||||
|
||||
import com.msksbr.LoginFrm.ScreenSize;
|
||||
import com.msksbr.SQL.Connector;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class SearchDIalog extends JDialog {
|
||||
public JLabel messageLabel;
|
||||
protected int idInt;
|
||||
private JPanel contentPane;
|
||||
private JButton buttonOK;
|
||||
private JTextField idFIeld;
|
||||
private String table;
|
||||
|
||||
public SearchDIalog(String table) {
|
||||
setContentPane(contentPane);
|
||||
setModal(true);
|
||||
getRootPane().setDefaultButton(buttonOK);
|
||||
if (table.equals("books")) {
|
||||
this.table = "books";
|
||||
this.setTitle("查询图书信息");
|
||||
messageLabel.setText("请输入书号:");
|
||||
} else if (table.equals("students")) {
|
||||
this.table = "students";
|
||||
this.setTitle("查询学生信息");
|
||||
messageLabel.setText("请输入学号:");
|
||||
} else if (table.equals("rents")) {
|
||||
this.table = "rents";
|
||||
this.setTitle("查询借阅信息");
|
||||
messageLabel.setText("请输入书号:");
|
||||
}
|
||||
setListener();
|
||||
pack();
|
||||
setLocation();
|
||||
setVisible(true);
|
||||
}
|
||||
|
||||
private void setListener() {
|
||||
buttonOK.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
onOK();
|
||||
}
|
||||
});
|
||||
idFIeld.addKeyListener(new KeyAdapter() {
|
||||
public void keyPressed(KeyEvent e) {
|
||||
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
|
||||
onOK();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setLocation() {
|
||||
setLocation(new ScreenSize().width / 2 - getWidth() / 2, new ScreenSize().height / 2 - getHeight() / 2);
|
||||
}
|
||||
|
||||
private void onOK() {
|
||||
ResultSet rs = SQLExe();
|
||||
String message = "";
|
||||
try {
|
||||
if (rs != null && rs.next()) {
|
||||
String title = "";
|
||||
if (table.equals("books")) {
|
||||
message = "书名:\t" + rs.getString("book_name") + "\n类别:\t" + rs.getString("book_type") + "\n书号:\t" + rs.getInt("book_id") + "\nISBN:\t" + rs.getString("ISBN");
|
||||
title = "图书信息";
|
||||
} else if (table.equals("students")) {
|
||||
message = "学生姓名:\t" + rs.getString("student_name") + "\n学号:\t" + rs.getInt("student_id") + "\n班级:\t" + rs.getString("student_class") + "\n性别:\t" + rs.getString("student_gender");
|
||||
title = "学生信息";
|
||||
} else if (table.equals("rents")) {
|
||||
message = "学生姓名:\t" + rs.getString("student_name") + "\n学号:\t" + rs.getInt("student_id") + "\n班级:\t" + rs.getString("student_class") + "\n性别:\t" + rs.getString("student_gender") + "\n书名:\t" + rs.getString("book_name") + "\n书号:\t" + rs.getInt("book_id") + "\n类别:\t" + rs.getString("book_type") + "\nISBN:\t" + rs.getString("ISBN");
|
||||
title = "借阅信息";
|
||||
}
|
||||
new showMessae(message, title);
|
||||
} else {
|
||||
JOptionPane.showMessageDialog(this, "未找到", "未找到", JOptionPane.WARNING_MESSAGE);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private ResultSet SQLExe() {
|
||||
ResultSet rs = null;
|
||||
try {
|
||||
idInt = Integer.valueOf(idFIeld.getText());
|
||||
Connector connector = new Connector();
|
||||
rs = connector.executeQuery(SQLExeMaker(table));
|
||||
} catch (NumberFormatException e) {
|
||||
JOptionPane.showMessageDialog(this, "请输入一个整数", "错误", JOptionPane.ERROR_MESSAGE);
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return rs;
|
||||
}
|
||||
|
||||
private String SQLExeMaker(String table) {
|
||||
if (table.equals("books")) {
|
||||
return "SELECT * FROM `books` WHERE `book_id` = " + idInt + ";";
|
||||
} else if (table.equals("students")) {
|
||||
return "SELECT * FROM `students` WHERE `student_id` = " + idInt + ";";
|
||||
} else if (table.equals("rents")) {
|
||||
return "SELECT * FROM `rents` WHERE `book_id` = " + idInt + ";";
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.msksbr.MainFrm.MenuItemDiaog.aboutDIalog">
|
||||
<grid id="cbd77" binding="contentPane" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="10" left="10" bottom="10" right="10"/>
|
||||
<constraints>
|
||||
<xy x="48" y="54" width="436" height="297"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="94766" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="9538f" layout-manager="FlowLayout" hgap="5" vgap="5" flow-align="1">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="e7465" class="javax.swing.JButton" binding="buttonOK">
|
||||
<constraints/>
|
||||
<properties>
|
||||
<text value="确认"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="e3588" layout-manager="BorderLayout" hgap="0" vgap="0">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="f8413" layout-manager="FlowLayout" hgap="5" vgap="5" flow-align="1">
|
||||
<constraints border-constraint="South"/>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="48047" class="javax.swing.JLabel">
|
||||
<constraints/>
|
||||
<properties>
|
||||
<font name="PingFang SC" size="14"/>
|
||||
<text value="https://gitee.com/msksbr/system-homework-in-the-library"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="bae5e" layout-manager="BorderLayout" hgap="0" vgap="0">
|
||||
<constraints border-constraint="Center"/>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="b98e5" layout-manager="FlowLayout" hgap="5" vgap="5" flow-align="1">
|
||||
<constraints border-constraint="South"/>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="58e29" class="javax.swing.JLabel">
|
||||
<constraints/>
|
||||
<properties>
|
||||
<font name="PingFang SC" size="16" style="1"/>
|
||||
<text value="图书管理系统 Demo"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="d8804" binding="iconPanel" layout-manager="GridBagLayout">
|
||||
<constraints border-constraint="Center"/>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children/>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.msksbr.MainFrm.MenuItemDiaog;
|
||||
|
||||
import com.msksbr.LoginFrm.ScreenSize;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
public class aboutDIalog extends JDialog {
|
||||
private JPanel contentPane;
|
||||
private JButton buttonOK;
|
||||
private JPanel iconPanel;
|
||||
|
||||
public aboutDIalog() {
|
||||
setTitle("关于图书管理系统");
|
||||
setVisible(false);
|
||||
setContentPane(contentPane);
|
||||
setModal(true);
|
||||
getRootPane().setDefaultButton(buttonOK);
|
||||
setResizable(false);
|
||||
JLabel iconLabel = new JLabel();
|
||||
iconLabel.setIcon(new ImageIcon("src/com/msksbr/images/logo_128.png"));
|
||||
iconPanel.add(iconLabel);
|
||||
setModal(false);
|
||||
setAlwaysOnTop(true);
|
||||
|
||||
buttonOK.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
onOK();
|
||||
}
|
||||
});
|
||||
pack();
|
||||
setLocation();
|
||||
}
|
||||
|
||||
private void onOK() {
|
||||
// 在此处添加您的代码
|
||||
dispose();
|
||||
}
|
||||
|
||||
public void setLocation() {
|
||||
setLocation(new ScreenSize().width / 2 - getWidth() / 2, new ScreenSize().height / 2 - getHeight() / 2);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.msksbr.MainFrm.MenuItemDiaog.showMessae">
|
||||
<grid id="cbd77" binding="contentPane" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="10" left="10" bottom="10" right="10"/>
|
||||
<constraints>
|
||||
<xy x="48" y="54" width="436" height="297"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="94766" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="9538f" layout-manager="FlowLayout" hgap="5" vgap="5" flow-align="1">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="e7465" class="javax.swing.JButton" binding="buttonOK">
|
||||
<constraints/>
|
||||
<properties>
|
||||
<text value="OK"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="e3588" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="165c3" layout-manager="GridBagLayout">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="b32d2" class="javax.swing.JTextPane" binding="textPane1" default-binding="true">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="6" anchor="0" fill="3" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="150" height="50"/>
|
||||
</grid>
|
||||
<gridbag weightx="0.0" weighty="0.0"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="text"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.msksbr.MainFrm.MenuItemDiaog;
|
||||
|
||||
import com.msksbr.LoginFrm.ScreenSize;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
public class showMessae extends JDialog {
|
||||
private JPanel contentPane;
|
||||
private JButton buttonOK;
|
||||
private JTextPane textPane1;
|
||||
|
||||
public showMessae(String message, String title) {
|
||||
setContentPane(contentPane);
|
||||
setModal(true);
|
||||
getRootPane().setDefaultButton(buttonOK);
|
||||
|
||||
buttonOK.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
onOK();
|
||||
}
|
||||
});
|
||||
this.textPane1.setText(message);
|
||||
this.setTitle(title);
|
||||
textPane1.setEditable(false);
|
||||
pack();
|
||||
setResizable(false);
|
||||
setCenterLocation();
|
||||
setVisible(true);
|
||||
}
|
||||
|
||||
public void setCenterLocation() {
|
||||
setLocation(new ScreenSize().width / 2 - getWidth() / 2, new ScreenSize().height / 2 - getHeight() / 2);
|
||||
}
|
||||
|
||||
private void onOK() {
|
||||
// 在此处添加您的代码
|
||||
dispose();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.msksbr.SQL;
|
||||
|
||||
import java.sql.*;
|
||||
|
||||
public class Connector {
|
||||
private Connection conn;
|
||||
private Statement stmt;
|
||||
private String url = "jdbc:mysql://localhost:3306/book";
|
||||
private String user = "root";
|
||||
|
||||
public Connector() throws ClassNotFoundException, SQLException {
|
||||
Class.forName("com.mysql.cj.jdbc.Driver");
|
||||
conn = DriverManager.getConnection(url, user, new PassWord().passWord);
|
||||
stmt = conn.createStatement();
|
||||
}
|
||||
|
||||
public ResultSet executeQuery(String query) throws SQLException {
|
||||
return stmt.executeQuery(query);
|
||||
}
|
||||
|
||||
public int executeUpdate(String query) throws SQLException {
|
||||
return stmt.executeUpdate(query);
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 21 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.5 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 28 KiB |
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="AdditionalModuleElements">
|
||||
<content url="file://$MODULE_DIR$" dumb="true">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
</component>
|
||||
</module>
|
||||
Reference in New Issue
Block a user