- 1、本文档共20页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
第 PAGE 1 页 共 NUMPAGES 20 页
广东金融学院实验报告
课程名称:Java高级程序设计
实验编号
及实验名称
实验一 计算器
系 别
计科系
姓 名
学 号
班 级
实验地点
实验楼504
实验日期
20
实验时数
6
指导老师
同组其他成员
无
成 绩
一、实验目的
1、巩固java开发基础
2、学习Java图形界面开发技术
二、实验环境
1.使用软件:Windows XP、jdk1.6
2.实验设备:微型计算机
三、实验内容及要求
参考书本87页程序Calculator.java,以此为基础扩展其功能,设计自己的计算器。
四、实验结果(附程序运行效果图)
import java.awt.BorderLayout;
import javax.swing.JPanel;
import javax.swing.JFrame;
import javax.swing.JTextField;
import java.awt.Rectangle;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import javax.swing.JButton;
import java.awt.Point;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.ComponentOrientation;
import java.awt.Dimension;
public class Calculator extends JFrame {
private static final long serialVersionUID = 1L;
private JPanel jContentPane = null;
private JTextField tR = null;
private JPanel p = null;
private JButton jButton = null;
private JButton jButton1 = null;
private JButton jButton2 = null;
private JButton jButton3 = null;
private JButton jButton4 = null;
private JButton jButton5 = null;
private JButton jButton6 = null;
private JButton jButton7 = null;
private JButton jButton8 = null;
private JButton jButton9 = null;
private JButton jButton10 = null;
private JButton jButton11 = null;
private JButton jButton12 = null;
private JButton jButton13 = null;
private JButton jButton14 = null;
private JButton jButton15 = null;
private double result=0;
private String lastCommand==; // @jve:decl-index=0:
private boolean start=true;
private JButton jButton16 = null;
private JButton jButton17 = null;
private JButton jButton18 = null;
private JButton jButton19 = null;
/**
* This is the default constructor
*/
public Calculator() {
super();
initialize();
}
private void initialize() {
this.setSize(290, 190);
this.setResizable(false);
this.setLocation(new Point(100, 300));
this.setContentPane(getJContentPane());
this.setTitle(计算器);
}
/**
* This method initializes jC
文档评论(0)