资源简介
使用JAVA制作窗体,使用mysql建立一个数据库,存储联系人的信息,有界面有窗体,注释比较详细,整体实现了通信录的基本功能,查询,添加,删除,查找,总人数是多少。

代码片段和文件信息
package DAO;
import java.io.UnsupportedEncodingException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.swing.ButtonGroup;
import javax.swing.ButtonModel;
import javax.swing.DefaultListModel;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPasswordField;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
import javax.swing.ListModel;
import Model.user;
import Model.Student;
import Util.DBConnection;
import View.Mainframe;
///////////////////////////////////此处部分代码实现来自对StudentScore中对班级操作代码的更改
public class InfoDAO {
///////////////////////////////登录检查
public void logincheck(JTextField nameJPasswordField pwJLabel label)
{
String usersym = null;
login c = new login();
user us = new user();
usersym=c.check(namepwus);
label.setText(usersym);
if(usersym.equals(“登录成功“)){
Mainframe ma = new Mainframe();
ma.setVisible(true);
}
}
////////////////////////////////显示列表中人的名字
public void showlist (JList namelist){
List user= null;
DBConnection db = new DBConnection();
user= db.getList(“select name from info “);
DefaultListModel listModel = new DefaultListModel();
for(int i =0;i Map m = null;
object o = null ;
o = user.get(i);
m = (HashMap)o;
listModel.addElement(m.get(“name“));
}
namelist.setModel(listModel);
}
///////////////////////////////////显示选中人的信息
public Student showinfo(Connection conString name) throws Exception{
String sql=“SELECT * FROM info where name=?“;
sql=new String(sql.getBytes(“ISO-8859-1“)“UTF-8“);
PreparedStatement pstmt=con.prepareStatement(sql);
Student usif=new Student();
ResultSet rs=null;
if(name!=null){
pstmt.setString(1 name);
rs=pstmt.executeQuery();
while (rs.next()){
usif.setId(rs.getInt(“id“));
usif.setAddress(rs.getString(“address“));
usif.setBirthday(rs.getString(“birthday“));
usif.setName(rs.getString(“name“));
usif.setSex(rs.getString(“sex“));
usif.setTel(rs.getString(“tel“));
}
}
return usif;
}
//////////////////////////////////通过人的名字查询信息
public void findbyname (JTextField searchnameJList namelist){
String name = searchname.getText();
ListModel listModel = new DefaultListModel();
listModel = namelist.getModel();
int j = 0;
for(int i= 0;i
if(listModel.getElementAt(i).equals(name)) {namelist.setSelectedIndex(i); j = 1;}
}
if(j==0) System.out.println(“找不到该user“);
}
/////////////////////////////////查询人数的方法
public int findnum (JList namelist){
ListModel listModel = new DefaultListModel();
listModel = namelist.getModel();
int i=listModel.getSize();
return i;
}
///////////////////
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2017-06-03 00:09 tongxinlu\
文件 306 2017-06-03 00:09 tongxinlu\.classpath
文件 385 2017-06-02 21:12 tongxinlu\.project
目录 0 2017-06-02 21:12 tongxinlu\.settings\
文件 598 2017-06-02 21:12 tongxinlu\.settings\org.eclipse.jdt.core.prefs
目录 0 2017-06-03 00:09 tongxinlu\bin\
目录 0 2017-06-03 14:25 tongxinlu\bin\DAO\
文件 5447 2017-06-03 14:45 tongxinlu\bin\DAO\InfoDAO.class
文件 2283 2017-06-03 00:09 tongxinlu\bin\DAO\login.class
目录 0 2017-06-03 00:09 tongxinlu\bin\images\
文件 19889 2017-06-02 21:39 tongxinlu\bin\images\1.jpg
文件 160972 2017-06-02 21:39 tongxinlu\bin\images\7.jpg
文件 47652 2017-06-02 21:39 tongxinlu\bin\images\a.jpg
目录 0 2017-06-03 00:09 tongxinlu\bin\Model\
文件 1723 2017-06-03 00:09 tongxinlu\bin\Model\Student.class
文件 1067 2017-06-03 00:09 tongxinlu\bin\Model\user.class
目录 0 2017-06-03 00:09 tongxinlu\bin\Util\
文件 5429 2017-06-03 14:45 tongxinlu\bin\Util\DBConnection.class
目录 0 2017-06-03 12:36 tongxinlu\bin\View\
文件 692 2017-06-03 00:09 tongxinlu\bin\View\Login$1.class
文件 991 2017-06-03 00:09 tongxinlu\bin\View\Login$2.class
文件 867 2017-06-03 00:09 tongxinlu\bin\View\Login$3.class
文件 2976 2017-06-03 00:09 tongxinlu\bin\View\Login.class
文件 712 2017-06-03 14:50 tongxinlu\bin\View\Mainfr
文件 1972 2017-06-03 14:50 tongxinlu\bin\View\Mainfr
文件 2161 2017-06-03 14:50 tongxinlu\bin\View\Mainfr
文件 1944 2017-06-03 14:50 tongxinlu\bin\View\Mainfr
文件 921 2017-06-03 14:50 tongxinlu\bin\View\Mainfr
文件 1945 2017-06-03 14:50 tongxinlu\bin\View\Mainfr
文件 912 2017-06-03 14:50 tongxinlu\bin\View\Mainfr
文件 1098 2017-06-03 14:50 tongxinlu\bin\View\Mainfr
............此处省略19个文件信息
相关资源
- 微博系统(Java源码,servlet+jsp),适
- java串口通信全套完整代码-导入eclip
- 美食天下项目Android版源码和Web版源码
- jsonarray所必需的6个jar包.rar
- 三角网构TIN生成算法,Java语言实现
- java代码编写将excel数据导入到mysql数据
- Java写的cmm词法分析器源代码及javacc学
- JAVA JSP公司财务管理系统 源代码 论文
- JSP+MYSQL旅行社管理信息系统
- 推荐算法的JAVA实现
- 基于Java的酒店管理系统源码(毕业设
- java-图片识别 图片比较
- android毕业设计
- java23种设计模式+23个实例demo
- java Socket发送/接受报文
- JAVA828436
- java界面美化 提供多套皮肤直接使用
- 在线聊天系统(java代码)
- 基于Java的图书管理系统807185
- java中实现将页面数据导入Excel中
- java 企业销售管理系统
- java做的聊天系统(包括正规课程设计
- Java编写的qq聊天室
- mysql jsp网站源码下载
- 商店商品管理系统 JAVA写的 有界面
- JAVA开发聊天室程序
- 在linux系统下用java执行系统命令实例
- java期末考试试题两套(答案) 选择(
- JAVA3D编程示例(建模、交互)
- Java 文件加密传输
评论
共有 条评论