景点售票系统源代码.docx
- 文档编号:11017911
- 上传时间:2023-02-24
- 格式:DOCX
- 页数:28
- 大小:18.79KB
景点售票系统源代码.docx
《景点售票系统源代码.docx》由会员分享,可在线阅读,更多相关《景点售票系统源代码.docx(28页珍藏版)》请在冰豆网上搜索。
景点售票系统源代码
importclassLogOn
{
publicstaticvoidmain(String[]args)throwsSQLException
{
finalJFramejfrmlogin=newJFrame("系统登录");
(400,280);
DimensionscreenSize=().getScreenSize();
((int)/2,(int)/2);etLayout(newGridLayout(3,1));
().add(p1);
().add(p2);
().add(p3);
(true);
}
}
import.*;
publicclassConnectOracle{
publicstaticvoidconnection(String[]args)throwsSQLException{
.....");
("");
/*conn=*/("jdbc:
oracle:
thin:
@localhost:
1521:
orcl","system","123");
"已经连接到数据库.....");
;
import.*;
publicclassAdminInquireTicketextendsJFrame
{
Connectioncon;
Statementst;
privateJScrollPanescpDemo;
privateJTableHeaderjth;
privateJTabletabDemo;
privateJButtonbtnShow;
privateJButtonbtnShow1;
publicAdminInquireTicket()
{
super("华清池售票系统");
(430,400);
(null);
(500,180);
=newJScrollPane();
=newJButton("显示票信息");
=newJButton("返回");
JLabeljLabel1=newJLabel("余票总数:
");
JTextFieldjTextField1=newJTextField();
(newRectangle(20,330,100,30));
(newRectangle(90,330,70,30));
add;
add;
add;
(jLabel1);
(jTextField1);
(true);
try{
("");
con=("jdbc:
oracle:
thin:
@localhost:
1521:
orcl","system","123");
ResultSetrs=null;
intn=0;
st=();
rs=("select*fromTICKET");
while())
{
n++;
}
(""+n+"");
}catch(Exceptionexception){
();
}
ActionListener()
{
publicvoidactionPerformed(ActionEvente)
{
MainFramemu=newMainFrame();
(true);
dispose();
}
});
ActionListener()
{
publicvoidactionPerformed(ActionEventae)
{
btnShow_ActionPerformed(ae);
}
});
}
publicvoidbtnShow_ActionPerformed(ActionEventae)
{
try{
("");
Connectioncon=("jdbc:
oracle:
thin:
@localhost:
1521:
orcl","system","123");
Stringsql="select*fromTICKET";
PreparedStatementpstm=(sql);
ResultSetrs=();
intcount=0;
while())
{
count++;
}
rs=();
Object[][]info=newObject[count][4];
count=0;
while())
{
info[count][0]=("TICKET_NUM");
info[count][1]=("TICKET_DATE");
info[count][2]=("TICKET_PRICE");
count++;
}
String[]title={"票号","日期","票价"};
=newJTable(info,title);
=
}catch(ClassNotFoundExceptioncnfe){
(null,"查询失败!
","错误",;
}catch(SQLExceptionsqle){
(null,"查询失败!
","错误",;
}
}
}
importclassBuyTicketextendsJPanelimplementsActionListener
{
Connectioncon;
Statementst;
JLabeljLabel1=newJLabel("用户名:
");
JLabeljLabel2=newJLabel("票编号:
");
JLabeljLabel3=newJLabel("票单价:
");
JLabeljLabel4=newJLabel("票日期:
");
JTextFieldjTextField1=newJTextField();
JTextFieldjTextField2=newJTextField();
JTextFieldjTextField3=newJTextField();
JTextFieldjTextField4=newJTextField();
JButtonjButton1=newJButton("确定购买");
publicBuyTicket()
{
try{
jbInit();
}
catch(Exceptionexception){
();
}
}
privatevoidjbInit()throwsException
{
("");
con=("jdbc:
oracle:
thin:
@localhost:
1521:
orcl","system","123");
(null);
(newRectangle(40,40,64,24));
(newRectangle(40,100,53,22));
(newRectangle(40,160,61,27));
(newRectangle(40,220,61,27));
(newRectangle(102,40,200,30));
(newRectangle(102,100,200,30));
(newRectangle(102,160,200,33));
(newRectangle(102,220,200,33));
(newRectangle(120,300,150,32));
(this);
(jLabel1);
(jTextField1);
(jLabel2);
(jTextField2);
(jLabel3);
(jTextField3);
(jLabel4);
(jTextField4);
(jButton1);
ResultSetrs=null;
st=();
rs=("select*from(selectrownumnum,a.*fromTICKETa)wherenum=(selectcount
(1)fromTICKET)");
if())
{
("TICKET_NUM"));
("TICKET_PRICE"));
("TICKET_DATE"));
}
}
publicvoidactionPerformed(ActionEvente)
{
if()==jButton1)
{
try{
("insertintoTICKET_ORDER_FORMvalues('"+()+"','"+()+"','"+()+"','"+()+"')");
("deletefromTICKETwhereTICKET_NUM='"+()+"'");
(this,"购票成功!
");
("");
("");
("");
("");
}
catch(Exceptionex){
(this,"购票失败!
");
();
}
}
}
}
importclassInquireTicketextendsJPanelimplementsActionListener
{
Connectioncon;
Statementst;
JLabeljLabel1=newJLabel("余票数:
");
JTextFieldjTextField1=newJTextField();
JLabeljLabel2=newJLabel("票价:
");
JTextFieldjTextField2=newJTextField();
JLabeljLabel3=newJLabel("日期:
");
JTextFieldjTextField3=newJTextField();
publicInquireTicket()
{
try{
jbInit();
}
catch(Exceptionexception){
();
}
}
privatevoidjbInit()throwsException
{
("");
con=("jdbc:
oracle:
thin:
@localhost:
1521:
orcl","system","123");
(null);
(newRectangle(40,50,64,24));
(newRectangle(102,50,200,30));
(newRectangle(40,100,64,24));
(newRectangle(102,100,200,30));
(newRectangle(40,150,64,24));
(newRectangle(102,150,200,30));
(jLabel1);
(jTextField1);
(jLabel2);
(jTextField2);
(jLabel3);
(jTextField3);
ResultSetrs=null;
intcount=0;
st=();
rs=("select*fromTICKET");
while())
{
("TICKET_PRICE"));
("TICKET_DATE"));
count++;
}
(""+count+"");
}
publicvoidactionPerformed(ActionEvente)
{
}
}
importclassMainFrameextendsJFrameimplementsActionListener
{
JPanelcontentPane;
JMenuBarjMenuBar1=newJMenuBar();
JMenujMenu0=newJMenu("系统");
JMenuItemjMenuItem0=newJMenuItem("退出");
JMenujMenu1=newJMenu("增加票");
JMenuItemjMenuItem1=newJMenuItem("增加票");
JMenujMenu2=newJMenu("修改票");
JMenuItemjMenuItem2=newJMenuItem("修改票");
JMenujMenu3=newJMenu("查询票");
JMenuItemjMenuItem3=newJMenuItem("查询票");
JLabeljLabel1=newJLabel("华清池售票系统(管理员)");
JLabeljLabel2=newJLabel("延安大学软件12课程设计");
publicMainFrame()
{
try{
setDefaultCloseOperation(EXIT_ON_CLOSE);
jbInit();
}
catch(Exceptionexception){
();
}
}
privatevoidjbInit()throwsException
{
contentPane=(JPanel)getContentPane();
(null);
DimensionscreenSize=().getScreenSize();
setLocation((int)/2,(int)/2);
setSize(newDimension(400,420));
setTitle("华清池售票系统");
(this);
(this);
(this);
(this);
setJMenuBar(jMenuBar1);
(jMenu0);
(jMenu1);
(jMenu2);
(jMenu3);
(jMenuItem0);
(jMenuItem1);
(jMenuItem2);
(jMenuItem3);
(jLabel1);
(jLabel2);
(new"黑体",,20));
(newRectangle(65,70,275,55));
(new"黑体",,16));
(newRectangle(90,150,200,35));
}
publicvoidactionPerformed(ActionEventactionEvent)
{
if()==jMenuItem0)
{
(null,"您已成功退出系统!
","系统提示",;
(0);
}
if()==jMenuItem1)
{
AddTicketAddT=newAddTicket();
());
(AddT);
(true);
}
if()==jMenuItem2)
{
ModifyTicketAddT=newModifyTicket();
());
(AddT);
(true);
}
if()==jMenuItem3)
{
(false);
AdminInquireTicketAddT=newAdminInquireTicket();
());
(AddT);
(true);
}
}
}
importclassMainUserextendsJFrameimplementsActionListener
{
JPanelcontentPane;
JMenuBarjMenuBar1=newJMenuBar();
JMenujMenu0=newJMenu("系统");
JMenuItemjMenuItem0=newJMenuItem("退出");
JMenujMenu1=newJMenu("购票");
JMenuItemjMenuItem1=newJMenuItem("购票");
JMenujMenu2=newJMenu("查询余票");
JMenuItemjMenuItem2=newJMenuItem("查询余票");
JMenujMenu3=newJMenu("我的订票");
JMenuItemjMenuItem3=newJMenuItem("我的订票");
JLabeljLabel1=newJLabel("华清池售票系统(游客)");
JLabeljLabel2=newJLabel("延安大学软件12课程设计");
publicMainUser()
{
try{
setDefaultCloseOperation(EXIT_ON_CLOSE);
jbInit();
}
catch(Exceptionexception){
();
}
}
privatevoidjbInit()throwsException
{
contentPane=(JPanel)getContentPane();
(null);
DimensionscreenSize=().getScreenSize();
setLocation((int)/2,(int)/2);
setSize(newDimension(400,420));
setTitle("华清池售票系统");
(this);
(this);
(this);
(this);
setJMenuBar(jMenuBar1);
(jMenu0);
(jMenu1);
(jMenu2);
(jMenu3);
(jMenuItem0);
(jMenuItem1);
(jMenuItem2);
(jMenuItem3);
(jLabel1);
(jLabel2);
(new"黑体",,20));
(newRectangle(65,70,275,55));
(new"黑体",,16));
(newRectangle(90,150,200,35));
}
publicvoidactionPerformed(ActionEventactionEvent)
{
if()==jMenuItem0)
{
(null,"您已成功退出系统!
","系统提示",;
(0);
}
if()==jMenuItem1)
{
BuyTicketAddT=newBuyTicket();
());
(AddT);
(true);
}
if()==jMenuItem2)
{
InquireTicketAddT=newInquireTicket();
());
(AddT);
(true);
}
if()==jMenuItem3)
{
(false);
MyTicketAddT=newMyTicket();
());
(AddT);
(true);
}
}
}
importclassModifyTicketextendsJPanelimplementsActionListener
{
Connectioncon;
Statementst;
JLabeljLabel1=newJLabel("票单价:
");
JLabeljLabel2=newJLabel("票日期:
");
JTextFieldjTextField1=newJTextField();
JTextFieldjTextField2=newJTextField();
JButtonjButton1=newJButton("确定修改");
publicModifyTicket()
{
try{
jbInit();
}
catch(Exceptionexception){
();
}
}
privatevoidjbInit()throwsException
{
("");
con=("jdbc:
oracle:
thin:
@localhost:
1521:
orcl","system","123");
(null);
(newRectangle(40,40,64,24));
(newRectangle(40,100,53,22));
(newRectangle(102,40,200,30));
(newRectangle(102,100,200,30));
(newRectangle(120,200,150,32));
(this);
(jLabel1);
(jTextField1);
(jLabel2);
(jTextField2);
(jButton1);
ResultSetrs=null;
st=();
rs=("select*from(selectrownumnum,a.*fromTICKETa)wherenum=(selectcount
(1)fromTICKET)");
if())
{
("TICKET_PRICE"));
("TICKET_D
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 景点 售票 系统 源代码