第一范文网 - 专业文章范例文档资料分享平台

4源程序清单格式

来源:用户分享 时间:2025/5/30 10:14:40 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

软件实验周——源程序清单

import javax.swing.JTable; import javax.swing.JTextField;

import action.TicketsmanageAction; import action.TrainmanageAction; import entity.Train; //票务管理界面

public class TicketsSale { private static JFrame jf;

private JPanel inset,inset1,inset2,outset; private JLabel username,userId,busNo,startstation,endstation,startdate,saleId,starttime,restnum;

private JButton in,delete,chage,select,exit; private JTextField jusername,jtrainno,juserId,jstartstation,jendstation,jstartdate,jsaleId,jstarttime,jrestnum;

public static JTable table;

Object[][] tabledate = new Object[45][10]; int i=0;

public TicketsSale() { }

//初始化界面

public void init(ArrayList list) {

jf = new JFrame(\票务管理界面\ jf.setSize(new Dimension(600,600)); jf.setLocation(350,150);

jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

username = new JLabel (\姓名\ userId = new JLabel (\身份证号\ busNo = new JLabel (\车次号\

startstation = new JLabel (\始发站\ endstation = new JLabel (\终点站\ saleId = new JLabel (\售票点\

in = new JButton (\售票\ delete = new JButton (\退票\ chage = new JButton (\改签\ select = new JButton (\查询\ exit = new JButton(\退出\

第28页

软件实验周——源程序清单

jusername = new JTextField(); juserId = new JTextField(); jtrainno = new JTextField();

jstartstation = new JTextField(); jendstation = new JTextField();

jsaleId = new JTextField(); //设置布局

inset = new JPanel();

inset.setLayout(new BorderLayout()); inset.setSize(new Dimension());

inset1 = new JPanel();

inset1.setLayout(new GridLayout(3,6,2,2));

inset2 = new JPanel();

inset2.setLayout(new FlowLayout(FlowLayout.LEFT));

outset = new JPanel();

outset.setLayout(new BorderLayout());

addObject(list);

Object[] titledate = {\车次号\始发站\终点站\发车时间\票价\日期\余票\

//生成table表格

table = new JTable(tabledate,titledate);

inset1.add(username); inset1.add(jusername); inset1.add(userId); inset1.add(juserId); inset1.add(busNo); inset1.add(jtrainno);

inset1.add(startstation); inset1.add(jstartstation); inset1.add(endstation); inset1.add(jendstation); inset1.add(saleId); inset1.add(jsaleId);

inset.add(inset1,BorderLayout.NORTH);

第29页

软件实验周——源程序清单

inset2.add(in); inset2.add(delete); inset2.add(chage); inset2.add(select); inset2.add(exit);

inset.add(inset2,BorderLayout.SOUTH);

jf.add(inset,BorderLayout.NORTH);

outset.add(new JScrollPane(table)); jf.add(outset); //按钮监听

setaddActionListener1(new

TicketsmanageAction(in,delete,chage,select,this));

setchageActionListener1(new

TicketsmanageAction(in,delete,chage,select,this));

setdeleteActionListener1(new

TicketsmanageAction(in,delete,chage,select,this));

setselectActionListener1(new

TicketsmanageAction(in,delete,chage,select,this));

setexitActionListener(new

TicketsmanageAction(in,delete,chage,select,this));

jf.setVisible(true); }

public void addObject(ArrayList list) {

Iterator iter = list.iterator(); while (iter.hasNext()) { Object o = iter.next(); if (o instanceof Train) { Train ti = (Train) o;

tabledate[i][0]=ti.getTrainno();

tabledate[i][1]=ti.getStartstation(); tabledate[i][2]=ti.getEndstation(); tabledate[i][3]=ti.getStartdate(); tabledate[i][4]=ti.getPrice(); tabledate[i][5]=ti.getStarttime(); tabledate[i][6]=ti.getRestnum(); i++; }

第30页

软件实验周——源程序清单

}

public static void closeframe(boolean b){ jf.setVisible(b); }

public String getJtrainno() { return jtrainno.getText(); }

public void setJtrainno(String jt) { jtrainno.setText(jt); }

public String getJstartstation() { return jstartstation.getText(); }

public void setJstartstation(String jss) { jstartstation.setText(jss); }

public String getJendstation() { return jendstation.getText(); }

public void setJendstation(String jes) { jendstation.setText(jes); }

public String getJuserId() { return juserId.getText(); }

public void setJuserId(String jsd) { juserId.setText(jsd); }

public String getJsaleId() { return jsaleId.getText(); }

public void setJsaleId(String jpe) {

}

第31页

搜索更多关于: 4源程序清单格式 的文档
4源程序清单格式.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c2fg5710fwl555jd3wygr_8.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top