景点售票系统源代码文档格式.docx

上传人:b****4 文档编号:17867721 上传时间:2022-12-11 格式:DOCX 页数:35 大小:22.41KB
下载 相关 举报
景点售票系统源代码文档格式.docx_第1页
第1页 / 共35页
景点售票系统源代码文档格式.docx_第2页
第2页 / 共35页
景点售票系统源代码文档格式.docx_第3页
第3页 / 共35页
景点售票系统源代码文档格式.docx_第4页
第4页 / 共35页
景点售票系统源代码文档格式.docx_第5页
第5页 / 共35页
点击查看更多>>
下载资源
资源描述

景点售票系统源代码文档格式.docx

《景点售票系统源代码文档格式.docx》由会员分享,可在线阅读,更多相关《景点售票系统源代码文档格式.docx(35页珍藏版)》请在冰豆网上搜索。

景点售票系统源代码文档格式.docx

用户名:

"

));

finalJTextFieldjtxtuser=newJTextField(14);

JPanelp2=newJPanel();

p2.add(newJLabel("

密码:

finalJPasswordFieldjspwd=newJPasswordField(14);

JPanelp3=newJPanel();

finalJButtonjbtUser=newJButton("

登录"

finalJButtonjbtreg=newJButton("

注册"

JButtonjbtexit=newJButton("

退出"

p1.add(jtxtuser);

p2.add(jspwd);

p3.add(jbtUser);

p3.add(jbtreg);

p3.add(jbtexit);

jbtUser.addActionListener(newActionListener()

{

publicvoidactionPerformed(ActionEvente)

{

Connectionconn=null;

ResultSetrs=null;

Statementstmt=null;

if(e.getSource()==jbtUser)

{

try{

Class.forName("

oracle.jdbc.driver.OracleDriver"

conn=DriverManager.getConnection("

jdbc:

oracle:

thin:

@localhost:

1521:

orcl"

"

system"

123"

stmt=conn.createStatement();

StringUSER_NAME=jtxtuser.getText();

rs=stmt.executeQuery("

select*fromTICKET_USERSwhereUSER_NAME='

+jtxtuser.getText()+"

'

andUSER_PWD='

+jspwd.getText()+"

if(rs.next())

{

if(USER_NAME.equals("

admin"

)==false)

{

MainUsermf=newMainUser();

mf.setVisible(true);

jfrmlogin.dispose();

}

else

MainFramemf=newMainFrame();

mf.setVisible(true);

jfrmlogin.dispose();

}

else{

JOptionPane.showMessageDialog(null,"

用户名或密码不一致,请重新输入!

"

系统提示"

JOptionPane.ERROR_MESSAGE);

jtxtuser.setText("

jspwd.setText("

}catch(Exceptionex){

JOptionPane.showMessageDialog(null,"

jtxtuser.setText("

jspwd.setText("

}

}

});

jbtreg.addActionListener(newActionListener()

{

if(e.getSource()==jbtreg)

rs=stmt.executeQuery("

insertintoTICKET_USERS(USER_NAME,USER_PWD)values('

'

)"

JOptionPane.showMessageDialog(null,"

你已成功注册!

可以登录了!

JOptionPane.INFORMATION_MESSAGE);

用户注册失败!

jtxtuser.setText("

jbtexit.addActionListener(newActionListener(){

publicvoidactionPerformed(ActionEvente){

System.exit(0);

});

jfrmlogin.getContentPane().setLayout(newGridLayout(3,1));

jfrmlogin.getContentPane().add(p1);

jfrmlogin.getContentPane().add(p2);

jfrmlogin.getContentPane().add(p3);

jfrmlogin.setVisible(true);

}

}

importjava.sql.*;

publicclassConnectOracle{

publicstaticvoidconnection(String[]args)throwsSQLException{

 

//Connectionconn=null;

//Statementstmt=null;

//ResultSetrs=null;

//JDBC直连Oracle数据库加载驱动

try{

System.out.println("

正在连接数据库......."

Class.forName("

/*conn=*/DriverManager.getConnection("

已经连接到数据库....."

//stmt=conn.createStatement();

//stmt.executeQuery("

insertintostudent(STUID,STUNAME,SEX,AGE)values(0001,'

李华'

男'

20)"

//rs=stmt.executeQuery("

select*fromSTUDENT"

//System.out.println("

stuID"

+"

StuName"

+"

Sex"

Age"

//while(rs.next()){

//intSTUID=rs.getInt("

STUID"

//StringSTUNAME=rs.getString("

STUNAME"

//StringSEX=rs.getString("

SEX"

//intAGE=rs.getInt("

AGE"

"

+STUID+"

+STUNAME+"

+SEX+"

+AGE);

STUID"

STUNAME"

//}

}catch(Exceptionex){

出现的异常为"

+ex);

;

}

importjava.awt.Rectangle;

publicclassAddTicketextendsJPanelimplementsActionListener

Connectioncon;

Statementst;

JLabeljLabel1=newJLabel("

票单价:

JLabeljLabel2=newJLabel("

票日期:

JTextFieldjTextField1=newJTextField();

JTextFieldjTextField2=newJTextField();

JButtonjButton1=newJButton("

确定增加"

publicAddTicket()

try{

jbInit();

catch(Exceptionexception){

exception.printStackTrace();

privatevoidjbInit()throwsException

Class.forName("

con=DriverManager.getConnection("

this.setLayout(null);

jLabel1.setBounds(newRectangle(40,40,64,24));

jLabel2.setBounds(newRectangle(40,100,53,22));

jTextField1.setBounds(newRectangle(102,40,200,30));

jTextField2.setBounds(newRectangle(102,100,200,30));

jButton1.setBounds(newRectangle(120,220,150,32));

jButton1.addActionListener(this);

this.add(jLabel1);

this.add(jTextField1);

this.add(jLabel2);

this.add(jTextField2);

this.add(jButton1);

ResultSetrs=null;

st=con.createStatement();

rs=st.executeQuery("

select*fromTICKET_TRANSCRIPT"

if(rs.next())

jTextField1.setText(rs.getString("

TICKET_PRICE"

publicvoidactionPerformed(ActionEvente)

try{

st=con.createStatement();

st.executeUpdate("

deletefromTICKET"

deletefromTICKET_ORDER_FORM"

insertintoTICKETselect*fromTICKET_TRANSCRIPT"

updateTICKETsetTICKET_DATE='

+jTextField2.getText()+"

st.executeUpdate("

updateTICKETsetTICKET_PRICE='

+jTextField1.getText()+"

JOptionPane.showMessageDialog(this,"

票增加成功!

jTextField1.setText("

jTextField2.setText("

catch(Exceptionex){

票增加失败!

ex.printStackTrace();

importjavax.swing.*;

importjavax.swing.table.JTableHeader;

publicclassAdminInquireTicketextendsJFrame

privateJScrollPanescpDemo;

privateJTableHeaderjth;

privateJTabletabDemo;

privateJButtonbtnShow;

privateJButtonbtnShow1;

publicAdminInquireTicket()

super("

华清池售票系统"

this.setSize(430,400);

this.setLocation(500,180);

this.scpDemo=newJScrollPane();

this.scpDemo.setBounds(10,50,390,270);

this.btnShow=newJButton("

显示票信息"

this.btnShow.setBounds(10,10,390,30);

this.btnShow1=newJButton("

返回"

this.btnShow1.setBounds(260,330,120,30);

余票总数:

jLabel1.setBounds(newRectangle(20,330,100,30));

jTextField1.setBounds(newRectangle(90,330,70,30));

add(this.scpDemo);

add(this.btnShow);

add(this.btnShow1);

this.add(jLabel1);

this.setVisible(true);

try{

intn=0;

select*fromTICKET"

while(rs.next())

n++;

jTextField1.setText("

+n+"

}catch(Exceptionexception){

this.btnShow1.addActionListener(newActionListener()

MainFramemu=newMainFrame();

mu.setVisible(true);

dispose();

this.btnShow.addActionListener(newActionListener()

publicvoidactionPerformed(ActionEventae)

btnShow_ActionPerformed(ae);

publicvoidbtnShow_ActionPerformed(ActionEventae)

Class.forName("

Connectioncon=DriverManager.getConnection("

Stringsql="

PreparedStatementpstm=con.prepareStatement(sql);

ResultSetrs=pstm.executeQuery();

intcount=0;

while(rs.next())

count++;

rs=pstm.executeQuery();

Object[][]info=newObject[count][4];

count=0;

info[count][0]=rs.getString("

TICKET_NUM"

info[count][1]=rs.getString("

TICKET_DATE"

info[count][2]=rs.getString("

TICKET_PR

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 经管营销 > 经济市场

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1