




全文预览已结束
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
Java程序设计实验报告Java Programming Assignment一、任务(问题)描述编写一个记事本程序:用图形用户界面实现。能实现编辑、保存、另存为、查找替换等功能。二、设计与实现(多少个Java文件,每个文件中的类)类 名属 性方 法事件处理备 注ClassNotepedJPanel contentPanepublic Notepad()void FileCut (ActionEvent e)JMenuBar jMenuBar1boolean toExit()void FileCopy(ActionEvent e)JMenu jMenuFilevoid FileNew()void FilePaste(ActionEvent e)JMenu jMenuFileEditvoid FileOpen()void FileFindNext(ActionEvent e)JTextArea jTextArea1boolean FileSave()void FileTime(ActionEvent e)String filenameboolean FileSaveTo()void FileLine(ActionEvent e)String filepath;void updateFname()public void actionPerformed(ActionEvent e)String strtextvoid FileClose()boolean bsavedclass Frame1JButton jButton1public Frame1(JTextArea jTextArea1)public void processWindowEvent(WindowEvent e)JButton jButton2public void jbInit() public void actionPerformed(ActionEvent e)JButton jButton3public void find()class Button1ListenerJLabel jLabel1public void replace()class Button2ListenerJLabel jLabel2class Button3ListenerJTextField jTextField1JTextField jTextField2JRadioButton teamsButtonGroup jjString findstr附:源程序代码框架public class Notepad extends JFrame implements ActionListener,MouseListener public Notepad() . . . . . . . . . . . . . .boolean toExit(). . . . . . . . . /调用文件新建void FileNew() . . . . . . . ./调用文件打开void FileOpen(). . . . . . . . . /调用保存对话框boolean FileSave(). . . . . . . . /调用另存对话框boolean FileSaveTo() . . . . . . . ./更改标题void updateFname(). . . . . . . /文件关闭void FileClose() . . . . . . /调用编辑剪切void FileCut (ActionEvent e). . . . . . . . . /调用编辑复制void FileCopy(ActionEvent e) . . . . . . . . /调用编辑粘贴void FilePaste(ActionEvent e) . . . . . . . . ./换行void FileLine(ActionEvent e) . . . . . . . . . /行为事件public void actionPerformed(ActionEvent e) . . . . . . . . . . . /主函数 public static void main(String args) / TODO 自动生成方法存根 new Notepad(); . . . . . . . . . . . . . . . . . . . . . . . . .class File_saveto_actionAdapter implements ActionListener . . . . . . . class File_close_actionAdapter implements ActionListener . . . . . . . /查找类 class Frame1 extends JDialog implements ActionListener . . . . . . . . . public Frame1(JTextArea jTextArea1) . . . . . . . . . . . public void jbInit() throws Exception . . . . . . . . . . public void actionPerformed(ActionEvent e) . . . . . . . . . . public void processWindowEvent(WindowEvent e) . . . . . . . . . . public void find() . . . . . . . . . . /替换 public void replace() . . . . . . . . class Button1Listener implements ActionListener . . . . . . . . . . . . . . class Button2Listener implements ActionListener . . . . . . . . . . . . . class Button3Listener implements ActionListener . . . . . . . . . . 三、界面设计与事件处理1.界面设计:包括两个菜单,文件和编辑;文件中有新建、打开、保持、另存为和退出;编辑中有剪切、复制、粘贴、查找和时间;并且以上操作设置了快捷键。2.事件处理:点击新建、保存、打开后出现一个窗口,设置存储地址和记事本名字;点击退出时,弹出窗口询问是否保存,点击时间,文本中出现现在的时间;点击替换可以替换文本中的相同的文字。四、感想作为学习计算机的一个学生,计算机语言的
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025河南宋城水务科技发展有限公司招聘3人考前自测高频考点模拟试题及参考答案详解
- 洗鞋店专业知识讲解培训课件
- 2025湖南长沙市望城区卫健人才公开引进29人模拟试卷及答案详解(网校专用)
- 2025嘉兴市众业供电服务有限公司招聘74人模拟试卷有完整答案详解
- 2025辽宁沈阳副食集团所属子公司拟聘用人员考前自测高频考点模拟试题及一套完整答案详解
- 洗车水管安全知识培训课件
- 2025内蒙古大唐锡林浩特电厂招聘消防车驾驶员1人模拟试卷附答案详解(模拟题)
- 洗车培训基础知识
- 2025福建林业职业技术学院招聘23人模拟试卷附答案详解(黄金题型)
- 2025江苏邳州市炮车中学(邳州一中)毕业生招聘编制教师17人考前自测高频考点模拟试题及答案详解一套
- 2024年秋季新教材三年级上册PEP英语教学课件:含视频音频U3-第1课时-A
- 公安涉警舆情课件
- 医院培训课件:《类风湿关节炎的治疗与康复》
- DB34∕T 3790-2021 智慧药房建设指南
- 实验小学六年级上学期素养竞赛语文试卷(有答案)
- 2024年高级执法资格考试题及解析
- 酒店住宿清单模板共5份不同模板
- 景区标识标牌投标方案
- 新学期新起点励志奋斗青春初三毕业班开学第一课主题班会课件
- 2023年自考中国古代文学史试卷及答案
- T-CPQS C010-2024 鉴赏收藏用潮流玩偶及类似用途产品
评论
0/150
提交评论