java餐厅餐卡管理系统课程设计Word格式文档下载.docx
- 文档编号:916653
- 上传时间:2023-04-29
- 格式:DOCX
- 页数:36
- 大小:346KB
java餐厅餐卡管理系统课程设计Word格式文档下载.docx
《java餐厅餐卡管理系统课程设计Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《java餐厅餐卡管理系统课程设计Word格式文档下载.docx(36页珍藏版)》请在冰点文库上搜索。
3、系统结构
ClassLoadfirst(){}
只有此类含有main()方法,登陆页面;
ClassLoad(){}
登陆进去时,系统的主页面,功能的主目录
ClassInto(){}
实现注册功能,后台数据库自动生成卡号;
ClassFind(){}
实现输入卡号,查询数据库信息功能;
ClassLost(){}
实现挂失信息操作,挂失信息不能再修改。
四、程序流程(或模块划分)
这里是系统的主要流程图和流程图的语言介绍
流程图如下:
流程图
图1登陆主界面
图2系统运行主界面
图3注册主界面
图4注册界面
图5我的卡号
图6挂失卡号
5、源程序
登陆主页面:
publicfinalclassLoadfirstextendsJFrameimplementsActionListener,Runnable{
privatestaticThreadScoll=null;
privatestaticThreadcoll=null;
JButtonyes,no;
TextFieldtext;
JLabellabel,wel,timer,time;
JPanelp1,p2,p3;
booleanstop,on;
privateJPasswordFieldpassword;
publicLoadfirst(){
JFramej=newJFrame("
餐卡信息管理系统登陆界面"
);
p1=newJPanel();
p2=newJPanel();
p3=newJPanel();
timer=newJLabel("
亲,您目前访问的时间是:
"
time=newJLabel();
label=newJLabel("
请输入登录密码:
"
wel=newJLabel("
亲!
欢迎进入餐卡信息管理系统!
text=newTextField("
text.setEchoChar('
*'
//JPasswordFieldpassword=newJPasswordField(8);
//password.setEchoChar('
setLayout(newFlowLayout());
setBounds(500,50,250,100);
yes=newJButton("
登录系统"
no=newJButton("
退出查询"
p1.add(label);
p1.add(text);
p1.add(yes);
p1.add(no);
p2.add(wel);
p3.add(timer);
p3.add(time);
p1.setLayout(newGridLayout(2,2));
p3.setLayout(newGridLayout(1,2));
j.setBounds(500,200,450,400);
j.add(BorderLayout.NORTH,p1);
j.add(BorderLayout.CENTER,p2);
j.add(BorderLayout.SOUTH,p3);
Fontfont=newFont("
楷体"
Font.BOLD,25);
Fontnt=newFont("
Font.BOLD,15);
wel.setFont(font);
timer.setFont(nt);
label.setFont(nt);
time.setFont(nt);
yes.setFont(nt);
no.setFont(nt);
wel.setForeground(Color.RED);
yes.setForeground(Color.BLUE);
no.setForeground(Color.DARK_GRAY);
yes.setBackground(Color.green);
no.setBackground(Color.RED);
yes.addActionListener(this);
no.addActionListener(this);
j.setVisible(true);
j.setBackground(Color.GREEN);
j.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Scoll=newThread(this);
coll=newThread(this);
Scoll.start();
coll.start();
}
publicvoidrun(){
if(Thread.currentThread()==Scoll){
while(true){
intx=wel.getBounds().x;
inty=120;
x+=10;
wel.setLocation(x,y);
if(x>
300){
x=5;
wel.setLocation(x,y);
}try{
Thread.sleep(100);
}catch(InterruptedExceptioner){
er.printStackTrace();
}if(stop==true){
return;
}
}
}elseif(Thread.currentThread()==coll){
Datedate=newDate();
StringtimeStr=date.toString().substring(11,19);
time.setText(timeStr);
try{
Thread.sleep(1000);
}if(on==true){
}
publicvoidactionPerformed(ActionEvente){
if(e.getSource()==yes&
&
text.getText().toString().equals("
123"
)){
newLoad();
dispose();
}elseif(e.getSource()==no){
stop=false;
System.exit(0);
//}elseif(!
password.getPassword().equals("
)){
}elseif(!
text.getText().toString().equals("
JOptionPane.showMessageDialog(this,"
亲,您的密码怎么输入错误了啊!
text.setText("
System.out.println("
密码输入错了怎么办呢?
}
publicstaticvoidmain(String[]args){
newLoadfirst();
}
查询页面:
publicclassFindextendsJFrameimplementsActionListener{
StringDBDriver="
com.mysql.jdbc.Driver"
;
StringconnectionStr="
jdbc:
mysql:
//localhost:
3306/canterbury"
Connectioncon=null;
PreparedStatementstmt=null;
ResultSetrs=null;
JLabell1,l2,l3,l4;
JTextFieldt1,t2,t3,t4;
JTextArearesult;
JLabellabel,timer,time;
booleanjudge=false;
Find(){
查询信息:
t1=newJTextField();
t2=newJTextField();
t3=newJTextField();
t4=newJTextField();
2014年1月2日"
l1=newJLabel("
卡号:
l2=newJLabel("
姓名:
l3=newJLabel("
充值余额:
l4=newJLabel("
最低消费余额:
点击查询"
退出系统"
result=newJTextArea();
p1.add(l1);
p1.add(t1);
//p3.setLayout(newGridLayout(1,2));
Fontinto=newFont("
yes.setFont(into);
no.setFont(into);
l1.setFont(into);
l2.setFont(into);
l3.setFont(into);
l4.setFont(into);
timer.setFont(into);
l1.setBackground(Color.green);
l2.setBackground(Color.green);
l3.setBackground(Color.green);
l4.setBackground(Color.green);
Datedate=newDate();
StringtimeStr=date.toString().substring(11,19);
time.setText(timeStr);
if(e.getSource()==no){
}if(t1.getText().equals("
JOptionPane.showMessageDialog(this,"
亲,这样是不可以查询信息的呦!
elseif(e.getSource()==yes){
try{
Class.forName(DBDriver);
con=DriverManager.getConnection(connectionStr,"
root"
"
123malin"
Stringselect="
select*fromcantewhereid=?
stmt=con.prepareStatement(select);
stmt.setString(1,t1.getText());
rs=stmt.executeQuery();
Stringt1,t2,t3,t4;
if(rs.next()){
t1=rs.getString("
id"
t2=rs.getString("
name"
t3=rs.getString("
sur"
t4=rs.getString("
only"
\n卡号:
+t1+"
\n姓名:
+t2+"
\n剩余额度:
+t3+"
\n最高消费:
+t4);
con.close();
stmt.close();
}if(!
rs.next()){
JOptionPane.showMessageDialog(this,"
亲,对不住哟,居然没有你要的信息!
}catch(ClassNotFoundExceptioner){
er.printStackTrace();
}catch(SQLExceptioner){
}
注册主页面:
publicclassIntoextendsJFrameimplementsActionListener{
JLabell1,l2,l3,l4,l5,l6;
JTextFieldt1,t2,t3,t4,t5,t6;
JLabellabel,wel,timer,time,sert;
Into(){
JFramej=newJFrame("
注册新餐厅卡:
p1=newJPanel();
p2=newJPanel();
p3=newJPanel();
t1=newJTextField();
t1.setEnabled(false);
t1.setText("
卡号是不需要输入的!
t2=newJTextField();
t3=newJTextField();
t4=newJTextField();
timer=newJLabel("
time=newJLabel();
l1=newJLabel("
l2=newJLabel("
l3=newJLabel("
l4=newJLabel("
setLayout(newFlowLayout());
setBounds(500,50,250,100);
yes=newJButton("
注册"
no=newJButton("
返回"
result=newJTextArea();
p1.add(l1);
p1.add(t1);
p1.add(l2);
p1.add(t2);
p1.add(l3);
p1.add(t3);
p1.add(l4);
p1.add(t4);
p1.add(yes);
p1.add(no);
p3.add(timer);
p3.add(time);
p1.setLayout(newGridLayout(5,2));
p3.setLayout(newFlowLayout());
j.setBounds(500,200,450,400);
j.add(BorderLayout.NORTH,p1);
j.add(BorderLayout.SOUTH,p3);
Fontinto=newFont("
yes.setFont(into);
no.setFont(into);
l1.setFont(into);
l2.setFont(into);
l3.setFont(into);
l4.setFont(into);
t1.setFont(into);
yes.setForeground(Color.BLUE);
no.setForeground(Color.DARK_GRAY);
yes.setBackground(Color.green);
l1.setBackground(Color.green);
l2.setBackground(Color.green);
l3.setBackground(Color.green);
l4.setBackground(Color.green);
no.setBackground(Color.RED);
t1.setBackground(Color.RED);
yes.addActionListener(this);
no.addActionListener(this);
j.setVisible(true);
j.setBackground(Color.GREEN);
j.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Datedate=newDate();
StringtimeStr=date.toString().substring(11,19);
GregorianCalendarcalender=newGregorianCalendar();
intyear=calender.get(Calendar.YEAR);
intmonth=calender.get(Calendar.MONTH)+1;
intday=calender.get(Calendar.DAY_OF_MONTH);
Stringstr=(year+"
年"
+month+"
月"
+day+"
日"
+timeStr);
time.setText(str);
publicvoidactionPerformed(ActionEvente){
}if(e.getSource()==yes){
try{
Class.forName(DBDriver);
con=DriverManager.getConnection(connectionStr,"
}catch(ClassNotFoundExceptioner){
er.printStackTrace();
}catch(SQLExceptioner){
Stringn="
insertintocante(id,name,sur,only)values(?
?
)"
PreparedStatementstmt=con.prepareStatement(n);
d
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- java 餐厅 管理 系统 课程设计