学生基本信息管理系统个人博客

团队课程设计链接

http://www.cnblogs.com/ll321/p/7067598.html

个人负责模块

负责部分界面设计,处理代码;

处理部分数据库数据。

自己的代码提交记录截图

自己负责模块或任务详细说明

数据库数据删除(在删除界面把数据库数据删除)

package database;

import java.sql.SQLException;

public class DELETE {
public static String[][] delete(String name){
String str ="delete from students where name="+"'"+name+"'"+";";
String[][] strs = new String[100][8];
try{
DBUtil.exec(str); }catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return strs; } }

图形界面设计和处理

1.搜索界面设计(把数据库的数据输送到图形界面)

public SearchJFrame() {
initComponents();
}
private void Button1ActionPerformed(java.awt.event.ActionEvent evt) {
String name = TextField1.getText().trim();
if(name.length()==0){
JOptionPane.showMessageDialog(null,"输入不能为空!");
}
else{
String[][] strs = SEARCH.serach(name);
for (int i = 0; i < 10; i++) {
for (int j = 0; j < 8; j++) {
System.out.print(strs[i][j] + " ");
}
System.out.println();
}
ImformationJFrame ImformationJFrame = new ImformationJFrame(strs);
ImformationJFrame.setVisible(true);
this.setVisible(false);
}
}
private void Button2ActionPerformed(java.awt.event.ActionEvent evt) {
MainJFrame MainJFrame = new MainJFrame();
MainJFrame.setVisible(true);
this.setVisible(false);
}
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(SearchJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(SearchJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(SearchJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(SearchJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
}



2.添加界面设计(把输入的数据输送到数据库)

public class AddJFrame extends javax.swing.JFrame {
public AddJFrame() {
initComponents();
}
private void initComponents() {
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
AddButton.setText("添加");
AddButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
try {
AddButtonActionPerformed(evt);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
Button2.setText("返回");
Button2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
Button2ActionPerformed(evt);
}
});
pack();
}
private void AddButtonActionPerformed(java.awt.event.ActionEvent evt) throws SQLException {
String number = TextField1.getText().trim();
String name = TextField2.getText().trim();
String gender = TextField3.getText().trim();
String birthdate = TextField4.getText().trim();
String politics = TextField5.getText().trim();
String address = TextField6.getText().trim();
String telephone = TextField7.getText().trim();
String dormitory = TextField8.getText().trim();
if(number.length()==0||name.length()==0||gender.length()==0||birthdate.length()==0||politics.length()==0||address.length()==0||telephone.length()==0||dormitory.length()==0){
JOptionPane.showMessageDialog(null, "有数据为空!!");
}
else{
ADD.add(number, name, gender, birthdate, politics, address, telephone, dormitory);
JOptionPane.showMessageDialog(null, "添加成功!"); }
}
private void Button2ActionPerformed(java.awt.event.ActionEvent evt) {
MainJFrame MainJFrame = new MainJFrame();
MainJFrame.setVisible(true);
this.setVisible(false);
}
public static void main(String args[]) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(AddJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(AddJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(AddJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(AddJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new AddJFrame().setVisible(true);
}
});
} }



3.删除界面设计(将数据库的数据删除)

private void Button2ActionPerformed(java.awt.event.ActionEvent evt) {
MainJFrame MainJFrame = new MainJFrame();
MainJFrame.setVisible(true);
this.setVisible(false);
} private void Button1ActionPerformed(java.awt.event.ActionEvent evt) {
String number = TextField1.getText().trim();
String name = TextField2.getText().trim();
if(name.length()==0&&number.length()==0){
JOptionPane.showMessageDialog(null,"输入不能为空!" );
}
else{
database.DELETE.delete(name); }
}
public static void main(String args[]) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(DeleteJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(DeleteJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(DeleteJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(DeleteJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new DeleteJFrame().setVisible(true);
}
});
}

4.修改界面设计(修改数据库的数据内容)

    private void Button1ActionPerformed(java.awt.event.ActionEvent evt) {

      String number = TextField1.getText().trim();
String name = TextField2.getText().trim();
String gender = TextField3.getText().trim();
String birthdate = TextField4.getText().trim();
String politics = TextField5.getText().trim();
String address = TextField6.getText().trim();
String telephone = TextField7.getText().trim();
String dormitory = TextField8.getText().trim();
CHANGE.change(number,name,gender, birthdate, politics, address, telephone, dormitory);
} private void Button2ActionPerformed(java.awt.event.ActionEvent evt) {
MainJFrame MainJFrame = new MainJFrame();
MainJFrame.setVisible(true);
this.setVisible(false);
} public static void main(String args[]) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(ChangeJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(ChangeJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(ChangeJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(ChangeJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new ChangeJFrame().setVisible(true);
}
});
}





课程设计感想

通过这次的课程设计,我认识到了自己的不足之处,对于一部分知识掌握的还不是很好,还有很多的欠缺之处,需要自己不断的改进。而且在这次课设的过程中,大大地提升了对net beans 和数据库的使用熟练度,有了很大收获。

最新文章

  1. .NET学习记录3
  2. poj 1064 (二分+控制精度) &amp;&amp; hdu 1551
  3. JQuery选择器使用
  4. git 公共服务器
  5. hdu 1729 Stone Game 博弈论
  6. dephi WaitForMultipleObjects 用法
  7. docke 网络配置2
  8. registerWithTouchDispatcher()函数的使用
  9. 【Hibernate学习】 ——ORM(三)
  10. DataTable与实体类的转换
  11. linux 权限字母含义
  12. shell 之解释器、变量、字符串、数组
  13. Abp中使用可视化的日志面板
  14. 什么是JDK?什么是JRE?JDK与JRE的区别和用途
  15. MVC笔记--特性路由
  16. YII2 设置session过期时间
  17. PHP 之 Ci框架下隐藏index.php
  18. (一)Mahapps安装与使用
  19. Angular Material 按钮图标系列
  20. SQLServer 之 Group By 和 Compute By

热门文章

  1. oracle启动 init.ora spfile pfile[转]
  2. SQL 三种基本Join
  3. JS非空验证及邮箱验证
  4. [H5]range对象的createRange方法
  5. Razor语法问题(foreach里面嵌套if)
  6. 去除ios反调试
  7. 常用业务接口界面化 in python flask
  8. Win10家庭版重命名Administrator用户文件夹
  9. SQL查询--选择运算(1)
  10. 对 响应数据写在config文件的再次优化