资源预览内容
第1页 / 共14页
第2页 / 共14页
第3页 / 共14页
第4页 / 共14页
第5页 / 共14页
第6页 / 共14页
第7页 / 共14页
第8页 / 共14页
第9页 / 共14页
第10页 / 共14页
亲,该文档总共14页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
1 设计时间 2011年6月6日2011年6月10日2 设计目的课程设计是全面的综合练习。通过实践加深了对面向对象程序设计的理论、方法和基础知识的理解,掌握运用Java语言进行面向对象设计的基本方法,提高运用面向对象知识分析实际问题、解决实际问题的能力,提高我们的应用能力。3设计任务使用图形用户界面,使用真实的全球通资费标准,模拟统计一个特定号的一个月的实时话费。能根据输入实现各种用户的话费的计算并显示月实时账单。(使用接口和多个子类实现分别表示金卡、银卡等各种套餐的话费计算)4 设计内容 输入界面4.1 概要设计如图进入查询主界面 输出界面输入界面输出界面输入界面输入界面进入选择界面 点击 选择金卡 选择银卡 输入帐号和密码 输入帐号和密码 图1.0 4.2 程序代码 import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.awt.event.ActionEvent;public class QuanQiuTong1 extends Frame private static final long serialVersionUID = -687904501047398950L;Button b=new Button(欢迎来到全球通话费查询系统点击进入); public QuanQiuTong () this.setTitle(全球通话费查询系统); this.setLayout(new BorderLayout(); this.add(b); b.setForeground(Color.red); b.addActionListener(new MyListener1(); this.setBounds(100,200,300,300); b.setBackground(Color.green); this.setVisible(true); public static void main(String args) new QuanQiuTong1(); class MyListener1 implements ActionListener public void actionPerformed(ActionEvent e) new ZhongLei(); class ZhongLei extends Frame private static final long serialVersionUID = 8766071926133806787L;private JRadioButton r1=new JRadioButton(金卡); private JRadioButton r2=new JRadioButton(银卡); private Panel p0=new Panel(); private Label l0=new Label(请选择你使用的卡的种类); private Panel p1=new Panel(); public ZhongLei () l0.setForeground(Color.red); this.setTitle(选卡窗口); this.setLayout(new GridLayout(2,1); p0.add(l0); p1.add(r1); r1.setSelected(false); r1.addActionListener(new MyListener11(); p1.add(r2); r2.setSelected(false); r2.addActionListener(new MyListener11(); this.add(p0); this.add(p1); this.setBounds(300,200,250,250); this.setBackground(Color.green); this.setVisible(true); public static void main(String args) new ZhongLei(); class MyListener11 implements ActionListener public void actionPerformed(ActionEvent e) if(r1.isSelected() new JinKa(); if(r2.isSelected() new YinKa(); class JinKa extends Frame private static final long serialVersionUID = -7904065589243691833L; private Label l1=new Label(欢迎查询金卡费用); private Label l2=new Label(卡号:); private Label l3=new Label(密码:); private Panel p0=new Panel(); private Panel p1=new Panel(); private Panel p2=new Panel(); private Panel p3=new Panel(); private Button b=new Button(查询); private TextField t1=new TextField(11); private TextField t2=new TextField(11); public JinKa() l1.setForeground(Color.yellow); this.setTitle(金卡); this.setLayout(new GridLayout(4,1); this.setBounds(550,200,250,250); p1.add(l2);p2.add(l3); p0.add(l1);p1.add(t1);p2.add(t2);p3.add(b); t1.addActionListener(new MTextField1(); t2.addActionListener(new MTextField2(); t2.setEchoChar(*); b.addActionListener(new JinKa1(); this.add(p0);this.add(p1);this.add(p2);this.add(p3); this.setBackground(Color.green); this.setVisible(true); public static void main(String args) new JinKa(); class YinKa extends Frame private static final long serialVersionUID = -2696746332725644863L;private Label l1=new Label(欢迎查询银卡费用); private Label l2=new Label(卡号:); private Label l3=new Label(密码:); private Panel p0=new Panel(); private Panel p1=new Panel(); private Panel p2=new Panel(); private Panel p3=new Panel(); private Button b=new Button(查询); private TextField t1=new TextField(11); private TextField t2=new TextField(11); public YinKa() l1.setForeground(Color.red); this.setTitle(银卡); this.setLayout(new GridLayout(4,1); this.setBounds(550,200,250,250); p1.add(l2);p2.add(l3);
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号