Repository: chaserw/Student-Information-Management-System
Branch: master
Commit: 9ca3c04f51a4
Files: 26
Total size: 122.1 KB
Directory structure:
gitextract_a251zuhc/
├── .gitignore
├── LICENSE
├── README.md
├── src/
│ └── SMIS/
│ ├── Admin.java
│ ├── Calculate.java
│ ├── Cou.java
│ ├── Delete.java
│ ├── InsertCou.java
│ ├── InsertGra.java
│ ├── InsertStu.java
│ ├── InsertTea.java
│ ├── JudgeNum.java
│ ├── Login.java
│ ├── MysqlConn.java
│ ├── QueryCou.java
│ ├── QueryGra.java
│ ├── QueryStu.java
│ ├── QueryTea.java
│ ├── Stu.java
│ ├── Student.java
│ ├── Tea.java
│ ├── Teacher.java
│ ├── Transform.java
│ ├── UpdateStu.java
│ └── UpdateTea.java
└── 学生信息管理系统.txt
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
# Compiled class file
*.class
# Log file
*.log
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.ear
*.zip
*.tar.gz
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
================================================
FILE: LICENSE
================================================
Eclipse Public License - v 2.0
THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION
OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
1. DEFINITIONS
"Contribution" means:
a) in the case of the initial Contributor, the initial content
Distributed under this Agreement, and
b) in the case of each subsequent Contributor:
i) changes to the Program, and
ii) additions to the Program;
where such changes and/or additions to the Program originate from
and are Distributed by that particular Contributor. A Contribution
"originates" from a Contributor if it was added to the Program by
such Contributor itself or anyone acting on such Contributor's behalf.
Contributions do not include changes or additions to the Program that
are not Modified Works.
"Contributor" means any person or entity that Distributes the Program.
"Licensed Patents" mean patent claims licensable by a Contributor which
are necessarily infringed by the use or sale of its Contribution alone
or when combined with the Program.
"Program" means the Contributions Distributed in accordance with this
Agreement.
"Recipient" means anyone who receives the Program under this Agreement
or any Secondary License (as applicable), including Contributors.
"Derivative Works" shall mean any work, whether in Source Code or other
form, that is based on (or derived from) the Program and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship.
"Modified Works" shall mean any work in Source Code or other form that
results from an addition to, deletion from, or modification of the
contents of the Program, including, for purposes of clarity any new file
in Source Code form that contains any contents of the Program. Modified
Works shall not include works that contain only declarations,
interfaces, types, classes, structures, or files of the Program solely
in each case in order to link to, bind by name, or subclass the Program
or Modified Works thereof.
"Distribute" means the acts of a) distributing or b) making available
in any manner that enables the transfer of a copy.
"Source Code" means the form of a Program preferred for making
modifications, including but not limited to software source code,
documentation source, and configuration files.
"Secondary License" means either the GNU General Public License,
Version 2.0, or any later versions of that license, including any
exceptions or additional permissions as identified by the initial
Contributor.
2. GRANT OF RIGHTS
a) Subject to the terms of this Agreement, each Contributor hereby
grants Recipient a non-exclusive, worldwide, royalty-free copyright
license to reproduce, prepare Derivative Works of, publicly display,
publicly perform, Distribute and sublicense the Contribution of such
Contributor, if any, and such Derivative Works.
b) Subject to the terms of this Agreement, each Contributor hereby
grants Recipient a non-exclusive, worldwide, royalty-free patent
license under Licensed Patents to make, use, sell, offer to sell,
import and otherwise transfer the Contribution of such Contributor,
if any, in Source Code or other form. This patent license shall
apply to the combination of the Contribution and the Program if, at
the time the Contribution is added by the Contributor, such addition
of the Contribution causes such combination to be covered by the
Licensed Patents. The patent license shall not apply to any other
combinations which include the Contribution. No hardware per se is
licensed hereunder.
c) Recipient understands that although each Contributor grants the
licenses to its Contributions set forth herein, no assurances are
provided by any Contributor that the Program does not infringe the
patent or other intellectual property rights of any other entity.
Each Contributor disclaims any liability to Recipient for claims
brought by any other entity based on infringement of intellectual
property rights or otherwise. As a condition to exercising the
rights and licenses granted hereunder, each Recipient hereby
assumes sole responsibility to secure any other intellectual
property rights needed, if any. For example, if a third party
patent license is required to allow Recipient to Distribute the
Program, it is Recipient's responsibility to acquire that license
before distributing the Program.
d) Each Contributor represents that to its knowledge it has
sufficient copyright rights in its Contribution, if any, to grant
the copyright license set forth in this Agreement.
e) Notwithstanding the terms of any Secondary License, no
Contributor makes additional grants to any Recipient (other than
those set forth in this Agreement) as a result of such Recipient's
receipt of the Program under the terms of a Secondary License
(if permitted under the terms of Section 3).
3. REQUIREMENTS
3.1 If a Contributor Distributes the Program in any form, then:
a) the Program must also be made available as Source Code, in
accordance with section 3.2, and the Contributor must accompany
the Program with a statement that the Source Code for the Program
is available under this Agreement, and informs Recipients how to
obtain it in a reasonable manner on or through a medium customarily
used for software exchange; and
b) the Contributor may Distribute the Program under a license
different than this Agreement, provided that such license:
i) effectively disclaims on behalf of all other Contributors all
warranties and conditions, express and implied, including
warranties or conditions of title and non-infringement, and
implied warranties or conditions of merchantability and fitness
for a particular purpose;
ii) effectively excludes on behalf of all other Contributors all
liability for damages, including direct, indirect, special,
incidental and consequential damages, such as lost profits;
iii) does not attempt to limit or alter the recipients' rights
in the Source Code under section 3.2; and
iv) requires any subsequent distribution of the Program by any
party to be under a license that satisfies the requirements
of this section 3.
3.2 When the Program is Distributed as Source Code:
a) it must be made available under this Agreement, or if the
Program (i) is combined with other material in a separate file or
files made available under a Secondary License, and (ii) the initial
Contributor attached to the Source Code the notice described in
Exhibit A of this Agreement, then the Program may be made available
under the terms of such Secondary Licenses, and
b) a copy of this Agreement must be included with each copy of
the Program.
3.3 Contributors may not remove or alter any copyright, patent,
trademark, attribution notices, disclaimers of warranty, or limitations
of liability ("notices") contained within the Program from any copy of
the Program which they Distribute, provided that Contributors may add
their own appropriate notices.
4. COMMERCIAL DISTRIBUTION
Commercial distributors of software may accept certain responsibilities
with respect to end users, business partners and the like. While this
license is intended to facilitate the commercial use of the Program,
the Contributor who includes the Program in a commercial product
offering should do so in a manner which does not create potential
liability for other Contributors. Therefore, if a Contributor includes
the Program in a commercial product offering, such Contributor
("Commercial Contributor") hereby agrees to defend and indemnify every
other Contributor ("Indemnified Contributor") against any losses,
damages and costs (collectively "Losses") arising from claims, lawsuits
and other legal actions brought by a third party against the Indemnified
Contributor to the extent caused by the acts or omissions of such
Commercial Contributor in connection with its distribution of the Program
in a commercial product offering. The obligations in this section do not
apply to any claims or Losses relating to any actual or alleged
intellectual property infringement. In order to qualify, an Indemnified
Contributor must: a) promptly notify the Commercial Contributor in
writing of such claim, and b) allow the Commercial Contributor to control,
and cooperate with the Commercial Contributor in, the defense and any
related settlement negotiations. The Indemnified Contributor may
participate in any such claim at its own expense.
For example, a Contributor might include the Program in a commercial
product offering, Product X. That Contributor is then a Commercial
Contributor. If that Commercial Contributor then makes performance
claims, or offers warranties related to Product X, those performance
claims and warranties are such Commercial Contributor's responsibility
alone. Under this section, the Commercial Contributor would have to
defend claims against the other Contributors related to those performance
claims and warranties, and if a court requires any other Contributor to
pay any damages as a result, the Commercial Contributor must pay
those damages.
5. NO WARRANTY
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT
PERMITTED BY APPLICABLE LAW, THE PROGRAM IS PROVIDED ON AN "AS IS"
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR
IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF
TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR
PURPOSE. Each Recipient is solely responsible for determining the
appropriateness of using and distributing the Program and assumes all
risks associated with its exercise of rights under this Agreement,
including but not limited to the risks and costs of program errors,
compliance with applicable laws, damage to or loss of data, programs
or equipment, and unavailability or interruption of operations.
6. DISCLAIMER OF LIABILITY
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT
PERMITTED BY APPLICABLE LAW, NEITHER RECIPIENT NOR ANY CONTRIBUTORS
SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST
PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE
EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
7. GENERAL
If any provision of this Agreement is invalid or unenforceable under
applicable law, it shall not affect the validity or enforceability of
the remainder of the terms of this Agreement, and without further
action by the parties hereto, such provision shall be reformed to the
minimum extent necessary to make such provision valid and enforceable.
If Recipient institutes patent litigation against any entity
(including a cross-claim or counterclaim in a lawsuit) alleging that the
Program itself (excluding combinations of the Program with other software
or hardware) infringes such Recipient's patent(s), then such Recipient's
rights granted under Section 2(b) shall terminate as of the date such
litigation is filed.
All Recipient's rights under this Agreement shall terminate if it
fails to comply with any of the material terms or conditions of this
Agreement and does not cure such failure in a reasonable period of
time after becoming aware of such noncompliance. If all Recipient's
rights under this Agreement terminate, Recipient agrees to cease use
and distribution of the Program as soon as reasonably practicable.
However, Recipient's obligations under this Agreement and any licenses
granted by Recipient relating to the Program shall continue and survive.
Everyone is permitted to copy and distribute copies of this Agreement,
but in order to avoid inconsistency the Agreement is copyrighted and
may only be modified in the following manner. The Agreement Steward
reserves the right to publish new versions (including revisions) of
this Agreement from time to time. No one other than the Agreement
Steward has the right to modify this Agreement. The Eclipse Foundation
is the initial Agreement Steward. The Eclipse Foundation may assign the
responsibility to serve as the Agreement Steward to a suitable separate
entity. Each new version of the Agreement will be given a distinguishing
version number. The Program (including Contributions) may always be
Distributed subject to the version of the Agreement under which it was
received. In addition, after a new version of the Agreement is published,
Contributor may elect to Distribute the Program (including its
Contributions) under the new version.
Except as expressly stated in Sections 2(a) and 2(b) above, Recipient
receives no rights or licenses to the intellectual property of any
Contributor under this Agreement, whether expressly, by implication,
estoppel or otherwise. All rights in the Program not expressly granted
under this Agreement are reserved. Nothing in this Agreement is intended
to be enforceable by any entity that is not a Contributor or Recipient.
No third-party beneficiary rights are created under this Agreement.
Exhibit A - Form of Secondary Licenses Notice
"This Source Code may also be made available under the following
Secondary Licenses when the conditions for such availability set forth
in the Eclipse Public License, v. 2.0 are satisfied: {name license(s),
version(s), and exceptions or additional permissions here}."
Simply including a copy of this Agreement, including this Exhibit A
is not sufficient to license the Source Code under Secondary Licenses.
If it is not possible or desirable to put the notice in a particular
file, then You may include the notice in a location (such as a LICENSE
file in a relevant directory) where a recipient would be likely to
look for such a notice.
You may add additional accurate notices of copyright ownership.
================================================
FILE: README.md
================================================
# Student-Information-Management-System
学生信息管理系统 JAVA Mysql 数据库课程设计 简单界面
用户登录图简单画了下代码逻辑:提供学生/教师/管理员登录
txt文件中是数据库建表代码
数据库最基本的查询插入修改删除操作都有
个人大二数据库课程设计,对很多东西不是很懂,设计也有一些缺陷
可能出现的问题:
查询学生信息时,显示四个学生以上可能会出现数组越界,因为在eclipse中直接画的界面,显示学生信息表格只有四行,导致了数组越界。解决办法:修改代码或者删除多出的学生。毕竟这个课设关心能否完成插入删除操作,而不是大量用户访问的情况
可能有更多问题就自己去发现吧
================================================
FILE: src/SMIS/Admin.java
================================================
package ѧϢϵͳ;
import java.awt.event.*;
import javax.swing.*;
import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import javax.swing.GroupLayout.Alignment;
import java.awt.Font;
//ѯ½ʦѧϢ
public class Admin extends JFrame {
JButton jb1,jb2 = null;
JRadioButton jrb1,jrb2 = null;
JLabel jl = null;
JPanel jp = null;
ButtonGroup bg = null;
public Admin() {
getContentPane().setLayout(null);
jp = new JPanel();
jp.setBounds(125, 184, 386, 190);
getContentPane().add(jp);
jp.setLayout(null);
jl = new JLabel("\u64CD\u4F5C\u5BF9\u8C61");
jl.setBounds(29, 48, 60, 37);
jp.add(jl);
jrb1 = new JRadioButton("\u5B66\u751F");//ѧ
jrb1.setBounds(118, 48, 59, 37);
jp.add(jrb1);
jrb2 = new JRadioButton("\u6559\u5E08");//ʦ
jrb2.setBounds(206, 48, 59, 37);
jp.add(jrb2);
bg = new ButtonGroup();
bg.add(jrb1);
bg.add(jrb2);
jb1 = new JButton("\u786E\u5B9A");
jb1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
if(jrb1.isSelected()){
Stu st = new Stu();
}
else if(jrb2.isSelected()){
Tea ta = new Tea();
}else{
Cou co = new Cou();
}
}
});
jb1.setBounds(41, 109, 72, 42);
jp.add(jb1);
JButton jb2 = new JButton("\u9000\u51FA");
jb2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
jb2.setBounds(267, 109, 76, 42);
jp.add(jb2);
JRadioButton radioButton = new JRadioButton("\u8BFE\u7A0B");
radioButton.setBounds(294, 48, 59, 37);
jp.add(radioButton);
bg.add(radioButton);
JButton button = new JButton("\u8FD4\u56DE");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
Login l = new Login();
}
});
button.setBounds(154, 109, 72, 42);
jp.add(button);
JLabel label = new JLabel("\u6B22\u8FCE\u767B\u5F55\u5B66\u751F\u4FE1\u606F\u7BA1\u7406\u7CFB\u7EDF\uFF01");
label.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 46));
label.setBounds(14, 55, 604, 60);
getContentPane().add(label);
//ñ
this.setTitle("ѧϢϵͳ-Ա");
//ôС
this.setSize(650,520);
//ôʼλ
this.setLocation(200, 150);
//õرմʱ֤JVMҲ˳
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//ʾ
this.setVisible(true);
//Сɱ
this.setResizable(true);
}
}
================================================
FILE: src/SMIS/Calculate.java
================================================
package ѧϢϵͳ;
import java.math.BigDecimal;
public class Calculate {
public static double calculatepoi(int i){
if(i >= 90){
return 4.0;
}else if(i >= 85){
return 3.7;
}else if(i >= 82){
return 3.3;
}else if(i >= 78){
return 3.0;
}else if(i >= 75){
return 2.7;
}else if(i >= 72){
return 2.3;
}else if(i >= 68){
return 2.0;
}else if(i >= 64){
return 1.5;
}else if(i >= 60){
return 1.0;
}else{
return 0;
}
}
public static double calculatecre(double c[]){
double sum = 0;
for(int i = 0; i < MysqlConn.counter; i++){
sum += c[i];
}
return sum;
}
public static double calculateGPA(double c[],double p[]){
double GPA = 0, t = 0, sum = 0;
for(int i = 0; i < MysqlConn.counter; i++){
t += c[i] * p[i];
sum += c[i];
}
GPA = t / sum;
BigDecimal bg = new BigDecimal(GPA);
GPA = bg.setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue();
return GPA;
}
}
================================================
FILE: src/SMIS/Cou.java
================================================
package ѧϢϵͳ;
import javax.swing.JFrame;
import javax.swing.JLabel;
import java.awt.Font;
import javax.swing.JPanel;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class Cou extends JFrame {
public Cou() {
getContentPane().setLayout(null);
JPanel panel = new JPanel();
panel.setBounds(152, 59, 329, 302);
getContentPane().add(panel);
panel.setLayout(null);
JLabel label = new JLabel("\u8BF7\u9009\u62E9\u60A8\u8981\u8FDB\u884C\u7684\u64CD\u4F5C");
label.setBounds(69, 5, 191, 41);
panel.add(label);
label.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
JButton button = new JButton("\u67E5\u8BE2\u8BFE\u7A0B\u4FE1\u606F");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
QueryCou qc = new QueryCou();
}
});
button.setBounds(94, 59, 140, 47);
panel.add(button);
JButton button_1 = new JButton("\u6DFB\u52A0\u8BFE\u7A0B\u4FE1\u606F");
button_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
InsertCou ic = new InsertCou();
}
});
button_1.setBounds(94, 119, 140, 47);
panel.add(button_1);
JButton button_2 = new JButton("\u4FEE\u6539\u8BFE\u7A0B\u4FE1\u606F");
button_2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
String s = null;
InsertCou uc = new InsertCou(s);
}
});
button_2.setBounds(94, 182, 140, 47);
panel.add(button_2);
JButton button_3 = new JButton("\u5220\u9664\u8BFE\u7A0B\u4FE1\u606F");
button_3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
Delete dc = new Delete();
}
});
button_3.setBounds(94, 242, 140, 47);
panel.add(button_3);
JButton button_4 = new JButton("\u8FD4\u56DE");
button_4.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
Admin ad = new Admin();
}
});
button_4.setBounds(202, 389, 94, 41);
getContentPane().add(button_4);
JButton button_5 = new JButton("\u9000\u51FA");
button_5.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
button_5.setBounds(345, 389, 94, 41);
getContentPane().add(button_5);
//ñ
this.setTitle("ѧϢϵͳ-Ա");
//ôС
this.setSize(650,520);
//ôʼλ
this.setLocation(200, 150);
//õرմʱ֤JVMҲ˳
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//ʾ
this.setVisible(true);
//Сɱ
this.setResizable(true);
}
}
================================================
FILE: src/SMIS/Delete.java
================================================
package ѧϢϵͳ;
import javax.swing.*;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import javax.swing.GroupLayout.Alignment;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class Delete extends JFrame {
private JTextField textField;
public Delete() {
getContentPane().setLayout(null);
JPanel panel = new JPanel();
panel.setBounds(152, 103, 321, 162);
getContentPane().add(panel);
panel.setLayout(null);
JLabel label = new JLabel("\u8BF7\u8F93\u5165\u8981\u5220\u9664\u7684\u5B66\u53F7/\u6559\u5E08\u53F7/\u8BFE\u7A0B\u53F7\uFF1A");
label.setBounds(0, 5, 321, 37);
panel.add(label);
label.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
textField = new JTextField();
textField.setBounds(72, 66, 159, 32);
panel.add(textField);
textField.setColumns(10);
JRadioButton rdbtnNewRadioButton = new JRadioButton("\u5B66\u751F");
rdbtnNewRadioButton.setBounds(31, 107, 59, 37);
panel.add(rdbtnNewRadioButton);
JRadioButton radioButton = new JRadioButton("\u6559\u5E08");
radioButton.setBounds(121, 107, 59, 37);
panel.add(radioButton);
ButtonGroup bg = new ButtonGroup();
bg.add(rdbtnNewRadioButton);
bg.add(radioButton);
JRadioButton radioButton_1 = new JRadioButton("\u8BFE\u7A0B");
radioButton_1.setBounds(211, 107, 59, 37);
panel.add(radioButton_1);
bg.add(radioButton_1);
JPanel panel_1 = new JPanel();
panel_1.setBounds(141, 302, 343, 52);
getContentPane().add(panel_1);
JButton button = new JButton("\u786E\u5B9A");
button.setBounds(8, 5, 76, 40);
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
MysqlConn.ConnectSQL();
if(textField.getText().isEmpty()){
JOptionPane.showMessageDialog(null,"ѧŻʦŻγ̺!","ʾϢ",JOptionPane.WARNING_MESSAGE);
}else if(!JudgeNum.judge(textField.getText(), textField.getText().length())){
JOptionPane.showMessageDialog(null, "ѧŻʦŻγ̺ŽɣѧŻʦŻγ̺ʽ!\n", "ʾϢ", JOptionPane.ERROR_MESSAGE);
}else if(!rdbtnNewRadioButton.isSelected() && !radioButton.isSelected() && !radioButton_1.isSelected()){
JOptionPane.showMessageDialog(null,"ѡѧʦγ!","ʾϢ",JOptionPane.WARNING_MESSAGE);
}else if(rdbtnNewRadioButton.isSelected()){
if(!MysqlConn.querystu(textField.getText())){
JOptionPane.showMessageDialog(null,"ѧ!\n","ʾϢ",JOptionPane.ERROR_MESSAGE);
}else{
int option = JOptionPane.showConfirmDialog(null, "ȷɾѧ", "ʾϢ", JOptionPane.OK_CANCEL_OPTION);
if(option == JOptionPane.OK_OPTION){
MysqlConn.stuid = textField.getText();
//ִɾ
MysqlConn.deletestu(MysqlConn.stuid);
}else {
textField.setText("");
}
}
}else if(radioButton.isSelected()){
if(!MysqlConn.querytea(textField.getText())){
JOptionPane.showMessageDialog(null,"Ľʦ!\n","ʾϢ",JOptionPane.ERROR_MESSAGE);
}else{
int option = JOptionPane.showConfirmDialog(null, "ȷɾýʦ", "ʾϢ", JOptionPane.OK_CANCEL_OPTION);
if(option == JOptionPane.OK_OPTION){
MysqlConn.teaid = textField.getText();
//ִɾ
MysqlConn.deletetea(MysqlConn.teaid);
}else {
textField.setText("");
}
}
}else{
if(!MysqlConn.querycou(textField.getText())){
JOptionPane.showMessageDialog(null,"Ľʦ!\n","ʾϢ",JOptionPane.ERROR_MESSAGE);
}else{
int option = JOptionPane.showConfirmDialog(null, "ȷɾÿγ", "ʾϢ", JOptionPane.OK_CANCEL_OPTION);
if(option == JOptionPane.OK_OPTION){
MysqlConn.cno = textField.getText();
//ִɾ
MysqlConn.deletecou(MysqlConn.cno);
}else {
textField.setText("");
}
}
}
}
});
panel_1.setLayout(null);
panel_1.add(button);
JButton button_1 = new JButton("\u8FD4\u56DE");
button_1.setBounds(176, 5, 76, 40);
button_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
Admin ad = new Admin();
}
});
JButton button_2 = new JButton("\u91CD\u7F6E");
button_2.setBounds(92, 5, 76, 40);
button_2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
textField.setText("");
}
});
panel_1.add(button_2);
panel_1.add(button_1);
JButton button_3 = new JButton("\u9000\u51FA");
button_3.setBounds(260, 5, 76, 40);
button_3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
panel_1.add(button_3);
this.setTitle("ѧϢϵͳ-Ա-ɾѧ/ʦ/γ");
//ôС
this.setSize(650,520);
//ôʼλ
this.setLocation(200, 150);
//õرմʱ֤JVMҲ˳
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//ʾ
this.setVisible(true);
//Сɱ
this.setResizable(true);
}
}
================================================
FILE: src/SMIS/InsertCou.java
================================================
package ѧϢϵͳ;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import java.awt.Font;
import javax.swing.JTextField;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class InsertCou extends JFrame {
private JTextField textField;
private JTextField textField_1;
private JTextField textField_2;
public InsertCou() {
getContentPane().setLayout(null);
JPanel panel = new JPanel();
panel.setBounds(134, 49, 379, 265);
getContentPane().add(panel);
panel.setLayout(null);
JLabel label = new JLabel("дҪӵĿγϢ");
label.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
label.setBounds(79, 14, 238, 36);
panel.add(label);
JLabel label_1 = new JLabel("\u8BFE\u7A0B\u53F7\uFF1A");
label_1.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
label_1.setBounds(104, 76, 77, 41);
panel.add(label_1);
textField = new JTextField();
textField.setBounds(181, 80, 110, 34);
panel.add(textField);
textField.setColumns(10);
JLabel label_2 = new JLabel("\u8BFE\u7A0B\u540D\uFF1A");
label_2.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
label_2.setBounds(105, 137, 77, 41);
panel.add(label_2);
textField_1 = new JTextField();
textField_1.setColumns(10);
textField_1.setBounds(180, 137, 110, 34);
panel.add(textField_1);
JLabel label_3 = new JLabel("\u5B66\u5206\uFF1A");
label_3.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
label_3.setBounds(111, 199, 69, 41);
panel.add(label_3);
textField_2 = new JTextField();
textField_2.setColumns(10);
textField_2.setBounds(181, 201, 110, 34);
panel.add(textField_2);
JButton button = new JButton("\u786E\u5B9A");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
MysqlConn.ConnectSQL();
if(textField.getText().isEmpty()){
JOptionPane.showMessageDialog(null,"γ̺!", "ʾϢ", JOptionPane.WARNING_MESSAGE);
}else if(!JudgeNum.judge(textField.getText(), textField.getText().length())){
JOptionPane.showMessageDialog(null,"γ̺ŽɣĿγ̺ʽ!\n", "ʾϢ", JOptionPane.WARNING_MESSAGE);
}else if(MysqlConn.querycou(textField.getText())){
JOptionPane.showMessageDialog(null,"ÿγѴ!\n", "ʾϢ", JOptionPane.WARNING_MESSAGE);
}else if(textField_1.getText().isEmpty()){
JOptionPane.showMessageDialog(null,"γ!", "ʾϢ", JOptionPane.WARNING_MESSAGE);
}else if(textField_2.getText().isEmpty()){
JOptionPane.showMessageDialog(null,"ѧ!", "ʾϢ", JOptionPane.WARNING_MESSAGE);
}else if(!JudgeNum.judge(textField_2.getText())){
JOptionPane.showMessageDialog(null,"ѧֵȷʽ!", "ʾϢ", JOptionPane.WARNING_MESSAGE);
}else{
MysqlConn.cno = textField.getText();
MysqlConn.cname = textField_1.getText();
MysqlConn.stucredit = Double.parseDouble(textField_2.getText());
MysqlConn.insertcou(MysqlConn.cno,MysqlConn.cname,MysqlConn.stucredit);
}
}
});
button.setBounds(146, 345, 78, 41);
getContentPane().add(button);
JButton button_1 = new JButton("\u91CD\u7F6E");
button_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
textField.setText("");
textField_1.setText("");
textField_2.setText("");
}
});
button_1.setBounds(237, 344, 78, 41);
getContentPane().add(button_1);
JButton button_2 = new JButton("\u8FD4\u56DE");
button_2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
Cou co = new Cou();
}
});
button_2.setBounds(330, 344, 78, 41);
getContentPane().add(button_2);
JButton button_3 = new JButton("\u9000\u51FA");
button_3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
button_3.setBounds(423, 343, 78, 41);
getContentPane().add(button_3);
//ñ
this.setTitle("ѧϢϵͳ-Ա-ӿγϢ");
//ôС
this.setSize(650,520);
//ôʼλ
this.setLocation(200, 150);
//õرմʱ֤JVMҲ˳
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//ʾ
this.setVisible(true);
//Сɱ
this.setResizable(true);
}
public InsertCou(String s) {
getContentPane().setLayout(null);
JPanel panel = new JPanel();
panel.setBounds(134, 49, 379, 265);
getContentPane().add(panel);
panel.setLayout(null);
JLabel label = new JLabel("дҪĵĿγϢ");
label.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
label.setBounds(79, 14, 238, 36);
panel.add(label);
JLabel label_1 = new JLabel("\u8BFE\u7A0B\u53F7\uFF1A");
label_1.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
label_1.setBounds(104, 76, 77, 41);
panel.add(label_1);
textField = new JTextField();
textField.setBounds(181, 80, 110, 34);
panel.add(textField);
textField.setColumns(10);
JLabel label_2 = new JLabel("\u8BFE\u7A0B\u540D\uFF1A");
label_2.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
label_2.setBounds(105, 137, 77, 41);
panel.add(label_2);
textField_1 = new JTextField();
textField_1.setColumns(10);
textField_1.setBounds(180, 137, 110, 34);
panel.add(textField_1);
JLabel label_3 = new JLabel("\u5B66\u5206\uFF1A");
label_3.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
label_3.setBounds(111, 199, 69, 41);
panel.add(label_3);
textField_2 = new JTextField();
textField_2.setColumns(10);
textField_2.setBounds(181, 201, 110, 34);
panel.add(textField_2);
JButton button = new JButton("\u786E\u5B9A");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
MysqlConn.ConnectSQL();
if(textField.getText().isEmpty()){
JOptionPane.showMessageDialog(null,"γ̺!", "ʾϢ", JOptionPane.WARNING_MESSAGE);
}else if(!JudgeNum.judge(textField.getText(), textField.getText().length())){
JOptionPane.showMessageDialog(null,"γ̺ŽɣĿγ̺ʽ!\n", "ʾϢ", JOptionPane.WARNING_MESSAGE);
}else if(MysqlConn.querycou(textField.getText())){
JOptionPane.showMessageDialog(null,"ÿγ̲!\n", "ʾϢ", JOptionPane.WARNING_MESSAGE);
}else if(textField_1.getText().isEmpty()){
JOptionPane.showMessageDialog(null,"γ!", "ʾϢ", JOptionPane.WARNING_MESSAGE);
}else if(textField_2.getText().isEmpty()){
JOptionPane.showMessageDialog(null,"ѧ!", "ʾϢ", JOptionPane.WARNING_MESSAGE);
}else if(!JudgeNum.judge(textField_2.getText())){
JOptionPane.showMessageDialog(null,"ѧֵȷʽ!", "ʾϢ", JOptionPane.WARNING_MESSAGE);
}else{
MysqlConn.cno = textField.getText();
MysqlConn.cname = textField_1.getText();
MysqlConn.stucredit = Double.parseDouble(textField_2.getText());
MysqlConn.updatecou(MysqlConn.cno,MysqlConn.cname,MysqlConn.stucredit);
}
}
});
button.setBounds(146, 345, 78, 41);
getContentPane().add(button);
JButton button_1 = new JButton("\u91CD\u7F6E");
button_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
textField.setText("");
textField_1.setText("");
textField_2.setText("");
}
});
button_1.setBounds(237, 344, 78, 41);
getContentPane().add(button_1);
JButton button_2 = new JButton("\u8FD4\u56DE");
button_2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
Cou co = new Cou();
}
});
button_2.setBounds(330, 344, 78, 41);
getContentPane().add(button_2);
JButton button_3 = new JButton("\u9000\u51FA");
button_3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
button_3.setBounds(423, 343, 78, 41);
getContentPane().add(button_3);
//ñ
this.setTitle("ѧϢϵͳ-Ա-ĿγϢ");
//ôС
this.setSize(650,520);
//ôʼλ
this.setLocation(200, 150);
//õرմʱ֤JVMҲ˳
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//ʾ
this.setVisible(true);
//Сɱ
this.setResizable(true);
}
}
================================================
FILE: src/SMIS/InsertGra.java
================================================
package ѧϢϵͳ;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import java.awt.BorderLayout;
import java.awt.Font;
import javax.swing.JTextField;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class InsertGra extends JFrame {
private JTextField textField;
private JTextField textField_1;
public InsertGra() {
getContentPane().setLayout(null);
JLabel lblNewLabel = new JLabel("\u5B66\u53F7\uFF1A");
lblNewLabel.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
lblNewLabel.setBounds(218, 88, 61, 39);
getContentPane().add(lblNewLabel);
textField = new JTextField();
textField.setBounds(286, 90, 151, 39);
getContentPane().add(textField);
textField.setColumns(10);
JLabel label = new JLabel("\u6210\u7EE9\uFF1A");
label.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
label.setBounds(218, 196, 61, 39);
getContentPane().add(label);
textField_1 = new JTextField();
textField_1.setColumns(10);
textField_1.setBounds(306, 198, 110, 39);
getContentPane().add(textField_1);
JButton button = new JButton("\u786E\u5B9A");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
MysqlConn.ConnectSQL();
if(textField.getText().isEmpty()){
JOptionPane.showMessageDialog(null,"ѧ!", "ʾϢ", JOptionPane.WARNING_MESSAGE);
}else if(!JudgeNum.judge(textField.getText(), textField.getText().length())){
JOptionPane.showMessageDialog(null, "ѧŽɣѧʽ!\n", "ʾϢ", JOptionPane.ERROR_MESSAGE);
}else if(!MysqlConn.querystu(textField.getText())){
JOptionPane.showMessageDialog(null, "ѧѧŲ!\n", "ʾϢ", JOptionPane.ERROR_MESSAGE);
}else if(textField_1.getText().isEmpty()){
JOptionPane.showMessageDialog(null,"ѧɼ!", "ʾϢ", JOptionPane.WARNING_MESSAGE);
}else if(!JudgeNum.judge(textField_1.getText(), textField_1.getText().length())){
JOptionPane.showMessageDialog(null, "ɼɣijɼʽ!\n", "ʾϢ", JOptionPane.ERROR_MESSAGE);
}else if(Integer.parseInt(textField_1.getText()) > 100 || Integer.parseInt(textField_1.getText()) < 0){
JOptionPane.showMessageDialog(null, "ijɼʽ!\n0~100е", "ʾϢ", JOptionPane.ERROR_MESSAGE);
}else{
MysqlConn.stuid = textField.getText();
MysqlConn.stugrade = Integer.parseInt(textField_1.getText());
MysqlConn.stupoint = Calculate.calculatepoi(MysqlConn.stugrade);
//õǰ¼ʦϢ̿γ
MysqlConn.getdatatea(MysqlConn.userword);
//˴ӦóɼѴڵ
if(MysqlConn.querycou(MysqlConn.stuid, MysqlConn.cname)){
JOptionPane.showMessageDialog(null, "ѧ˿γ̳ɼѴ!", "ʾϢ", JOptionPane.ERROR_MESSAGE);
}else{
MysqlConn.insertgra(MysqlConn.stuid,MysqlConn.cno,MysqlConn.stugrade,MysqlConn.stupoint);
}
}
}
});
button.setBounds(132, 308, 84, 39);
getContentPane().add(button);
JButton button_1 = new JButton("\u91CD\u7F6E");
button_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
textField.setText("");
textField_1.setText("");
}
});
button_1.setBounds(222, 308, 84, 39);
getContentPane().add(button_1);
JButton button_2 = new JButton("\u8FD4\u56DE");
button_2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
Teacher t = new Teacher();
}
});
button_2.setBounds(315, 308, 84, 39);
getContentPane().add(button_2);
JButton button_3 = new JButton("\u9000\u51FA");
button_3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
button_3.setBounds(408, 308, 84, 39);
getContentPane().add(button_3);
this.setTitle("ѧϢϵͳ-Ա-¼ѧɼ");
//ôС
this.setSize(650,520);
//ôʼλ
this.setLocation(200, 150);
//õرմʱ֤JVMҲ˳
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//ʾ
this.setVisible(true);
//Сɱ
this.setResizable(true);
}
public InsertGra(String s) {
getContentPane().setLayout(null);
JLabel lblNewLabel = new JLabel("\u5B66\u53F7\uFF1A");
lblNewLabel.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
lblNewLabel.setBounds(218, 88, 61, 39);
getContentPane().add(lblNewLabel);
textField = new JTextField();
textField.setBounds(286, 90, 151, 39);
getContentPane().add(textField);
textField.setColumns(10);
JLabel label = new JLabel("\u6210\u7EE9\uFF1A");
label.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
label.setBounds(218, 196, 61, 39);
getContentPane().add(label);
textField_1 = new JTextField();
textField_1.setColumns(10);
textField_1.setBounds(306, 198, 110, 39);
getContentPane().add(textField_1);
JButton button = new JButton("\u786E\u5B9A");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
MysqlConn.ConnectSQL();
if(textField.getText().isEmpty()){
JOptionPane.showMessageDialog(null,"ѧ!", "ʾϢ", JOptionPane.WARNING_MESSAGE);
}else if(!JudgeNum.judge(textField.getText(), textField.getText().length())){
JOptionPane.showMessageDialog(null, "ѧŽɣѧʽ!\n", "ʾϢ", JOptionPane.ERROR_MESSAGE);
}else if(!MysqlConn.querystu(textField.getText())){
JOptionPane.showMessageDialog(null, "ѧѧŲ!\n", "ʾϢ", JOptionPane.ERROR_MESSAGE);
}else if(textField_1.getText().isEmpty()){
JOptionPane.showMessageDialog(null,"ѧɼ!", "ʾϢ", JOptionPane.WARNING_MESSAGE);
}else if(!JudgeNum.judge(textField_1.getText(), textField_1.getText().length())){
JOptionPane.showMessageDialog(null, "ɼɣijɼʽ!\n", "ʾϢ", JOptionPane.ERROR_MESSAGE);
}else if(Integer.parseInt(textField_1.getText()) > 100 || Integer.parseInt(textField_1.getText()) < 0){
JOptionPane.showMessageDialog(null, "ijɼʽ!\n0~100е", "ʾϢ", JOptionPane.ERROR_MESSAGE);
}else{
MysqlConn.stuid = textField.getText();
MysqlConn.stugrade = Integer.parseInt(textField_1.getText());
MysqlConn.stupoint = Calculate.calculatepoi(MysqlConn.stugrade);
//õǰ¼ʦϢ̿γ
MysqlConn.getdatatea(MysqlConn.userword);
//˴ӦóɼѴڵ
if(!MysqlConn.querycou(MysqlConn.stuid, MysqlConn.cname)){
JOptionPane.showMessageDialog(null, "ѧ˿γ̳ɼ!", "ʾϢ", JOptionPane.ERROR_MESSAGE);
}else{
MysqlConn.updategra(MysqlConn.stuid,MysqlConn.cno,MysqlConn.stugrade,MysqlConn.stupoint);
}
}
}
});
button.setBounds(132, 308, 84, 39);
getContentPane().add(button);
JButton button_1 = new JButton("\u91CD\u7F6E");
button_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
textField.setText("");
textField_1.setText("");
}
});
button_1.setBounds(222, 308, 84, 39);
getContentPane().add(button_1);
JButton button_2 = new JButton("\u8FD4\u56DE");
button_2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
Teacher t = new Teacher();
}
});
button_2.setBounds(315, 308, 84, 39);
getContentPane().add(button_2);
JButton button_3 = new JButton("\u9000\u51FA");
button_3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
button_3.setBounds(408, 308, 84, 39);
getContentPane().add(button_3);
this.setTitle("ѧϢϵͳ-Ա-ѧɼ");
//ôС
this.setSize(650,520);
//ôʼλ
this.setLocation(200, 150);
//õرմʱ֤JVMҲ˳
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//ʾ
this.setVisible(true);
//Сɱ
this.setResizable(true);
}
}
================================================
FILE: src/SMIS/InsertStu.java
================================================
package ѧϢϵͳ;
import javax.swing.*;
import java.awt.BorderLayout;
import java.awt.Font;
import java.awt.event.ActionListener;
import java.sql.Date;
import java.awt.event.ActionEvent;
import java.awt.FlowLayout;
import javax.swing.GroupLayout.Alignment;
public class InsertStu extends JFrame {
private JTextField textField;
private JTextField textField_1;
private JTextField textField_2;
private JTextField textField_3;
public InsertStu() {
getContentPane().setLayout(null);
JPanel panel = new JPanel();
panel.setBounds(40, 12, 554, 397);
getContentPane().add(panel);
panel.setLayout(null);
textField_3 = new JTextField();
textField_3.setBounds(196, 218, 121, 26);
panel.add(textField_3);
textField_3.setColumns(10);
JLabel label_7 = new JLabel("\u5BB6\u5EAD\u5730\u5740\uFF1A");
label_7.setBounds(101, 331, 90, 24);
panel.add(label_7);
label_7.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
JComboBox comboBox_4 = new JComboBox();
comboBox_4.setModel(new DefaultComboBoxModel(new String[] {"\u8BA1\u7B97\u673A\u79D1\u5B66\u4E0E\u6280\u672F\u5B66\u9662", "\u533B\u5B66\u9662"}));
comboBox_4.setBounds(196, 257, 200, 24);
panel.add(comboBox_4);
JLabel label_6 = new JLabel("\u73ED\u7EA7\uFF1A");
label_6.setBounds(137, 292, 54, 24);
panel.add(label_6);
label_6.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
JComboBox comboBox_3 = new JComboBox();
comboBox_3.setModel(new DefaultComboBoxModel(new String[] {"\u8BA1\u79D11501\u73ED", "\u8BA1\u79D11502\u73ED", "\u8BA1\u79D11401\u73ED", "\u4FE1\u5B891501\u73ED", "\u4E34\u5E8A1501\u73ED"}));
comboBox_3.setBounds(196, 294, 121, 24);
panel.add(comboBox_3);
JLabel label_5 = new JLabel("\u5B66\u9662\uFF1A");
label_5.setBounds(137, 255, 54, 24);
panel.add(label_5);
label_5.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
textField_2 = new JTextField();
textField_2.setBounds(196, 331, 285, 29);
panel.add(textField_2);
textField_2.setColumns(10);
JLabel label_4 = new JLabel("\u7535\u8BDD\uFF1A");
label_4.setBounds(137, 218, 54, 24);
panel.add(label_4);
label_4.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
JLabel label = new JLabel("\u5B66\u53F7\uFF1A");
label.setBounds(137, 61, 54, 24);
panel.add(label);
label.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
JComboBox comboBox_2 = new JComboBox();
comboBox_2.setModel(new DefaultComboBoxModel(new String[] {"1990", "1991", "1992", "1993", "1994", "1995", "1996", "1997", "1998", "1999", "2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009", "2010"}));
comboBox_2.setBounds(196, 176, 70, 29);
panel.add(comboBox_2);
JComboBox comboBox_1 = new JComboBox();
comboBox_1.setModel(new DefaultComboBoxModel(new String[] {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"}));
comboBox_1.setBounds(270, 176, 47, 29);
panel.add(comboBox_1);
JComboBox comboBox = new JComboBox();
comboBox.setModel(new DefaultComboBoxModel(new String[] {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31"}));
comboBox.setBounds(322, 176, 47, 29);
panel.add(comboBox);
JLabel label_3 = new JLabel("\u51FA\u751F\u5E74\u6708\uFF1A");
label_3.setBounds(101, 176, 90, 29);
panel.add(label_3);
label_3.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
JRadioButton radioButton_1 = new JRadioButton("\u5973");
radioButton_1.setBounds(270, 134, 47, 33);
panel.add(radioButton_1);
radioButton_1.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
JRadioButton radioButton = new JRadioButton("\u7537");
radioButton.setBounds(196, 134, 47, 33);
panel.add(radioButton);
radioButton.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
ButtonGroup bg = new ButtonGroup();
bg.add(radioButton);
bg.add(radioButton_1);
JLabel label_2 = new JLabel("\u6027\u522B\uFF1A");
label_2.setBounds(137, 137, 54, 24);
panel.add(label_2);
label_2.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
textField_1 = new JTextField();
textField_1.setBounds(196, 61, 121, 24);
panel.add(textField_1);
textField_1.setColumns(10);
JLabel label_1 = new JLabel("\u59D3\u540D\uFF1A");
label_1.setBounds(137, 100, 54, 24);
panel.add(label_1);
label_1.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
textField = new JTextField();
textField.setBounds(196, 99, 121, 24);
panel.add(textField);
textField.setColumns(10);
JLabel label_8 = new JLabel("\u8BF7\u586B\u5199\u60A8\u8981\u6DFB\u52A0\u7684\u5B66\u751F\u4FE1\u606F\uFF1A");
label_8.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
label_8.setBounds(142, 18, 235, 30);
panel.add(label_8);
JPanel panel_1 = new JPanel();
panel_1.setBounds(109, 422, 416, 37);
getContentPane().add(panel_1);
JButton button = new JButton("\u786E\u5B9A");
button.setBounds(51, 5, 63, 27);
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
MysqlConn.ConnectSQL();
if(textField_1.getText().isEmpty()){
JOptionPane.showMessageDialog(null,"ѧ!","ʾϢ",JOptionPane.WARNING_MESSAGE);
}else if(MysqlConn.querystu(textField_1.getText())){
JOptionPane.showMessageDialog(null,"ѧѴ!\n","ʾϢ",JOptionPane.WARNING_MESSAGE);
}else if(!JudgeNum.judge(textField_1.getText(), textField_1.getText().length())){
JOptionPane.showMessageDialog(null, "ѧŽɣѧʽ!\n", "ʾϢ", JOptionPane.ERROR_MESSAGE);
}else if(textField.getText().isEmpty()){
JOptionPane.showMessageDialog(null,"!","ʾϢ",JOptionPane.WARNING_MESSAGE);
}else if(!radioButton.isSelected() && !radioButton_1.isSelected()){
JOptionPane.showMessageDialog(null,"ѡԱ!","ʾϢ",JOptionPane.WARNING_MESSAGE);
}else if(textField_3.getText().isEmpty()){
JOptionPane.showMessageDialog(null,"绰!","ʾϢ",JOptionPane.WARNING_MESSAGE);
}else if(!JudgeNum.judge(textField_3.getText(), textField_3.getText().length())){
JOptionPane.showMessageDialog(null, "绰ɣĺʽ!\n", "ʾϢ", JOptionPane.ERROR_MESSAGE);
}else if(textField_2.getText().isEmpty()){
JOptionPane.showMessageDialog(null,"ַͥ!","ʾϢ",JOptionPane.WARNING_MESSAGE);
}else{
MysqlConn.stuid = textField_1.getText();
MysqlConn.stuname = textField.getText();
if(radioButton.isSelected())
MysqlConn.stusex = "";
else
MysqlConn.stusex = "Ů";
MysqlConn.stubirth = Transform.strToDate((String) comboBox_2.getSelectedItem() +"-"+ (String)comboBox_1.getSelectedItem() +"-"+ (String) comboBox.getSelectedItem());
MysqlConn.stutel = textField_3.getText();
MysqlConn.stuacademy = (String) comboBox_4.getSelectedItem();
MysqlConn.stuclass = (String) comboBox_3.getSelectedItem();
MysqlConn.stuadd = textField_2.getText();
//ѧϢ뵽ݿ
MysqlConn.insertstu();
}
}
});
panel_1.setLayout(null);
panel_1.add(button);
JButton button_1 = new JButton("\u8FD4\u56DE");
button_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
Stu st = new Stu();
}
});
button_1.setBounds(203, 5, 63, 27);
panel_1.add(button_1);
JButton button_2 = new JButton("\u9000\u51FA");
button_2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
button_2.setBounds(280, 5, 63, 27);
panel_1.add(button_2);
JButton button_3 = new JButton("\u91CD\u7F6E");
button_3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
textField.setText("");
textField_1.setText("");
textField_2.setText("");
textField_3.setText("");
}
});
button_3.setBounds(126, 5, 63, 27);
panel_1.add(button_3);
this.setTitle("ѧϢϵͳ-Ա-ѧϢ");
//ôС
this.setSize(650,520);
//ôʼλ
this.setLocation(200, 150);
//õرմʱ֤JVMҲ˳
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//ʾ
this.setVisible(true);
//Сɱ
this.setResizable(true);
}
public InsertStu(String s) {
getContentPane().setLayout(null);
JPanel panel = new JPanel();
panel.setBounds(40, 12, 554, 397);
getContentPane().add(panel);
panel.setLayout(null);
textField_3 = new JTextField();
textField_3.setBounds(196, 218, 121, 26);
panel.add(textField_3);
textField_3.setColumns(10);
JLabel label_7 = new JLabel("\u5BB6\u5EAD\u5730\u5740\uFF1A");
label_7.setBounds(101, 331, 90, 24);
panel.add(label_7);
label_7.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
JComboBox comboBox_4 = new JComboBox();
comboBox_4.setModel(new DefaultComboBoxModel(new String[] {"\u8BA1\u7B97\u673A\u79D1\u5B66\u4E0E\u6280\u672F\u5B66\u9662", "\u533B\u5B66\u9662"}));
comboBox_4.setBounds(196, 257, 200, 24);
panel.add(comboBox_4);
JLabel label_6 = new JLabel("\u73ED\u7EA7\uFF1A");
label_6.setBounds(137, 292, 54, 24);
panel.add(label_6);
label_6.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
JComboBox comboBox_3 = new JComboBox();
comboBox_3.setModel(new DefaultComboBoxModel(new String[] {"\u8BA1\u79D11501\u73ED", "\u8BA1\u79D11502\u73ED", "\u8BA1\u79D11401\u73ED", "\u4FE1\u5B891501\u73ED", "\u4E34\u5E8A1501\u73ED"}));
comboBox_3.setBounds(196, 294, 121, 24);
panel.add(comboBox_3);
JLabel label_5 = new JLabel("\u5B66\u9662\uFF1A");
label_5.setBounds(137, 255, 54, 24);
panel.add(label_5);
label_5.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
textField_2 = new JTextField();
textField_2.setBounds(196, 331, 285, 29);
panel.add(textField_2);
textField_2.setColumns(10);
JLabel label_4 = new JLabel("\u7535\u8BDD\uFF1A");
label_4.setBounds(137, 218, 54, 24);
panel.add(label_4);
label_4.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
JLabel label = new JLabel("\u5B66\u53F7\uFF1A");
label.setBounds(137, 61, 54, 24);
panel.add(label);
label.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
JComboBox comboBox_2 = new JComboBox();
comboBox_2.setModel(new DefaultComboBoxModel(new String[] {"1990", "1991", "1992", "1993", "1994", "1995", "1996", "1997", "1998", "1999", "2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009", "2010"}));
comboBox_2.setBounds(196, 176, 70, 29);
panel.add(comboBox_2);
JComboBox comboBox_1 = new JComboBox();
comboBox_1.setModel(new DefaultComboBoxModel(new String[] {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"}));
comboBox_1.setBounds(270, 176, 47, 29);
panel.add(comboBox_1);
JComboBox comboBox = new JComboBox();
comboBox.setModel(new DefaultComboBoxModel(new String[] {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31"}));
comboBox.setBounds(322, 176, 47, 29);
panel.add(comboBox);
JLabel label_3 = new JLabel("\u51FA\u751F\u5E74\u6708\uFF1A");
label_3.setBounds(101, 176, 90, 29);
panel.add(label_3);
label_3.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
JRadioButton radioButton_1 = new JRadioButton("\u5973");
radioButton_1.setBounds(270, 134, 47, 33);
panel.add(radioButton_1);
radioButton_1.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
JRadioButton radioButton = new JRadioButton("\u7537");
radioButton.setBounds(196, 134, 47, 33);
panel.add(radioButton);
radioButton.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
ButtonGroup bg = new ButtonGroup();
bg.add(radioButton);
bg.add(radioButton_1);
JLabel label_2 = new JLabel("\u6027\u522B\uFF1A");
label_2.setBounds(137, 137, 54, 24);
panel.add(label_2);
label_2.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
textField_1 = new JTextField();
textField_1.setBounds(196, 61, 121, 24);
panel.add(textField_1);
textField_1.setColumns(10);
JLabel label_1 = new JLabel("\u59D3\u540D\uFF1A");
label_1.setBounds(137, 100, 54, 24);
panel.add(label_1);
label_1.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
textField = new JTextField();
textField.setBounds(196, 99, 121, 24);
panel.add(textField);
textField.setColumns(10);
JLabel label_8 = new JLabel("дҪĵѧϢ");
label_8.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
label_8.setBounds(142, 18, 235, 30);
panel.add(label_8);
JPanel panel_1 = new JPanel();
panel_1.setBounds(109, 422, 416, 37);
getContentPane().add(panel_1);
JButton button = new JButton("\u786E\u5B9A");
button.setBounds(51, 5, 63, 27);
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
MysqlConn.ConnectSQL();
if(textField_1.getText().isEmpty()){
JOptionPane.showMessageDialog(null,"ѧ!","ʾϢ",JOptionPane.WARNING_MESSAGE);
}else if(!JudgeNum.judge(textField_1.getText(), textField_1.getText().length())){
JOptionPane.showMessageDialog(null, "ѧŽɣѧʽ!\n", "ʾϢ", JOptionPane.ERROR_MESSAGE);
}else if(!MysqlConn.querystu(textField_1.getText())){
JOptionPane.showMessageDialog(null,"ѧŲ!\n","ʾϢ",JOptionPane.WARNING_MESSAGE);
}else if(textField.getText().isEmpty()){
JOptionPane.showMessageDialog(null,"!","ʾϢ",JOptionPane.WARNING_MESSAGE);
}else if(!radioButton.isSelected() && !radioButton_1.isSelected()){
JOptionPane.showMessageDialog(null,"ѡԱ!","ʾϢ",JOptionPane.WARNING_MESSAGE);
}else if(textField_3.getText().isEmpty()){
JOptionPane.showMessageDialog(null,"绰!","ʾϢ",JOptionPane.WARNING_MESSAGE);
}else if(!JudgeNum.judge(textField_3.getText(), textField_3.getText().length())){
JOptionPane.showMessageDialog(null, "绰ɣĺʽ!\n", "ʾϢ", JOptionPane.ERROR_MESSAGE);
}else if(textField_2.getText().isEmpty()){
JOptionPane.showMessageDialog(null,"ַͥ!","ʾϢ",JOptionPane.WARNING_MESSAGE);
}else{
MysqlConn.stuid = textField_1.getText();
MysqlConn.stuname = textField.getText();
if(radioButton.isSelected())
MysqlConn.stusex = "";
else
MysqlConn.stusex = "Ů";
MysqlConn.stubirth = Transform.strToDate((String) comboBox_2.getSelectedItem() +"-"+ (String)comboBox_1.getSelectedItem() +"-"+ (String) comboBox.getSelectedItem());
MysqlConn.stutel = textField_3.getText();
MysqlConn.stuacademy = (String) comboBox_4.getSelectedItem();
MysqlConn.stuclass = (String) comboBox_3.getSelectedItem();
MysqlConn.stuadd = textField_2.getText();
//ѧϢ뵽ݿ
MysqlConn.updatestu(MysqlConn.stuid,MysqlConn.stuname,MysqlConn.stusex,MysqlConn.stubirth,MysqlConn.stutel,MysqlConn.stuacademy,MysqlConn.stuclass,MysqlConn.stuadd);
}
}
});
panel_1.setLayout(null);
panel_1.add(button);
JButton button_1 = new JButton("\u8FD4\u56DE");
button_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
Stu st = new Stu();
}
});
button_1.setBounds(203, 5, 63, 27);
panel_1.add(button_1);
JButton button_2 = new JButton("\u9000\u51FA");
button_2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
button_2.setBounds(280, 5, 63, 27);
panel_1.add(button_2);
JButton button_3 = new JButton("\u91CD\u7F6E");
button_3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
textField.setText("");
textField_1.setText("");
textField_2.setText("");
textField_3.setText("");
}
});
button_3.setBounds(126, 5, 63, 27);
panel_1.add(button_3);
this.setTitle("ѧϢϵͳ-Ա-ѧϢ");
//ôС
this.setSize(650,520);
//ôʼλ
this.setLocation(200, 150);
//õرմʱ֤JVMҲ˳
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//ʾ
this.setVisible(true);
//Сɱ
this.setResizable(true);
}
}
================================================
FILE: src/SMIS/InsertTea.java
================================================
package ѧϢϵͳ;
import javax.swing.*;
import java.awt.BorderLayout;
import java.awt.Font;
import java.awt.event.ActionListener;
import java.sql.Date;
import java.awt.event.ActionEvent;
public class InsertTea extends JFrame {
private JTextField textField;
private JTextField textField_1;
public InsertTea() {
getContentPane().setLayout(null);
JPanel panel = new JPanel();
panel.setBounds(141, 61, 365, 273);
getContentPane().add(panel);
panel.setLayout(null);
JComboBox comboBox_3 = new JComboBox();
comboBox_3.setBounds(123, 214, 201, 35);
panel.add(comboBox_3);
//comboBox_3.setModel(new DefaultComboBoxModel(new String[] {"00256320", "00256321", "00256401", "00256530"}));
MysqlConn.ConnectSQL();
MysqlConn.getdatacou();
for(int i = 0; i < MysqlConn.counter; i++){
comboBox_3.addItem(MysqlConn.c_name[i]);
}
JRadioButton radioButton_2 = new JRadioButton("\u8BB2\u5E08");
radioButton_2.setBounds(283, 167, 72, 27);
panel.add(radioButton_2);
JRadioButton radioButton_1 = new JRadioButton("\u526F\u6559\u6388");
radioButton_1.setBounds(194, 167, 88, 27);
panel.add(radioButton_1);
JRadioButton radioButton = new JRadioButton("\u6559\u6388");
radioButton.setBounds(130, 167, 72, 27);
panel.add(radioButton);
ButtonGroup bg = new ButtonGroup();
bg.add(radioButton);
bg.add(radioButton_1);
bg.add(radioButton_2);
JComboBox comboBox_2 = new JComboBox();
comboBox_2.setBounds(267, 109, 51, 35);
panel.add(comboBox_2);
for(int i = 1; i <= 31;i++){
comboBox_2.addItem(String.valueOf(i));
}
JComboBox comboBox_1 = new JComboBox();
comboBox_1.setBounds(207, 109, 51, 35);
panel.add(comboBox_1);
for(int i = 1; i <= 12;i++){
comboBox_1.addItem(String.valueOf(i));
}
JComboBox comboBox = new JComboBox();
comboBox.setBounds(130, 109, 67, 35);
panel.add(comboBox);
for(int i = 1960; i<= 2010; i++){
comboBox.addItem(String.valueOf(i));
}
textField_1 = new JTextField();
textField_1.setBounds(130, 62, 125, 36);
panel.add(textField_1);
textField_1.setColumns(10);
JLabel label_3 = new JLabel("\u6240\u6559\u8BFE\u7A0B\uFF1A");
label_3.setBounds(31, 208, 100, 42);
panel.add(label_3);
label_3.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
JLabel label_2 = new JLabel("\u804C\u79F0\uFF1A");
label_2.setBounds(47, 159, 60, 42);
panel.add(label_2);
label_2.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
JLabel label_1 = new JLabel("\u51FA\u751F\u5E74\u6708\uFF1A");
label_1.setBounds(31, 104, 100, 42);
panel.add(label_1);
label_1.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
JLabel label = new JLabel("\u59D3\u540D\uFF1A");
label.setBounds(64, 59, 60, 42);
panel.add(label);
label.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
textField = new JTextField();
textField.setBounds(130, 13, 124, 36);
panel.add(textField);
textField.setColumns(10);
JLabel lblNewLabel = new JLabel("\u6559\u5E08\u53F7\uFF1A");
lblNewLabel.setBounds(46, 13, 88, 42);
panel.add(lblNewLabel);
lblNewLabel.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
JLabel label_4 = new JLabel("\u8BF7\u586B\u5199\u60A8\u8981\u6DFB\u52A0\u7684\u6559\u5E08\u4FE1\u606F\uFF1A");
label_4.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
label_4.setBounds(212, 20, 235, 34);
getContentPane().add(label_4);
JPanel panel_1 = new JPanel();
panel_1.setBounds(139, 358, 370, 47);
getContentPane().add(panel_1);
panel_1.setLayout(null);
JButton button = new JButton("\u786E\u5B9A");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
MysqlConn.ConnectSQL();
if(textField.getText().isEmpty()){
JOptionPane.showMessageDialog(null,"ʦ!","ʾϢ",JOptionPane.WARNING_MESSAGE);
}else if(MysqlConn.querytea(textField.getText())){
JOptionPane.showMessageDialog(null,"ýʦѴ!\n","ʾϢ",JOptionPane.WARNING_MESSAGE);
}else if(!JudgeNum.judge(textField.getText(), textField.getText().length())){
JOptionPane.showMessageDialog(null, "ʦŽɣĽʦʽ!\n", "ʾϢ", JOptionPane.ERROR_MESSAGE);
}else if(textField_1.getText().isEmpty()){
JOptionPane.showMessageDialog(null,"!","ʾϢ",JOptionPane.WARNING_MESSAGE);
}else if(!radioButton.isSelected() && !radioButton_1.isSelected() && !radioButton_2.isSelected()){
JOptionPane.showMessageDialog(null,"ѡְ!","ʾϢ",JOptionPane.WARNING_MESSAGE);
}else{
MysqlConn.teaid = textField.getText();
MysqlConn.teaname = textField_1.getText();
MysqlConn.teabirth = Transform.strToDate((String) comboBox.getSelectedItem() +"-"+ (String) comboBox_1.getSelectedItem() +"-"+ (String) comboBox_2.getSelectedItem());
if(radioButton.isSelected()){
MysqlConn.protitle = "";
}else if(radioButton_1.isSelected()){
MysqlConn.protitle = "";
}else{
MysqlConn.protitle = "ʦ";
}
MysqlConn.cname = (String) comboBox_3.getSelectedItem();
MysqlConn.getdatacou(MysqlConn.cname);
MysqlConn.inserttea();
}
}
});
button.setBounds(51, 5, 63, 36);
panel_1.add(button);
JButton button_1 = new JButton("\u91CD\u7F6E");
button_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
textField.setText("");
textField_1.setText("");
}
});
button_1.setBounds(119, 5, 63, 36);
panel_1.add(button_1);
JButton button_2 = new JButton("\u8FD4\u56DE");
button_2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
Tea te =new Tea();
}
});
button_2.setBounds(187, 5, 63, 36);
panel_1.add(button_2);
JButton button_3 = new JButton("\u9000\u51FA");
button_3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
button_3.setBounds(255, 5, 63, 36);
panel_1.add(button_3);
this.setTitle("ѧϢϵͳ-Ա-ӽʦϢ");
//ôС
this.setSize(650,520);
//ôʼλ
this.setLocation(200, 150);
//õرմʱ֤JVMҲ˳
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//ʾ
this.setVisible(true);
//Сɱ
this.setResizable(true);
}
//public static void main(String[] args){
//new InsertTea().setVisible(true);
//}
}
================================================
FILE: src/SMIS/JudgeNum.java
================================================
package ѧϢϵͳ;
public class JudgeNum {
public static boolean judge(String s,int len){
for(int i = 0; i < len; i++){
if(!Character.isDigit(s.charAt(i))){
return false;
}
}
return true;
}
public static boolean judge(String s){
try{
Float.valueOf(s);
return true;
}catch(Exception e){
e.printStackTrace();
}
return false;
}
/*public static void main(String [] args){
String s = "00256320";
if(judge(s,s.length())){
System.out.print("is num");
}else{
System.out.print("is not num");
}
}*/
}
================================================
FILE: src/SMIS/Login.java
================================================
package ѧϢϵͳ;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Login extends JFrame implements ActionListener {
//¼
JButton jb1,jb2,jb3=null;
JRadioButton jrb1,jrb2,jrb3=null;
JPanel jp4=null;
JTextField jtf=null;
JLabel jlb1,jlb2,jlb3=null;
JPasswordField jpf=null;
ButtonGroup bg=null;
public static void main(String[] args) {
// TODO Auto-generated method stub
Login ms=new Login();
}
//캯
public Login()
{
bg=new ButtonGroup();
jp4=new JPanel();
jp4.setBounds(0, 0, 0, 0);
getContentPane().setLayout(null);
getContentPane().add(jp4);
jlb1=new JLabel("û");
jlb1.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
jlb1.setBounds(181, 92, 83, 37);
getContentPane().add(jlb1);
jtf=new JTextField(12);
jtf.setBounds(265, 92, 133, 37);
getContentPane().add(jtf);
jlb2=new JLabel(" 룺");
jlb2.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
jlb2.setBounds(181, 161, 83, 37);
getContentPane().add(jlb2);
jpf = new JPasswordField(12);
jpf.setBounds(265, 161, 133, 37);
getContentPane().add(jpf);
jlb3=new JLabel("Ȩ ޣ");
jlb3.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
jlb3.setBounds(181, 227, 83, 37);
getContentPane().add(jlb3);
jrb1=new JRadioButton("Ա");
jrb1.setBounds(265, 227, 73, 37);
getContentPane().add(jrb1);
bg.add(jrb1);
jrb2=new JRadioButton("ʦ");
jrb2.setBounds(349, 227, 59, 37);
getContentPane().add(jrb2);
bg.add(jrb2);
jrb3=new JRadioButton("ѧ",true);
jrb3.setBounds(421, 227, 59, 37);
getContentPane().add(jrb3);
bg.add(jrb3);
//
jb1=new JButton("¼");
jb1.setBounds(181, 311, 76, 40);
getContentPane().add(jb1);
jb2=new JButton("");
jb2.setBounds(265, 311, 76, 40);
getContentPane().add(jb2);
jb3=new JButton("˳");
jb3.setBounds(349, 311, 76, 40);
getContentPane().add(jb3);
jb3.addActionListener(this);
jb2.addActionListener(this);
//ü
jb1.addActionListener(this);
//ñ
this.setTitle("ѧϢϵͳ-¼");
//ôС
this.setSize(650,520);
//ôʼλ
this.setLocation(200, 150);
//õرմʱ֤JVMҲ˳
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//ʾ
this.setVisible(true);
//Сɱ
this.setResizable(true);
}
@Override
public void actionPerformed(ActionEvent e) {
if(e.getActionCommand()=="˳")
{
System.exit(0);
}else if(e.getActionCommand()=="¼")
{
if(!jtf.getText().isEmpty() && !String.valueOf(jpf.getPassword()).isEmpty())
{
//¼ťʱݿ⽨
MysqlConn.ConnectSQL();
//ѡйԱ¼
if(jrb1.isSelected())
{
//жǷڸû
if(MysqlConn.queryadm(jtf.getText()))
{
//õ¼
this.adminlogin();
}
}else if(jrb2.isSelected())
{
//жǷڸû
if(MysqlConn.querytea(jtf.getText()))
{
MysqlConn.userword = jtf.getText();
//õ¼
this.tealogin();
}
}else if(jrb3.isSelected())
{
//жǷڸû
if(MysqlConn.querystu(jtf.getText()))
{
MysqlConn.userword = jtf.getText();
//õ¼
this.stulogin();
}
}
}else if(jtf.getText().isEmpty())
{
JOptionPane.showMessageDialog(null,"û","ʾϢ",JOptionPane.WARNING_MESSAGE);
this.clear();
}else if(String.valueOf(jpf.getPassword()).isEmpty())
{
JOptionPane.showMessageDialog(null,"","ʾϢ",JOptionPane.WARNING_MESSAGE);
this.clear();
}
}else if(e.getActionCommand()=="")
{
this.clear();
}
}
//ı
public void clear()
{
jtf.setText("");
jpf.setText("");
}
//Ա¼
public void adminlogin(){
if(MysqlConn.pawd.equals(String.valueOf(jpf.getPassword())))
{
JOptionPane.showMessageDialog(null,"¼ɹ","ʾϢ",JOptionPane.WARNING_MESSAGE);
this.clear();
//رյǰ
dispose();
//һ½
Admin ad=new Admin();
}else if(jtf.getText().isEmpty()&&String.valueOf(jpf.getPassword()).isEmpty())
{
JOptionPane.showMessageDialog(null,"û룡","ʾϢ",JOptionPane.WARNING_MESSAGE);
}else if(jtf.getText().isEmpty())
{
JOptionPane.showMessageDialog(null,"û","ʾϢ",JOptionPane.WARNING_MESSAGE);
}else if(String.valueOf(jpf.getPassword()).isEmpty())
{
JOptionPane.showMessageDialog(null,"룡","ʾϢ",JOptionPane.WARNING_MESSAGE);
}else
{
JOptionPane.showMessageDialog(null,"û\n","ʾϢ",JOptionPane.ERROR_MESSAGE);
//
this.clear();
}
}
//ʦ¼
public void tealogin(){
if(MysqlConn.pawd.equals(String.valueOf(jpf.getPassword())))
{
JOptionPane.showMessageDialog(null,"¼ɹ","ʾϢ",JOptionPane.WARNING_MESSAGE);
this.clear();
//رյǰ
dispose();
//һ½
Teacher tea = new Teacher();
}else if(jtf.getText().isEmpty()&&String.valueOf(jpf.getPassword()).isEmpty())
{
JOptionPane.showMessageDialog(null,"û룡","ʾϢ",JOptionPane.WARNING_MESSAGE);
}else if(jtf.getText().isEmpty())
{
JOptionPane.showMessageDialog(null,"û","ʾϢ",JOptionPane.WARNING_MESSAGE);
}else if(String.valueOf(jpf.getPassword()).isEmpty())
{
JOptionPane.showMessageDialog(null,"룡","ʾϢ",JOptionPane.WARNING_MESSAGE);
}else
{
JOptionPane.showMessageDialog(null,"û\n","ʾϢ",JOptionPane.ERROR_MESSAGE);
//
this.clear();
}
}
//ѧ¼
public void stulogin(){
if(MysqlConn.pawd.equals(String.valueOf(jpf.getPassword())))
{
JOptionPane.showMessageDialog(null,"¼ɹ","ʾϢ",JOptionPane.WARNING_MESSAGE);
this.clear();
//رյǰ
dispose();
//һ½
Student stu = new Student();
}else if(jtf.getText().isEmpty()&&String.valueOf(jpf.getPassword()).isEmpty())
{
JOptionPane.showMessageDialog(null,"û룡","ʾϢ",JOptionPane.WARNING_MESSAGE);
}else if(jtf.getText().isEmpty())
{
JOptionPane.showMessageDialog(null,"û","ʾϢ",JOptionPane.WARNING_MESSAGE);
}else if(String.valueOf(jpf.getPassword()).isEmpty())
{
JOptionPane.showMessageDialog(null,"룡","ʾϢ",JOptionPane.WARNING_MESSAGE);
}else
{
JOptionPane.showMessageDialog(null,"û\n","ʾϢ",JOptionPane.ERROR_MESSAGE);
//
this.clear();
}
}
}
================================================
FILE: src/SMIS/MysqlConn.java
================================================
package ѧϢϵͳ;
import java.sql.*;
import javax.swing.JOptionPane;
import javax.swing.Spring;
//ݿӳ
public class MysqlConn {
//JDBCݿURL
static final String JDBC_DRIVER = "com.mysql.jdbc.Driver";
static final String DB_URL ="jdbc:mysql://localhost:3306/SCIS";
//ݿ¼
static final String USER = "root";
static final String PASS = "tiger";
//趨û
static String userword;
static String pawd;
static String teaid = null;
static String teaname = null;
static Date teabirth = null;
static String protitle = null;
static String cname = null;
static String cno = null;
static String stuid = null;
static String stuname = null;
static String stusex = null;
static Date stubirth = null;
static String stutel = null;
static String stuacademy = null;//ѧԺ
static String stuclass = null;
static String stuadd = null;
static int stugrade = 0;
static double stupoint = 0;
static double stucredit = 0;
static int counter = 0;
static String [] stu_id = new String[10];
static String [] stu_name = new String[10];
static String [] stu_sex = new String[10];
static Date [] stu_birth = new Date[10];
static String [] stu_tel = new String[10];
static String [] stu_academy = new String[10];
static String [] stu_class = new String[10];
static String [] stu_add = new String[10];
static int [] stu_grade = new int[10];
static double [] stu_point = new double[10];
static String [] c_no = new String[10];
static String [] ct_name = new String[10];
static String [] c_name = new String[10];
static double [] credit = new double[10];
static String [] tea_id = new String[10];
static String [] tea_name = new String[10];
static Date [] tea_birth = new Date[10];
static String [] tea_protitle = new String[10];
static Connection conn = null;
static PreparedStatement ps = null;
static ResultSet rs = null;
//ݿ
public static void ConnectSQL() {
try {
Class.forName(JDBC_DRIVER);
conn = DriverManager.getConnection(DB_URL,USER,PASS);
System.out.println("The SQL is connected");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
// жûǷ
public static boolean queryadm(String id) {
//
try {
ps = conn.prepareStatement("select * from Ա where ID = ?");
// ?ֵ(ɷֹSQLע©)Ҫֱʹƴӵķʽ
ps.setString(1, id);
// ResultSet,ҿResultSetɷһűеĽ
rs = ps.executeQuery();
// ѭȡ
if (rs.next()) {
pawd = rs.getString("password");
return true;
}
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
return false;
}
public static boolean querytea(String id) {
//
try {
ps = conn.prepareStatement("select * from ʦ where ID = ?");
// ?ֵ(ɷֹSQLע©)Ҫֱʹƴӵķʽ
ps.setString(1, id);
// ResultSet,ҿResultSetɷһűеĽ
rs = ps.executeQuery();
// ѭȡ
if (rs.next()) {
pawd = rs.getString("ID");
return true;
}
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
return false;
}
public static boolean querystu(String id) {
//
try {
ps = conn.prepareStatement("select * from ѧ where ID = ?");
// ?ֵ(ɷֹSQLע©)Ҫֱʹƴӵķʽ
ps.setString(1, id);
// ResultSet,ҿResultSetɷһűеĽ
rs = ps.executeQuery();
// ѭȡ
if (rs.next()) {
pawd = rs.getString("ID");
return true;
}
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
return false;
}
//ȡѧϢ
public static void getdatastu() {
//
try {
ps = conn.prepareStatement("select * from ѧ");
// ResultSet,ҿResultSetɷһűеĽ
rs = ps.executeQuery();
counter = 0;
while(rs.next())
{
stu_id[counter] = rs.getString("ID");
stu_name[counter] = rs.getString("Sname");
stu_sex[counter] = rs.getString("Ssex");
stu_birth[counter] = rs.getDate("Sbirth");
stu_tel[counter] = rs.getString("Stel");
stu_academy[counter] = rs.getString("Sacademy");//ѧԺ
stu_class[counter] = rs.getString("Sclass");
stu_add[counter] = rs.getString("Saddress");
counter++;
}
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
public static void getdatastu(String s) {
//
try {
ps = conn.prepareStatement("select * from ɼ,γ where Sno = ? and ɼ.Cno = γ.Cno");
ps.setString(1, s);
// ResultSet,ҿResultSetɷһűеĽ
rs = ps.executeQuery();
counter = 0;
while(rs.next())
{
c_name[counter] = rs.getString("Cname");
stu_grade[counter] = rs.getInt("Grade");
credit[counter] = rs.getDouble("Ccredit");
stu_point[counter] = rs.getDouble("Point");
counter++;
}
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
public static void getdatagra() {
try {
ps = conn.prepareStatement("select * from ɼ,γ,ѧ,ʦ where ɼ.Sno = ѧ.ID and ɼ.Cno = γ.Cno and ʦ.Cno = γ.Cno");
rs = ps.executeQuery();
counter = 0;
while(rs.next())
{
stu_name[counter] = rs.getString("Sname");
c_name[counter] = rs.getString("Cname");
ct_name[counter] = rs.getString("Tname");
stu_grade[counter] = rs.getInt("Grade");
stu_point[counter] = rs.getDouble("Point");
credit[counter] = rs.getDouble("Ccredit");
counter++;
}
}catch(Exception e){
e.printStackTrace();
}
}
public static void getdatatea(){
try {
ps = conn.prepareStatement("select * from ʦ,γ where γ.Cno = ʦ.Cno");
rs = ps.executeQuery();
counter = 0;
while(rs.next()){
tea_id[counter] = rs.getString("ID");
tea_name[counter] = rs.getString("Tname");
tea_birth[counter] = rs.getDate("Tbirth");
tea_protitle[counter] = rs.getString("Tprotitle");
c_name[counter] = rs.getString("Cname");
counter++;
}
}catch(Exception e){
e.printStackTrace();
}
}
//ȡʦϢ
public static void getdatatea(String id) {
//
try {
ps = conn.prepareStatement("select * from ʦ,γ where ID = ? and γ.Cno = ʦ.Cno ");
// ?ֵ(ɷֹSQLע©)Ҫֱʹƴӵķʽ
ps.setString(1, id);
// ResultSet,ҿResultSetɷһűеĽ
rs = ps.executeQuery();
if(rs.next())
{
teaid = rs.getString("ID");
teaname = rs.getString("Tname");
teabirth = rs.getDate("Tbirth");
protitle = rs.getString("Tprotitle");//ְ
cno = rs.getString("Cno");
cname = rs.getString("Cname");
}
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
//ѧϢ
public static void insertstu() {
try{
ps = conn.prepareStatement("insert into ѧ values ('"+stuid+"','"+stuname+"','"+stusex+"','"+stubirth+"','"+stutel+"','"+stuacademy+"','"+stuclass+"','"+stuadd+"')");
ps.executeUpdate();
JOptionPane.showMessageDialog(null, "ѧ¼ӳɹ!", "ʾϢ", JOptionPane.INFORMATION_MESSAGE);
} catch (Exception e1) {
// TODO Auto-generated catch block
JOptionPane.showMessageDialog(null, "쳣!", "ʾϢ", JOptionPane.ERROR_MESSAGE);
e1.printStackTrace();
}
}
public static void updatestu(String stuid2,String stuname2,String stusex2, Date stubirth2, String stutel2, String stuacademy2, String stuclass2, String stuadd2) {
// TODO Auto-generated method stub
try{
ps = conn.prepareStatement("update ѧ set Sname = ?, Ssex = ?, Sbirth = ?, Stel = ?, Sacademy = ?, Sclass = ?, Saddress = ? where ID = ? ");
ps.setString(1, stuname2);
ps.setString(2, stusex2); //ܳĵط
ps.setDate(3, stubirth2);
ps.setString(4, stutel2);
ps.setString(5, stuacademy2);
ps.setString(6, stuclass2);
ps.setString(7, stuadd2);
ps.setString(8, stuid2);
ps.executeUpdate();
JOptionPane.showMessageDialog(null, "ѧ¼ijɹ!", "ʾϢ", JOptionPane.INFORMATION_MESSAGE);
}catch (Exception e1) {
// TODO Auto-generated catch block
JOptionPane.showMessageDialog(null, "ʧ!", "ʾϢ", JOptionPane.ERROR_MESSAGE);
e1.printStackTrace();
}
}
public static void deletestu(String stuid2) {
// TODO Auto-generated method stub
try {
ps = conn.prepareStatement("delete from ѧ where ID = ? ");
ps.setString(1, stuid2);
ps.execute();
JOptionPane.showMessageDialog(null, "ѧ¼ɾɹ!", "ʾϢ", JOptionPane.INFORMATION_MESSAGE);
} catch (Exception e1){
// TODO Auto-generated catch block
JOptionPane.showMessageDialog(null, "ɾʧ!", "ʾϢ", JOptionPane.ERROR_MESSAGE);
e1.printStackTrace();
}
}
public static void inserttea() {
// TODO Auto-generated method stub
try {
ps = conn.prepareStatement("insert into ʦ values ('"+teaid+"','"+teaname+"','"+teabirth+"','"+protitle+"','"+cno+"')");
System.out.println("cno:"+cno);
ps.executeUpdate();
JOptionPane.showMessageDialog(null, "ʦ¼ӳɹ!", "ʾϢ", JOptionPane.INFORMATION_MESSAGE);
}catch (Exception e){
// TODO Auto-generated catch block
JOptionPane.showMessageDialog(null, "쳣!", "ʾϢ", JOptionPane.ERROR_MESSAGE);
e.printStackTrace();
}
}
public static void updatetea(String teaid2, String teaname2, Date teabirth2, String protitle2, String cno2) {
// TODO Auto-generated method stub
try {
ps = conn.prepareStatement("update ʦ set Tname = ?,Tbirth = ?,Tprotitle = ?,Cno = ? where ID = ? ");
ps.setString(1, teaname2);
ps.setDate(2, teabirth2);
ps.setString(3, protitle2);
ps.setString(4, cno2);
ps.setString(5, teaid2);
ps.executeUpdate();
JOptionPane.showMessageDialog(null, "ʦ¼ijɹ!", "ʾϢ", JOptionPane.INFORMATION_MESSAGE);
}catch(Exception e) {
// TODO Auto-generated catch block
JOptionPane.showMessageDialog(null, "ʧ!", "ʾϢ", JOptionPane.ERROR_MESSAGE);
e.printStackTrace();
}
}
public static void deletetea(String teaid2) {
// TODO Auto-generated method stub
try {
ps = conn.prepareStatement("delete from ʦ where ID = ? ");
ps.setString(1, teaid2);
ps.execute();
JOptionPane.showMessageDialog(null, "ʦ¼ɾɹ!", "ʾϢ", JOptionPane.INFORMATION_MESSAGE);
}catch (Exception e1) {
// TODO Auto-generated catch block
JOptionPane.showMessageDialog(null, "ɾʧ!", "ʾϢ", JOptionPane.ERROR_MESSAGE);
e1.printStackTrace();
}
}
public static void querygra(String cname2){
try {
ps = conn.prepareStatement("select * from ѧ,γ,ɼ where Cname = ? and γ.Cno = ɼ.Cno and ѧ.ID = ɼ.Sno");
ps.setString(1, cname2);
rs = ps.executeQuery();
counter = 0;
while(rs.next()){
stu_id[counter] = rs.getString("Sno");
stu_name[counter] = rs.getString("Sname");
stu_grade[counter] = rs.getInt("Grade");
stu_point[counter] = rs.getDouble("Point");
counter++;
}
}catch (Exception e) {
e.printStackTrace();
}
}
public static void insertgra(String stuid2, String cno2, int stugrade2, double stupoint2) {
// TODO Auto-generated method stub
try {
ps = conn.prepareStatement("insert into ɼ values ('"+stuid2+"','"+cno2+"','"+stugrade2+"','"+stupoint2+"')");
ps.executeUpdate();
JOptionPane.showMessageDialog(null, "ɼ¼ɹ!", "ʾϢ", JOptionPane.INFORMATION_MESSAGE);
}catch(Exception e) {
JOptionPane.showMessageDialog(null, "쳣!", "ʾϢ", JOptionPane.ERROR_MESSAGE);
e.printStackTrace();
}
}
//ѯɼijγ̳ɼǷѾ
public static boolean querycou(String stuid2,String cname2){
try {
ps = conn.prepareStatement("select Grade from γ,ɼ where Sno = ? and Cname = ? and γ.Cno = ɼ.Cno");
ps.setString(1, stuid2);
ps.setString(2, cname2);
rs = ps.executeQuery();
if(rs.next()){
return true;
}
}catch(Exception e){
e.printStackTrace();
}
return false;
}
public static void updategra(String stuid2, String cno2, int stugrade2, double stupoint2) {
// TODO Auto-generated method stub
try {
ps = conn.prepareStatement("update ɼ set Grade = ?, Point = ? where Sno = ? and Cno = ? ");
ps.setInt(1, stugrade2);
ps.setDouble(2, stupoint2);
ps.setString(3, stuid2);
ps.setString(4, cno2);
ps.executeUpdate();
JOptionPane.showMessageDialog(null, "ɼijɹ!", "ʾϢ", JOptionPane.INFORMATION_MESSAGE);
}catch(Exception e){
JOptionPane.showMessageDialog(null, "ʧ!", "ʾϢ", JOptionPane.ERROR_MESSAGE);
e.printStackTrace();
}
}
public static void query_gra(String stuid2) {
// TODO Auto-generated method stub
try {
ps = conn.prepareStatement("select * from γ,ɼ,ʦ where Sno = ? and γ.Cno = ɼ.Cno and γ.Cno = ʦ.Cno");
ps.setString(1, stuid2);
rs = ps.executeQuery();
counter = 0;
while(rs.next()){
c_name[counter] = rs.getString("Cname");
ct_name[counter] = rs.getString("Tname");
stu_grade[counter] = rs.getInt("Grade");
credit[counter] = rs.getDouble("Ccredit");
stu_point[counter] = rs.getDouble("Point");
counter++;
}
}catch(Exception e) {
e.printStackTrace();
}
}
public static void getdatacou() {
// TODO Auto-generated method stub
try {
ps = conn.prepareStatement("select * from γ ");
rs = ps.executeQuery();
counter = 0;
while(rs.next()){
c_no[counter] = rs.getString("Cno");
c_name[counter] = rs.getString("Cname");
credit[counter] = rs.getDouble("Ccredit");
counter++;
}
}catch (Exception e){
e.printStackTrace();
}
}
public static boolean querycou(String text) {
// TODO Auto-generated method stub
try {
ps = conn.prepareStatement("select Cno from γ where Cno = ?");
ps.setString(1, text);
rs = ps.executeQuery();
if(rs.next()){
return true;
}
}catch(Exception e){
e.printStackTrace();
}
return false;
}
public static void insertcou(String cno2, String cname2, double stucredit2) {
// TODO Auto-generated method stub
try{
ps = conn.prepareStatement("insert into γ values ('"+ cno2 +"','"+ cname2 +"','"+stucredit2+"')");
ps.executeUpdate();
JOptionPane.showMessageDialog(null, "γϢӳɹ!", "ʾϢ", JOptionPane.INFORMATION_MESSAGE);
}catch(Exception e){
e.printStackTrace();
JOptionPane.showMessageDialog(null, "γϢʧ!", "ʾϢ", JOptionPane.INFORMATION_MESSAGE);
}
}
public static void updatecou(String cno2, String cname2, double stucredit2) {
// TODO Auto-generated method stub
try{
ps = conn.prepareStatement("update γ set Cname = ?, Ccredit = ? where Cno = ?");
ps.setString(1, cname2);
ps.setDouble(2, stucredit2);
ps.setString(3, cno2);
ps.executeUpdate();
JOptionPane.showMessageDialog(null, "γϢijɹ!", "ʾϢ", JOptionPane.INFORMATION_MESSAGE);
}catch(Exception e){
e.printStackTrace();
JOptionPane.showMessageDialog(null, "γϢʧ!", "ʾϢ", JOptionPane.INFORMATION_MESSAGE);
}
}
public static void deletecou(String cno2) {
// TODO Auto-generated method stub
try {
ps = conn.prepareStatement("delete from γ where Cno = ?");
ps.setString(1, cno2);
ps.execute();
JOptionPane.showMessageDialog(null, "γɾɹ!", "ʾϢ", JOptionPane.INFORMATION_MESSAGE);
}catch(Exception e){
e.printStackTrace();
JOptionPane.showMessageDialog(null, "γɾʧ!", "ʾϢ", JOptionPane.INFORMATION_MESSAGE);
}
}
public static void getdatacou(String cname2) {
// TODO Auto-generated method stub
try {
ps = conn.prepareStatement("select Cno from γ where Cname = ?");
//System.out.println("cname"+cname2);
ps.setString(1, cname2);
rs = ps.executeQuery();
if(rs.next()){
//System.out.println("found");
cno = rs.getString("Cno");
}
}catch (Exception e){
e.printStackTrace();
}
}
}
================================================
FILE: src/SMIS/QueryCou.java
================================================
package ѧϢϵͳ;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import java.awt.Font;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class QueryCou extends JFrame {
private JTable table;
public QueryCou() {
getContentPane().setLayout(null);
JScrollPane scrollPane = new JScrollPane();
scrollPane.setBounds(54, 148, 525, 180);
getContentPane().add(scrollPane);
table = new JTable();
table.setRowHeight(30);
table.setModel(new DefaultTableModel(
new Object[][] {
{null, null, null},
{null, null, null},
{null, null, null},
{null, null, null},
{null, null, null},
},
new String[] {
"\u8BFE\u7A0B\u540D", "\u8BFE\u7A0B\u53F7", "\u5B66\u5206"
}
));
table.getColumnModel().getColumn(0).setPreferredWidth(100);
scrollPane.setViewportView(table);
MysqlConn.ConnectSQL();
MysqlConn.getdatacou();
if(MysqlConn.counter == 0){
JOptionPane.showMessageDialog(null, "γ̻δ!", "ʾϢ", JOptionPane.ERROR_MESSAGE);
}
for(int i = 0; i < MysqlConn.counter; i++){
table.setValueAt(MysqlConn.c_name[i], i, 0);
table.setValueAt(MysqlConn.c_no[i], i, 1);
table.setValueAt(MysqlConn.credit[i], i, 2);
}
JLabel label = new JLabel("\u6240\u6709\u8BFE\u7A0B\u4FE1\u606F\u5982\u4E0B\uFF1A");
label.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
label.setBounds(235, 76, 164, 45);
getContentPane().add(label);
JButton button = new JButton("\u8FD4\u56DE");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
Cou co = new Cou();
}
});
button.setBounds(199, 367, 89, 36);
getContentPane().add(button);
JButton button_1 = new JButton("\u9000\u51FA");
button_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
button_1.setBounds(362, 367, 89, 36);
getContentPane().add(button_1);
//ñ
this.setTitle("ѧϢϵͳ-Ա-ѯγϢ");
//ôС
this.setSize(650,520);
//ôʼλ
this.setLocation(200, 150);
//õرմʱ֤JVMҲ˳
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//ʾ
this.setVisible(true);
//Сɱ
this.setResizable(true);
}
}
================================================
FILE: src/SMIS/QueryGra.java
================================================
package ѧϢϵͳ;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import java.awt.BorderLayout;
import java.awt.Font;
import javax.swing.JTextField;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
import javax.swing.JScrollPane;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class QueryGra extends JFrame {
private JTable table;
public QueryGra() {
getContentPane().setLayout(null);
JLabel label = new JLabel("");
label.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
label.setBounds(172, 64, 152, 32);
getContentPane().add(label);
label.setText(MysqlConn.cname);
MysqlConn.ConnectSQL();
MysqlConn.getdatatea(MysqlConn.userword);
MysqlConn.querygra(MysqlConn.cname);
JLabel label_1 = new JLabel("\u7684\u6240\u6709\u5B66\u751F\u6210\u7EE9\u5982\u4E0B\uFF1A");
label_1.setBounds(330, 64, 190, 32);
label_1.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
getContentPane().add(label_1);
JScrollPane scrollPane = new JScrollPane();
scrollPane.setBounds(35, 128, 568, 152);
getContentPane().add(scrollPane);
table = new JTable();
table.setModel(new DefaultTableModel(
new Object[][] {
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
},
new String[] {
"\u5B66\u53F7", "\u59D3\u540D", "\u6210\u7EE9", "\u7EE9\u70B9"
}
));
scrollPane.setViewportView(table);
table.setRowHeight(30);
for(int i = 0; i < MysqlConn.counter; i++){
table.setValueAt(MysqlConn.stu_id[i], i, 0);
table.setValueAt(MysqlConn.stu_name[i], i, 1);
table.setValueAt(MysqlConn.stu_grade[i], i, 2);
table.setValueAt(MysqlConn.stu_point[i], i, 3);
}
if(MysqlConn.counter == 0){
JOptionPane.showMessageDialog(null, "ÿγʱûгɼ!", "ʾϢ", JOptionPane.ERROR_MESSAGE);
}
JButton button = new JButton("\u8FD4\u56DE");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
Teacher t = new Teacher();
}
});
button.setBounds(165, 339, 104, 39);
getContentPane().add(button);
JButton button_1 = new JButton("\u9000\u51FA");
button_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
button_1.setBounds(341, 339, 104, 39);
getContentPane().add(button_1);
this.setTitle("ѧϢϵͳ-ʦ-ѯѧɼ");
//ôС
this.setSize(650,520);
//ôʼλ
this.setLocation(200, 150);
//õرմʱ֤JVMҲ˳
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//ʾ
this.setVisible(true);
//Сɱ
this.setResizable(true);
}
}
================================================
FILE: src/SMIS/QueryStu.java
================================================
package ѧϢϵͳ;
import javax.swing.*;
import javax.swing.table.DefaultTableModel;
import java.awt.Font;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class QueryStu extends JFrame{
private JTable table;
private JTable table_1;
public QueryStu() {
getContentPane().setLayout(null);
JPanel panel_1 = new JPanel();
panel_1.setBounds(0, 34, 882, 226);
getContentPane().add(panel_1);
panel_1.setLayout(null);
JLabel label_1 = new JLabel("\u6240\u6709\u5B66\u751F\u4E2A\u4EBA\u4FE1\u606F");
label_1.setBounds(365, 15, 151, 24);
panel_1.add(label_1);
label_1.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
JScrollPane scrollPane = new JScrollPane();
scrollPane.setBounds(0, 52, 882, 152);
panel_1.add(scrollPane);
table = new JTable();
table.setRowHeight(30);
scrollPane.setViewportView(table);
table.setModel(new DefaultTableModel(
new Object[][] {
{null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null},
},
new String[] {
"\u5B66\u53F7", "\u59D3\u540D", "\u6027\u522B", "\u51FA\u751F\u5E74\u6708", "\u7535\u8BDD", "\u5B66\u9662", "\u73ED\u7EA7", "\u5BB6\u5EAD\u5730\u5740"
}
));
table.getColumnModel().getColumn(5).setPreferredWidth(100);
JPanel panel_2 = new JPanel();
panel_2.setBounds(156, 286, 642, 295);
getContentPane().add(panel_2);
panel_2.setLayout(null);
JScrollPane scrollPane_1 = new JScrollPane();
scrollPane_1.setBounds(0, 37, 642, 242);
panel_2.add(scrollPane_1);
table_1 = new JTable();
table_1.setRowHeight(30);
scrollPane_1.setViewportView(table_1);
table_1.setModel(new DefaultTableModel(
new Object[][] {
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
},
new String[] {
"\u59D3\u540D", "\u8BFE\u7A0B", "\u4EFB\u8BFE\u6559\u5E08", "\u6210\u7EE9", "\u7EE9\u70B9", "\u5B66\u5206"
}
));
MysqlConn.ConnectSQL();
MysqlConn.getdatastu();
if(MysqlConn.counter == 0){
JOptionPane.showMessageDialog(null, "ѧϢδ!", "ʾϢ", JOptionPane.ERROR_MESSAGE);
}
for(int i = 0; i < MysqlConn.counter; i++){
table.setValueAt(MysqlConn.stu_id[i], i, 0);
table.setValueAt(MysqlConn.stu_name[i], i, 1);
table.setValueAt(MysqlConn.stu_sex[i], i, 2);
table.setValueAt(MysqlConn.stu_birth[i], i, 3);
table.setValueAt(MysqlConn.stu_tel[i], i, 4);
table.setValueAt(MysqlConn.stu_academy[i], i, 5);
table.setValueAt(MysqlConn.stu_class[i], i, 6);
table.setValueAt(MysqlConn.stu_add[i], i, 7);
}
MysqlConn.getdatagra();
if(MysqlConn.counter == 0){
JOptionPane.showMessageDialog(null, "ѧɼδ!", "ʾϢ", JOptionPane.ERROR_MESSAGE);
}
for(int i = 0; i < MysqlConn.counter; i++){
table_1.setValueAt(MysqlConn.stu_name[i], i, 0);
table_1.setValueAt(MysqlConn.c_name[i], i, 1);
table_1.setValueAt(MysqlConn.ct_name[i], i, 2);
table_1.setValueAt(MysqlConn.stu_grade[i], i, 3);
table_1.setValueAt(MysqlConn.stu_point[i], i, 4);
table_1.setValueAt(MysqlConn.credit[i], i, 5);
}
JLabel label_2 = new JLabel("\u6240\u6709\u5B66\u751F\u6210\u7EE9\u4FE1\u606F");
label_2.setBounds(201, 0, 167, 34);
panel_2.add(label_2);
label_2.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
JButton button = new JButton("\u8FD4\u56DE");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
Stu st = new Stu();
}
});
button.setBounds(329, 603, 85, 37);
getContentPane().add(button);
JButton button_1 = new JButton("\u9000\u51FA");
button_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
button_1.setBounds(520, 603, 85, 37);
getContentPane().add(button_1);
this.setTitle("ѧϢϵͳ-Ա-ѯѧϢ");
//ôС
this.setSize(900,700);
//ôʼλ
this.setLocation(200, 150);
//õرմʱ֤JVMҲ˳
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//ʾ
this.setVisible(true);
//Сɱ
this.setResizable(true);
}
}
================================================
FILE: src/SMIS/QueryTea.java
================================================
package ѧϢϵͳ;
import javax.swing.*;
import java.awt.BorderLayout;
import java.awt.Font;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.table.DefaultTableModel;
public class QueryTea extends JFrame {
private JTable table;
public QueryTea() {
getContentPane().setLayout(null);
JLabel label = new JLabel("\u6240\u6709\u6559\u5E08\u4FE1\u606F");
label.setBounds(254, 88, 123, 42);
label.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
getContentPane().add(label);
JScrollPane scrollPane = new JScrollPane();
scrollPane.setBounds(29, 164, 574, 150);
getContentPane().add(scrollPane);
table = new JTable();
table.setRowHeight(30);
table.setModel(new DefaultTableModel(
new Object[][] {
{null, null, null, null, null},
{null, null, null, null, null},
{null, null, null, null, null},
{null, null, null, null, null},
},
new String[] {
"\u6559\u5E08\u53F7", "\u59D3\u540D", "\u51FA\u751F\u5E74\u6708", "\u804C\u79F0", "\u6240\u6559\u8BFE\u7A0B"
}
));
scrollPane.setViewportView(table);
MysqlConn.ConnectSQL();
MysqlConn.getdatatea();
if(MysqlConn.counter == 0){
JOptionPane.showMessageDialog(null, "ʦϢδ!", "ʾϢ", JOptionPane.ERROR_MESSAGE);
}
for(int i = 0; i < MysqlConn.counter; i++){
table.setValueAt(MysqlConn.tea_id[i], i, 0);
table.setValueAt(MysqlConn.tea_name[i], i, 1);
table.setValueAt(MysqlConn.tea_birth[i], i, 2);
table.setValueAt(MysqlConn.tea_protitle[i], i, 3);
table.setValueAt(MysqlConn.c_name[i], i, 4);
}
JButton button_1 = new JButton("\u8FD4\u56DE");
button_1.setBounds(207, 351, 79, 34);
getContentPane().add(button_1);
JButton button_2 = new JButton("\u9000\u51FA");
button_2.setBounds(340, 351, 79, 34);
getContentPane().add(button_2);
button_2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
button_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
Tea te = new Tea();
}
});
this.setTitle("ѧϢϵͳ-Ա-ѯʦϢ");
//ôС
this.setSize(650,520);
//ôʼλ
this.setLocation(200, 150);
//õرմʱ֤JVMҲ˳
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//ʾ
this.setVisible(true);
//Сɱ
this.setResizable(true);
}
}
================================================
FILE: src/SMIS/Stu.java
================================================
package ѧϢϵͳ;
import javax.swing.*;
import java.awt.BorderLayout;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.Color;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
//ѯ롢ġɾѧϢ
public class Stu extends JFrame{
public Stu() {
getContentPane().setLayout(null);
JPanel panel = new JPanel();
panel.setBounds(151, 27, 330, 305);
getContentPane().add(panel);
panel.setLayout(null);
JLabel label = new JLabel("\u8BF7\u9009\u62E9\u60A8\u8981\u8FDB\u884C\u7684\u64CD\u4F5C");
label.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
label.setBounds(69, 13, 191, 41);
panel.add(label);
JButton button = new JButton("\u67E5\u8BE2\u5B66\u751F\u4FE1\u606F");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
QueryStu qs = new QueryStu();
}
});
button.setBounds(91, 67, 143, 50);
panel.add(button);
JButton button_1 = new JButton("\u63D2\u5165\u5B66\u751F\u4FE1\u606F");
button_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
InsertStu is = new InsertStu();
}
});
button_1.setBounds(91, 128, 143, 50);
panel.add(button_1);
JButton button_2 = new JButton("\u4FEE\u6539\u5B66\u751F\u4FE1\u606F");
button_2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
String s = null;
InsertStu us = new InsertStu(s);
}
});
button_2.setBounds(91, 185, 143, 50);
panel.add(button_2);
JButton button_3 = new JButton("\u5220\u9664\u5B66\u751F\u4FE1\u606F");
button_3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
Delete ds = new Delete();
}
});
button_3.setBounds(91, 242, 143, 50);
panel.add(button_3);
JPanel panel_1 = new JPanel();
panel_1.setBounds(179, 367, 272, 49);
getContentPane().add(panel_1);
panel_1.setLayout(null);
JButton button_4 = new JButton("\u8FD4\u56DE");
button_4.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
Admin ad = new Admin();
}
});
button_4.setBounds(41, 5, 76, 40);
panel_1.add(button_4);
JButton button_5 = new JButton("\u9000\u51FA");
button_5.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
button_5.setBounds(146, 5, 76, 40);
panel_1.add(button_5);
//ñ
this.setTitle("ѧϢϵͳ-Ա");
//ôС
this.setSize(650,520);
//ôʼλ
this.setLocation(200, 150);
//õرմʱ֤JVMҲ˳
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//ʾ
this.setVisible(true);
//Сɱ
this.setResizable(true);
}
}
================================================
FILE: src/SMIS/Student.java
================================================
package ѧϢϵͳ;
import javax.swing.JFrame;
import javax.swing.JButton;
import java.awt.BorderLayout;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
import javax.swing.JLabel;
import java.awt.Font;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JTextArea;
import javax.swing.JFormattedTextField;
public class Student extends JFrame {
private JTable table;
public Student() {
getContentPane().setLayout(null);
JButton btnNewButton = new JButton("\u67E5\u6210\u7EE9");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
MysqlConn.ConnectSQL();
MysqlConn.getdatastu(MysqlConn.userword);
MysqlConn.query_gra(MysqlConn.stuid);
for(int i = 0; i < MysqlConn.counter; i++){
table.setValueAt(MysqlConn.c_name[i], i, 0);
table.setValueAt(MysqlConn.stu_grade[i], i, 1);
table.setValueAt(MysqlConn.credit[i], i, 2);
table.setValueAt(MysqlConn.stu_point[i], i, 3);
}
JLabel label_2 = new JLabel("");
label_2.setBounds(351, 380, 79, 37);
getContentPane().add(label_2);
String s = "" + Calculate.calculatecre(MysqlConn.credit);
label_2.setText(s);
JLabel label_3 = new JLabel("");
label_3.setBounds(351, 423, 79, 37);
getContentPane().add(label_3);
String s1 = "" + Calculate.calculateGPA(MysqlConn.credit,MysqlConn.stu_point);
label_3.setText(s1);
}
});
btnNewButton.setBounds(161, 162, 97, 37);
getContentPane().add(btnNewButton);
JScrollPane scrollPane = new JScrollPane();
scrollPane.setBounds(39, 212, 560, 152);
getContentPane().add(scrollPane);
table = new JTable();
table.setModel(new DefaultTableModel(
new Object[][] {
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
},
new String[] {
"\u8BFE\u7A0B", "\u6210\u7EE9", "\u5B66\u5206", "\u7EE9\u70B9"
}
));
table.setRowHeight(30);
scrollPane.setViewportView(table);
JLabel label = new JLabel("\u603B\u5B66\u5206\uFF1A");
label.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
label.setBounds(250, 377, 87, 40);
getContentPane().add(label);
JLabel label_1 = new JLabel("\u5E73\u5747\u7EE9\u70B9\uFF1A");
label_1.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
label_1.setBounds(240, 420, 97, 40);
getContentPane().add(label_1);
JButton button = new JButton("\u9000\u51FA");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
button.setBounds(383, 162, 97, 37);
getContentPane().add(button);
JLabel label_4 = new JLabel("\u6B22\u8FCE\u767B\u5F55\u5B66\u751F\u4FE1\u606F\u7BA1\u7406\u7CFB\u7EDF\uFF01");
label_4.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 46));
label_4.setBounds(14, 29, 604, 117);
getContentPane().add(label_4);
JButton button_1 = new JButton("\u8FD4\u56DE");
button_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
Login l = new Login();
}
});
button_1.setBounds(272, 162, 97, 37);
getContentPane().add(button_1);
this.setTitle("ѧϢϵͳ-ѧ");
//ôС
this.setSize(650,520);
//ôʼλ
this.setLocation(200, 150);
//õرմʱ֤JVMҲ˳
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//ʾ
this.setVisible(true);
//Сɱ
this.setResizable(true);
}
}
================================================
FILE: src/SMIS/Tea.java
================================================
package ѧϢϵͳ;
import javax.swing.*;
import java.awt.BorderLayout;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.Font;
public class Tea extends JFrame {
public Tea() {
getContentPane().setLayout(null);
JPanel panel = new JPanel();
panel.setBounds(153, 71, 314, 287);
getContentPane().add(panel);
panel.setLayout(null);
JButton btnNewButton = new JButton("\u67E5\u8BE2\u6559\u5E08\u4FE1\u606F");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
QueryTea qt =new QueryTea();
}
});
btnNewButton.setBounds(35, 34, 246, 47);
panel.add(btnNewButton);
JButton button = new JButton("\u63D2\u5165\u6559\u5E08\u4FE1\u606F");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
InsertTea it = new InsertTea();
}
});
button.setBounds(35, 94, 246, 47);
panel.add(button);
JButton button_1 = new JButton("\u4FEE\u6539\u6559\u5E08\u4FE1\u606F");
button_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
UpdateTea ut = new UpdateTea();
}
});
button_1.setBounds(35, 153, 246, 47);
panel.add(button_1);
JButton button_2 = new JButton("\u5220\u9664\u6559\u5E08\u4FE1\u606F");
button_2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
Delete dt = new Delete();
}
});
button_2.setBounds(35, 210, 246, 47);
panel.add(button_2);
JLabel label = new JLabel("\u8BF7\u9009\u62E9\u60A8\u8981\u8FDB\u884C\u7684\u64CD\u4F5C\uFF1A");
label.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
label.setBounds(212, 25, 203, 33);
getContentPane().add(label);
JPanel panel_1 = new JPanel();
panel_1.setBounds(153, 372, 314, 49);
getContentPane().add(panel_1);
panel_1.setLayout(null);
JButton button_3 = new JButton("\u8FD4\u56DE");
button_3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
Admin ad = new Admin();
}
});
button_3.setBounds(63, 5, 76, 40);
panel_1.add(button_3);
JButton button_4 = new JButton("\u9000\u51FA\r\n");
button_4.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
button_4.setBounds(186, 5, 76, 40);
panel_1.add(button_4);
//ñ
this.setTitle("ѧϢϵͳ-Ա");
//ôС
this.setSize(650,520);
//ôʼλ
this.setLocation(200, 150);
//õرմʱ֤JVMҲ˳
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//ʾ
this.setVisible(true);
//Сɱ
this.setResizable(true);
}
}
================================================
FILE: src/SMIS/Teacher.java
================================================
package ѧϢϵͳ;
import javax.swing.JFrame;
import javax.swing.JLabel;
import java.awt.BorderLayout;
import java.awt.Font;
import javax.swing.JPanel;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class Teacher extends JFrame {
public Teacher() {
getContentPane().setLayout(null);
JPanel panel = new JPanel();
panel.setBounds(147, 132, 350, 231);
getContentPane().add(panel);
panel.setLayout(null);
JLabel lblNewLabel = new JLabel("\u8BF7\u9009\u62E9\u60A8\u8981\u8FDB\u884C\u7684\u64CD\u4F5C\uFF1A");
lblNewLabel.setBounds(76, 5, 198, 34);
panel.add(lblNewLabel);
lblNewLabel.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
JButton button = new JButton("\u67E5\u8BE2\u5B66\u751F\u6210\u7EE9");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
QueryGra qg = new QueryGra();
}
});
button.setBounds(88, 62, 169, 39);
panel.add(button);
JButton button_1 = new JButton("\u5F55\u5165\u5B66\u751F\u6210\u7EE9");
button_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
InsertGra ig = new InsertGra();
}
});
button_1.setBounds(89, 113, 169, 39);
panel.add(button_1);
JButton button_2 = new JButton("\u4FEE\u6539\u5B66\u751F\u6210\u7EE9");
button_2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
String s = null;
InsertGra ig = new InsertGra(s);
}
});
button_2.setBounds(88, 167, 169, 39);
panel.add(button_2);
JButton button_4 = new JButton("\u9000\u51FA");
button_4.setBounds(337, 398, 85, 39);
getContentPane().add(button_4);
JLabel label = new JLabel("\u6B22\u8FCE\u767B\u5F55\u5B66\u751F\u4FE1\u606F\u7BA1\u7406\u7CFB\u7EDF\uFF01");
label.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 46));
label.setBounds(14, 35, 604, 62);
getContentPane().add(label);
JButton button_3 = new JButton("\u8FD4\u56DE");
button_3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
Login l = new Login();
}
});
button_3.setBounds(216, 398, 85, 39);
getContentPane().add(button_3);
this.setTitle("ѧϢϵͳ-ʦ");
//ôС
this.setSize(650,520);
//ôʼλ
this.setLocation(200, 150);
//õرմʱ֤JVMҲ˳
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//ʾ
this.setVisible(true);
//Сɱ
this.setResizable(true);
}
}
================================================
FILE: src/SMIS/Transform.java
================================================
package ѧϢϵͳ;
import java.sql.Date;
import java.text.SimpleDateFormat;
public class Transform {
public static String DateTostr(Date d){
String sdate = null;
sdate=(new SimpleDateFormat("yyyy-MM-dd")).format(d);
return sdate;
}
public static java.sql.Date strToDate(String strDate) {
String str = strDate;
SimpleDateFormat format = new SimpleDateFormat("yyyy-mm-dd");
java.util.Date d = null;
try {
d = format.parse(str);
} catch (Exception e) {
e.printStackTrace();
}
java.sql.Date date = new java.sql.Date(d.getTime());
return date;
}
}
================================================
FILE: src/SMIS/UpdateStu.java
================================================
package ѧϢϵͳ;
import javax.swing.*;
import java.awt.BorderLayout;
import java.awt.Font;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class UpdateStu extends JFrame {
private JTextField textField;
private JTextField textField_2;
public UpdateStu() {
getContentPane().setLayout(null);
JPanel panel = new JPanel();
panel.setBounds(190, 27, 231, 85);
getContentPane().add(panel);
panel.setLayout(null);
JLabel label = new JLabel("\u8BF7\u8F93\u5165\u60A8\u8981\u4FEE\u6539\u7684\u5B66\u751F\u5B66\u53F7\uFF1A");
label.setBounds(0, 0, 241, 39);
panel.add(label);
label.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
textField = new JTextField();
textField.setBounds(0, 43, 231, 33);
panel.add(textField);
textField.setColumns(10);
JPanel panel_1 = new JPanel();
panel_1.setBounds(190, 143, 231, 103);
getContentPane().add(panel_1);
panel_1.setLayout(null);
JLabel label_1 = new JLabel("\u8BF7\u9009\u62E9\u60A8\u8981\u4FEE\u6539\u7684\u5C5E\u6027\uFF1A");
label_1.setBounds(19, 13, 198, 32);
panel_1.add(label_1);
label_1.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
JComboBox comboBox = new JComboBox();
comboBox.setModel(new DefaultComboBoxModel(new String[] {"ID", "Sname", "Ssex", "Sbirth", "Stel", "Sacademy", "Sclass", "Saddress"}));
comboBox.setBounds(45, 58, 152, 32);
panel_1.add(comboBox);
JPanel panel_2 = new JPanel();
panel_2.setBounds(190, 284, 231, 79);
getContentPane().add(panel_2);
panel_2.setLayout(null);
JLabel label_2 = new JLabel("\u8BF7\u8F93\u5165\u65B0\u6570\u636E\uFF1A");
label_2.setBounds(51, 0, 126, 37);
panel_2.add(label_2);
label_2.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
textField_2 = new JTextField();
textField_2.setBounds(51, 36, 126, 33);
panel_2.add(textField_2);
textField_2.setColumns(10);
JPanel panel_3 = new JPanel();
panel_3.setBounds(111, 388, 393, 39);
getContentPane().add(panel_3);
JButton button = new JButton("\u786E\u5B9A");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
MysqlConn.ConnectSQL();
if(textField.getText().isEmpty()){
JOptionPane.showMessageDialog(null,"ѧ!","ʾϢ",JOptionPane.WARNING_MESSAGE);
}else if(!JudgeNum.judge(textField.getText(), textField.getText().length())){
JOptionPane.showMessageDialog(null, "ѧŽɣѧʽ!\n", "ʾϢ", JOptionPane.ERROR_MESSAGE);
}else if(!MysqlConn.querystu(textField.getText())){
JOptionPane.showMessageDialog(null,"ѧѧŲ!\n","ʾϢ",JOptionPane.ERROR_MESSAGE);
}else if(textField_2.getText().isEmpty()){
JOptionPane.showMessageDialog(null,"!","ʾϢ",JOptionPane.WARNING_MESSAGE);
}else{
MysqlConn.stuid = textField.getText();
String s = (String) comboBox.getSelectedItem();//Ҫĵ
String s1 = textField_2.getText();//ֵ
/*//s1Ӧм
if(s.equals("ID")){
if(!JudgeNum.judge(s1, s1.length())){
JOptionPane.showMessageDialog(null, "ѧŽɣѧʽ!\n", "ʾϢ", JOptionPane.ERROR_MESSAGE);
}else{
MysqlConn.updatestu(MysqlConn.stuid,s,s1);
}
}else if(s.equals("Stel")){
if(!JudgeNum.judge(s1, s1.length())){
JOptionPane.showMessageDialog(null, "绰ɣĺʽ!\n", "ʾϢ", JOptionPane.ERROR_MESSAGE);
}else{
MysqlConn.updatestu(MysqlConn.stuid,s,s1);
}
}else{
MysqlConn.updatestu(MysqlConn.stuid,s,s1);
}*/
}
}
});
panel_3.add(button);
JButton button_1 = new JButton("\u91CD\u7F6E");
button_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
textField.setText("");
textField_2.setText("");
}
});
panel_3.add(button_1);
JButton button_2 = new JButton("\u8FD4\u56DE");
button_2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
Stu st = new Stu();
}
});
panel_3.add(button_2);
JButton button_3 = new JButton("\u9000\u51FA");
button_3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
panel_3.add(button_3);
this.setTitle("ѧϢϵͳ-Ա-ѧϢ");
//ôС
this.setSize(650,520);
//ôʼλ
this.setLocation(200, 150);
//õرմʱ֤JVMҲ˳
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//ʾ
this.setVisible(true);
//Сɱ
this.setResizable(true);
}
}
================================================
FILE: src/SMIS/UpdateTea.java
================================================
package ѧϢϵͳ;
import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import java.awt.Font;
import javax.swing.JTextField;
import javax.swing.JComboBox;
import javax.swing.ButtonGroup;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JRadioButton;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.sql.Date;
import java.awt.event.ActionEvent;
public class UpdateTea extends JFrame {
private JTextField textField;
private JTextField textField_1;
public UpdateTea() {
getContentPane().setLayout(null);
JLabel lblNewLabel = new JLabel("\u6559\u5E08\u53F7\uFF1A");
lblNewLabel.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
lblNewLabel.setBounds(194, 57, 78, 37);
getContentPane().add(lblNewLabel);
textField = new JTextField();
textField.setBounds(297, 61, 150, 33);
getContentPane().add(textField);
textField.setColumns(10);
JLabel label = new JLabel("\u59D3\u540D\uFF1A");
label.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
label.setBounds(211, 120, 59, 39);
getContentPane().add(label);
JComboBox comboBox = new JComboBox();
comboBox.setBounds(288, 180, 80, 37);
getContentPane().add(comboBox);
for(int i = 1960; i<= 2010; i++){
comboBox.addItem(""+i);
}
textField_1 = new JTextField();
textField_1.setBounds(297, 124, 146, 33);
getContentPane().add(textField_1);
textField_1.setColumns(10);
JLabel label_1 = new JLabel("\u51FA\u751F\u5E74\u6708\uFF1A");
label_1.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
label_1.setBounds(171, 182, 101, 37);
getContentPane().add(label_1);
JComboBox comboBox_1 = new JComboBox();
comboBox_1.setBounds(372, 180, 66, 37);
getContentPane().add(comboBox_1);
for(int i = 1; i <= 12;i++){
comboBox_1.addItem(""+i);
}
JComboBox comboBox_2 = new JComboBox();
comboBox_2.setBounds(442, 180, 61, 37);
getContentPane().add(comboBox_2);
for(int i = 1; i <= 31;i++){
comboBox_2.addItem(""+i);
}
JLabel label_2 = new JLabel("\u804C\u79F0\uFF1A");
label_2.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
label_2.setBounds(210, 247, 59, 37);
getContentPane().add(label_2);
JRadioButton radioButton = new JRadioButton("\u6559\u6388");
radioButton.setBounds(279, 252, 71, 33);
getContentPane().add(radioButton);
if(radioButton.getText().toString().equals(MysqlConn.protitle))
radioButton.setSelected(true);
JRadioButton radioButton_1 = new JRadioButton("\u526F\u6559\u6388");
radioButton_1.setBounds(348, 252, 79, 33);
getContentPane().add(radioButton_1);
if(radioButton_1.getText().toString().equals(MysqlConn.protitle))
radioButton_1.setSelected(true);
JRadioButton radioButton_2 = new JRadioButton("\u8BB2\u5E08");
radioButton_2.setBounds(433, 252, 79, 33);
getContentPane().add(radioButton_2);
if(radioButton_2.getText().toString().equals(MysqlConn.protitle))
radioButton_2.setSelected(true);
ButtonGroup bg = new ButtonGroup();
bg.add(radioButton);
bg.add(radioButton_1);
bg.add(radioButton_2);
JLabel label_3 = new JLabel("\u6240\u6559\u8BFE\u7A0B\u53F7\uFF1A");
label_3.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
label_3.setBounds(162, 308, 113, 37);
getContentPane().add(label_3);
JComboBox comboBox_3 = new JComboBox();
//comboBox_3.setModel(new DefaultComboBoxModel(new String[] {"00256320", "00256321", "00256401", "00256530"}));
comboBox_3.setBounds(291, 308, 149, 32);
getContentPane().add(comboBox_3);
MysqlConn.ConnectSQL();
MysqlConn.getdatacou();
for(int i = 0; i < MysqlConn.counter; i++){
comboBox_3.addItem(MysqlConn.c_name[i]);
}
JButton button = new JButton("\u786E\u5B9A");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
MysqlConn.ConnectSQL();
if(textField.getText().isEmpty()){
JOptionPane.showMessageDialog(null,"ʦ!","ʾϢ",JOptionPane.WARNING_MESSAGE);
}else if(!JudgeNum.judge(textField.getText(), textField.getText().length())){
JOptionPane.showMessageDialog(null, "ʦŽɣĽʦʽ!\n", "ʾϢ", JOptionPane.ERROR_MESSAGE);
}else if(!MysqlConn.querytea(textField.getText())){
JOptionPane.showMessageDialog(null,"ĽʦýʦŲ!\n","ʾϢ",JOptionPane.ERROR_MESSAGE);
}else if(textField_1.getText().isEmpty()){
JOptionPane.showMessageDialog(null,"!","ʾϢ",JOptionPane.WARNING_MESSAGE);
}else{
MysqlConn.teaid = textField.getText();
MysqlConn.teaname = textField_1.getText();
MysqlConn.teabirth = Transform.strToDate((String) comboBox.getSelectedItem() +"-"+ (String) comboBox_1.getSelectedItem() +"-"+ (String) comboBox_2.getSelectedItem());
if(radioButton.isSelected()){
MysqlConn.protitle = "";
}else if(radioButton_1.isSelected()){
MysqlConn.protitle = "";
}else{
MysqlConn.protitle = "ʦ";
}
MysqlConn.cname = (String) comboBox_3.getSelectedItem();
MysqlConn.getdatacou(MysqlConn.cname);
MysqlConn.updatetea(MysqlConn.teaid,MysqlConn.teaname,MysqlConn.teabirth,MysqlConn.protitle,MysqlConn.cno);
}
}
});
button.setBounds(191, 376, 80, 35);
getContentPane().add(button);
JButton button_1 = new JButton("\u8FD4\u56DE");
button_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
Tea te = new Tea();
}
});
button_1.setBounds(278, 376, 80, 35);
getContentPane().add(button_1);
JButton button_2 = new JButton("\u9000\u51FA");
button_2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
button_2.setBounds(368, 376, 80, 35);
getContentPane().add(button_2);
JButton button_3 = new JButton("\u786E\u8BA4");
button_3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
MysqlConn.ConnectSQL();
if(textField.getText().isEmpty()){
JOptionPane.showMessageDialog(null,"ʦ!","ʾϢ",JOptionPane.WARNING_MESSAGE);
}else if(!MysqlConn.querytea(textField.getText())){
JOptionPane.showMessageDialog(null,"ĽʦýʦŲ!\n","ʾϢ",JOptionPane.ERROR_MESSAGE);
}else{
textField.setEditable(false);
MysqlConn.getdatatea(textField.getText());
textField_1.setText(MysqlConn.teaname);
}
}
});
button_3.setBounds(467, 59, 80, 37);
getContentPane().add(button_3);
this.setTitle("ѧϢϵͳ-Ա-ĽʦϢ");
//ôС
this.setSize(650,520);
//ôʼλ
this.setLocation(200, 150);
//õرմʱ֤JVMҲ˳
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//ʾ
this.setVisible(true);
//Сɱ
this.setResizable(true);
}
}
================================================
FILE: 学生信息管理系统.txt
================================================
DROP TABLE 管理员;
CREATE TABLE 管理员(
ID VARCHAR(12) PRIMARY KEY,
password VARCHAR(12) NOT NULL
);
DROP TABLE 学生;
CREATE TABLE 学生(
ID VARCHAR(12) PRIMARY KEY,
Sname VARCHAR(20) NOT NULL,
Ssex VARCHAR(2) NOT NULL,
Sbirth DATE,
Stel VARCHAR(15) UNIQUE,
Sacademy VARCHAR(20) NOT NULL,
Sclass VARCHAR(20) NOT NULL,
Saddress VARCHAR(30) NOT NULL,
CHECK (Ssex='男' OR Ssex='女'),
CHECK (Sacademy='计算机科学与技术学院' OR Sacademy='医学院'),
CHECK (Sclass='计科1501班' OR Sclass='计科1502班' OR Sclass='计科1401班' OR Sclass='信安1501班' OR Sclass='临床1501班')
);
DROP TABLE 教师;
CREATE TABLE 教师(
ID VARCHAR(12) PRIMARY KEY,
Tname VARCHAR(20) NOT NULL,
Tbirth DATE,
Tprotitle VARCHAR(6),
Cno VARCHAR(10),
CHECK (Tprotitle='教授' OR Tprotitle='副教授' OR Tprotitle='讲师'),
FOREIGN KEY(Cno) REFERENCES 课程(Cno)
);
DROP TABLE 课程;
CREATE TABLE 课程(
Cno VARCHAR(10) PRIMARY KEY,
Cname VARCHAR(40) NOT NULL,
Ccredit FLOAT(2,1),
CHECK (Cname='高等数学(一)' OR Cname='高等数学(二)' OR Cname='大学英语(一)' OR Cname='数据库系统概论')
);
//高等数学(一):00256320 高等数学(二):00256321 大学英语(一):00256401 数据库系统概论:00256530
DROP TABLE 成绩;
CREATE TABLE 成绩(
Sno VARCHAR(12),
Cno VARCHAR(10),
Grade SMALLINT(3),
Point FLOAT(2,1),
PRIMARY KEY(Sno,Cno),
FOREIGN KEY(Sno) REFERENCES 学生(ID),
FOREIGN KEY(Cno) REFERENCES 课程(Cno)
);
gitextract_a251zuhc/ ├── .gitignore ├── LICENSE ├── README.md ├── src/ │ └── SMIS/ │ ├── Admin.java │ ├── Calculate.java │ ├── Cou.java │ ├── Delete.java │ ├── InsertCou.java │ ├── InsertGra.java │ ├── InsertStu.java │ ├── InsertTea.java │ ├── JudgeNum.java │ ├── Login.java │ ├── MysqlConn.java │ ├── QueryCou.java │ ├── QueryGra.java │ ├── QueryStu.java │ ├── QueryTea.java │ ├── Stu.java │ ├── Student.java │ ├── Tea.java │ ├── Teacher.java │ ├── Transform.java │ ├── UpdateStu.java │ └── UpdateTea.java └── 学生信息管理系统.txt
SYMBOL INDEX (82 symbols across 22 files)
FILE: src/SMIS/Admin.java
class Admin (line 15) | public class Admin extends JFrame {
method Admin (line 22) | public Admin() {
FILE: src/SMIS/Calculate.java
class Calculate (line 5) | public class Calculate {
method calculatepoi (line 7) | public static double calculatepoi(int i){
method calculatecre (line 31) | public static double calculatecre(double c[]){
method calculateGPA (line 39) | public static double calculateGPA(double c[],double p[]){
FILE: src/SMIS/Cou.java
class Cou (line 11) | public class Cou extends JFrame {
method Cou (line 12) | public Cou() {
FILE: src/SMIS/Delete.java
class Delete (line 12) | public class Delete extends JFrame {
method Delete (line 14) | public Delete() {
FILE: src/SMIS/InsertCou.java
class InsertCou (line 14) | public class InsertCou extends JFrame {
method InsertCou (line 18) | public InsertCou() {
method InsertCou (line 133) | public InsertCou(String s) {
FILE: src/SMIS/InsertGra.java
class InsertGra (line 14) | public class InsertGra extends JFrame {
method InsertGra (line 17) | public InsertGra() {
method InsertGra (line 118) | public InsertGra(String s) {
FILE: src/SMIS/InsertStu.java
class InsertStu (line 12) | public class InsertStu extends JFrame {
method InsertStu (line 17) | public InsertStu() {
method InsertStu (line 219) | public InsertStu(String s) {
FILE: src/SMIS/InsertTea.java
class InsertTea (line 10) | public class InsertTea extends JFrame {
method InsertTea (line 13) | public InsertTea() {
FILE: src/SMIS/JudgeNum.java
class JudgeNum (line 3) | public class JudgeNum {
method judge (line 5) | public static boolean judge(String s,int len){
method judge (line 14) | public static boolean judge(String s){
FILE: src/SMIS/Login.java
class Login (line 7) | public class Login extends JFrame implements ActionListener {
method main (line 18) | public static void main(String[] args) {
method Login (line 23) | public Login()
method actionPerformed (line 97) | @Override
method clear (line 156) | public void clear()
method adminlogin (line 163) | public void adminlogin(){
method tealogin (line 190) | public void tealogin(){
method stulogin (line 217) | public void stulogin(){
FILE: src/SMIS/MysqlConn.java
class MysqlConn (line 9) | public class MysqlConn {
method ConnectSQL (line 71) | public static void ConnectSQL() {
method queryadm (line 83) | public static boolean queryadm(String id) {
method querytea (line 103) | public static boolean querytea(String id) {
method querystu (line 123) | public static boolean querystu(String id) {
method getdatastu (line 144) | public static void getdatastu() {
method getdatastu (line 171) | public static void getdatastu(String s) {
method getdatagra (line 195) | public static void getdatagra() {
method getdatatea (line 217) | public static void getdatatea(){
method getdatatea (line 237) | public static void getdatatea(String id) {
method insertstu (line 263) | public static void insertstu() {
method updatestu (line 278) | public static void updatestu(String stuid2,String stuname2,String stus...
method deletestu (line 302) | public static void deletestu(String stuid2) {
method inserttea (line 319) | public static void inserttea() {
method updatetea (line 335) | public static void updatetea(String teaid2, String teaname2, Date teab...
method deletetea (line 355) | public static void deletetea(String teaid2) {
method querygra (line 372) | public static void querygra(String cname2){
method insertgra (line 391) | public static void insertgra(String stuid2, String cno2, int stugrade2...
method querycou (line 406) | public static boolean querycou(String stuid2,String cname2){
method updategra (line 421) | public static void updategra(String stuid2, String cno2, int stugrade2...
method query_gra (line 438) | public static void query_gra(String stuid2) {
method getdatacou (line 459) | public static void getdatacou() {
method querycou (line 477) | public static boolean querycou(String text) {
method insertcou (line 493) | public static void insertcou(String cno2, String cname2, double stucre...
method updatecou (line 506) | public static void updatecou(String cno2, String cname2, double stucre...
method deletecou (line 522) | public static void deletecou(String cno2) {
method getdatacou (line 536) | public static void getdatacou(String cname2) {
FILE: src/SMIS/QueryCou.java
class QueryCou (line 15) | public class QueryCou extends JFrame {
method QueryCou (line 17) | public QueryCou() {
FILE: src/SMIS/QueryGra.java
class QueryGra (line 17) | public class QueryGra extends JFrame {
method QueryGra (line 19) | public QueryGra() {
FILE: src/SMIS/QueryStu.java
class QueryStu (line 10) | public class QueryStu extends JFrame{
method QueryStu (line 13) | public QueryStu() {
FILE: src/SMIS/QueryTea.java
class QueryTea (line 10) | public class QueryTea extends JFrame {
method QueryTea (line 12) | public QueryTea() {
FILE: src/SMIS/Stu.java
class Stu (line 12) | public class Stu extends JFrame{
method Stu (line 13) | public Stu() {
FILE: src/SMIS/Student.java
class Student (line 16) | public class Student extends JFrame {
method Student (line 18) | public Student() {
FILE: src/SMIS/Tea.java
class Tea (line 9) | public class Tea extends JFrame {
method Tea (line 10) | public Tea() {
FILE: src/SMIS/Teacher.java
class Teacher (line 12) | public class Teacher extends JFrame {
method Teacher (line 13) | public Teacher() {
FILE: src/SMIS/Transform.java
class Transform (line 6) | public class Transform {
method DateTostr (line 7) | public static String DateTostr(Date d){
method strToDate (line 13) | public static java.sql.Date strToDate(String strDate) {
FILE: src/SMIS/UpdateStu.java
class UpdateStu (line 9) | public class UpdateStu extends JFrame {
method UpdateStu (line 12) | public UpdateStu() {
FILE: src/SMIS/UpdateTea.java
class UpdateTea (line 20) | public class UpdateTea extends JFrame {
method UpdateTea (line 23) | public UpdateTea() {
Condensed preview — 26 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (146K chars).
[
{
"path": ".gitignore",
"chars": 272,
"preview": "# Compiled class file\n*.class\n\n# Log file\n*.log\n\n# BlueJ files\n*.ctxt\n\n# Mobile Tools for Java (J2ME)\n.mtj.tmp/\n\n# Packa"
},
{
"path": "LICENSE",
"chars": 14199,
"preview": "Eclipse Public License - v 2.0\n\n THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE\n PUBLIC LICE"
},
{
"path": "README.md",
"chars": 319,
"preview": "# Student-Information-Management-System\n学生信息管理系统 JAVA Mysql 数据库课程设计 简单界面\n\n用户登录图简单画了下代码逻辑:提供学生/教师/管理员登录\n\ntxt文件中是数据库建表"
},
{
"path": "src/SMIS/Admin.java",
"chars": 2565,
"preview": "package ѧϢϵͳ;\r\n\r\nimport java.awt.event.*;\r\n\r\nimport javax.swing.*;\r\nimport java.awt.BorderLayout;\r\nimport java.awt.GridL"
},
{
"path": "src/SMIS/Calculate.java",
"chars": 992,
"preview": "package ѧϢϵͳ;\r\n\r\nimport java.math.BigDecimal;\r\n\r\npublic class Calculate {\r\n\t\r\n\tpublic static double calculatepoi(int i){"
},
{
"path": "src/SMIS/Cou.java",
"chars": 2746,
"preview": "package ѧϢϵͳ;\r\n\r\nimport javax.swing.JFrame;\r\nimport javax.swing.JLabel;\r\nimport java.awt.Font;\r\nimport javax.swing.JPane"
},
{
"path": "src/SMIS/Delete.java",
"chars": 4963,
"preview": "package ѧϢϵͳ;\r\n\r\nimport javax.swing.*;\r\nimport java.awt.BorderLayout;\r\nimport java.awt.FlowLayout;\r\nimport javax.swing.G"
},
{
"path": "src/SMIS/InsertCou.java",
"chars": 8220,
"preview": "package ѧϢϵͳ;\r\n\r\nimport javax.swing.JFrame;\r\nimport javax.swing.JPanel;\r\nimport javax.swing.JLabel;\r\nimport javax.swing."
},
{
"path": "src/SMIS/InsertGra.java",
"chars": 7743,
"preview": "package ѧϢϵͳ;\r\n\r\nimport javax.swing.JFrame;\r\nimport javax.swing.JLabel;\r\nimport javax.swing.JOptionPane;\r\n\r\nimport java."
},
{
"path": "src/SMIS/InsertStu.java",
"chars": 16363,
"preview": "package ѧϢϵͳ;\r\n\r\nimport javax.swing.*;\r\nimport java.awt.BorderLayout;\r\nimport java.awt.Font;\r\nimport java.awt.event.Acti"
},
{
"path": "src/SMIS/InsertTea.java",
"chars": 6474,
"preview": "package ѧϢϵͳ;\r\n\r\nimport javax.swing.*;\r\nimport java.awt.BorderLayout;\r\nimport java.awt.Font;\r\nimport java.awt.event.Acti"
},
{
"path": "src/SMIS/JudgeNum.java",
"chars": 578,
"preview": "package ѧϢϵͳ;\r\n\r\npublic class JudgeNum {\r\n\t\r\n\tpublic static boolean judge(String s,int len){\r\n\t\tfor(int i = 0; i < len; "
},
{
"path": "src/SMIS/Login.java",
"chars": 6134,
"preview": "package ѧϢϵͳ;\r\n\r\nimport java.awt.*;\r\nimport java.awt.event.*;\r\nimport javax.swing.*;\r\n\r\npublic class Login extends JFram"
},
{
"path": "src/SMIS/MysqlConn.java",
"chars": 15767,
"preview": "package ѧϢϵͳ;\r\n\r\nimport java.sql.*;\r\n\r\nimport javax.swing.JOptionPane;\r\nimport javax.swing.Spring;\r\n\r\n//ݿӳ\r\npublic class"
},
{
"path": "src/SMIS/QueryCou.java",
"chars": 2466,
"preview": "package ѧϢϵͳ;\r\n\r\nimport javax.swing.JFrame;\r\nimport javax.swing.JLabel;\r\nimport javax.swing.JOptionPane;\r\n\r\nimport java."
},
{
"path": "src/SMIS/QueryGra.java",
"chars": 2813,
"preview": "package ѧϢϵͳ;\r\n\r\nimport javax.swing.JFrame;\r\nimport javax.swing.JLabel;\r\nimport javax.swing.JOptionPane;\r\n\r\nimport java."
},
{
"path": "src/SMIS/QueryStu.java",
"chars": 4513,
"preview": "package ѧϢϵͳ;\r\n\r\nimport javax.swing.*;\r\nimport javax.swing.table.DefaultTableModel;\r\n\r\nimport java.awt.Font;\r\nimport jav"
},
{
"path": "src/SMIS/QueryTea.java",
"chars": 2437,
"preview": "package ѧϢϵͳ;\r\n\r\nimport javax.swing.*;\r\nimport java.awt.BorderLayout;\r\nimport java.awt.Font;\r\nimport java.awt.event.Acti"
},
{
"path": "src/SMIS/Stu.java",
"chars": 2869,
"preview": "package ѧϢϵͳ;\r\n\r\nimport javax.swing.*;\r\nimport java.awt.BorderLayout;\r\nimport java.awt.Font;\r\nimport java.awt.GridLayout"
},
{
"path": "src/SMIS/Student.java",
"chars": 3625,
"preview": "package ѧϢϵͳ;\r\n\r\nimport javax.swing.JFrame;\r\nimport javax.swing.JButton;\r\nimport java.awt.BorderLayout;\r\nimport javax.sw"
},
{
"path": "src/SMIS/Tea.java",
"chars": 2819,
"preview": "package ѧϢϵͳ;\r\n\r\nimport javax.swing.*;\r\nimport java.awt.BorderLayout;\r\nimport java.awt.event.ActionListener;\r\nimport jav"
},
{
"path": "src/SMIS/Teacher.java",
"chars": 2620,
"preview": "package ѧϢϵͳ;\r\n\r\nimport javax.swing.JFrame;\r\nimport javax.swing.JLabel;\r\nimport java.awt.BorderLayout;\r\nimport java.awt."
},
{
"path": "src/SMIS/Transform.java",
"chars": 692,
"preview": "package ѧϢϵͳ;\r\n\r\nimport java.sql.Date;\r\nimport java.text.SimpleDateFormat;\r\n\r\npublic class Transform {\r\n\tpublic static S"
},
{
"path": "src/SMIS/UpdateStu.java",
"chars": 4561,
"preview": "package ѧϢϵͳ;\r\n\r\nimport javax.swing.*;\r\nimport java.awt.BorderLayout;\r\nimport java.awt.Font;\r\nimport java.awt.event.Acti"
},
{
"path": "src/SMIS/UpdateTea.java",
"chars": 6922,
"preview": "package ѧϢϵͳ;\r\n\r\nimport javax.swing.JFrame;\r\nimport javax.swing.JPanel;\r\nimport java.awt.BorderLayout;\r\nimport javax.swi"
},
{
"path": "学生信息管理系统.txt",
"chars": 1331,
"preview": "DROP TABLE 管理员;\r\nCREATE TABLE 管理员(\r\n\tID VARCHAR(12) PRIMARY KEY,\r\n\tpassword VARCHAR(12) NOT NULL\r\n);\r\n\r\nDROP TABLE 学生;\r"
}
]
About this extraction
This page contains the full source code of the chaserw/Student-Information-Management-System GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 26 files (122.1 KB), approximately 38.9k tokens, and a symbol index with 82 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.