ImageVerifierCode 换一换
格式:DOCX , 页数:24 ,大小:22.28KB ,
资源ID:5799333      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bingdoc.com/d-5799333.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(java做的简单记事本范文文档格式.docx)为本站会员(b****1)主动上传,冰点文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰点文库(发送邮件至service@bingdoc.com或直接QQ联系客服),我们立即给予删除!

java做的简单记事本范文文档格式.docx

1、Inter Celeron 1G;JDK版本:1.5;五、进度计划及执行情况日期任务安排执行情况2008-1-7了解计事本的基本功能,并实现基本的框架基本框架搭建好了功能实现方法进行了整个窗口的布局调试结果最后程序能正常运行错误原因分析遇到的问题是:在开始时,文本域控件JText没有滚动条改正情况经过查API函数。在JScrollPane中添加文本域控件。在将JScollPane解决了问题。2007-1-8实现文件的打开和保存功能对文件进行正确的读写文件的打开和保存功能对文件可以进行正确的读写。刚开始进行文件读写操作时,用的是字节流,读出来的都是乱码。数据的流使用错了。使用了字符流解决了问题2

2、008-1-9实现字体风格和小的设置可以对字体进行正确设置字体名是调用系统的,字号用的是8-99号字,颜色调用java的颜色面板可以对字体的字体,字号,还有字体颜色进行相关设置,新建文件后,原来的字体颜色还保留着在新建时没有进行颜色的设置在新建后可以解决该问题2008-1-10实现查找和替换功能可以正确进行查找和替换应用的是String常用的几个方法可以进行查找和替换还有点功能上的欠缺查找到到最后一个时。不能返回重新查找有待改进2008-1-11实现字体风格的保存,保证打开后,能保持原来的风格。功能已经实现将字体风格保存到另一个文件中,打开文本时,也同时读取该文件,重新进行字体的设置。遇到过的

3、一次错误是,颜色不能正常显示,改进过,后来程序可以实现文本打开后字体维持原状。错误的使用颜色的函数已经没有问题,可以正常显示颜色。六、程序清单import java.awt.*;import java.awt.event.*;import java.io.*;import java.awt.GraphicsEnvironment;import javax.swing.*;import java.util.*;import java.awt.Graphics;class MyTextPad extends Frame implements ActionListener JTextArea tex

4、t; JScrollPane jsp; PopupMenu popm; Date date=new Date(); String str=; Dialog d,About; Choice c1,c2,c3; Button btn1,btn2; String Str1=宋体,Str2=普通,Str3=15 int temp=0; int Red=0,Green=0,Blue=0; Label lFind = new Label(查找字符串:); Label lReplace = new Label(替换字符串: TextField tFind = new TextField(10); TextF

5、ield tReplace = new TextField(10); Button bFind = new Button(查找 Button bReplace = new Button(替换 Button bReplaceAll=new Button(替换所有 Dialog dialog; Dialog findD; public MyTextPad(String str) super(str); text=new JTextArea(); text.setFont(new Font(,0,15); jsp=new JScrollPane(text); add(Center,jsp); fin

6、dD=new Dialog(this); addWindowListener(new WindowAdapter() public void windowClosing(WindowEvent e) dispose(); ); d=new Dialog(this,字体选择 d.setBounds(150,150,320,200); findD.addWindowListener(new WindowAdapter() findD.setVisible(false); d.addWindowListener(new WindowAdapter() d.setVisible(false); c1=

7、new Choice();c2=new Choice();c3=new Choice(); GraphicsEnvironment ge=GraphicsEnvironment.getLocalGraphicsEnvironment(); String fontName=ge.getAvailableFontFamilyNames(); for(int i=0;ifontName.length;i+) c1.add(fontNamei); c2.add(粗体斜体粗体与斜体 for(int i=8;100; c3.add(+i); Panel p1=new Panel(); Panel p2=n

8、ew Panel(); p1.add(c1); p1.add(c2); p1.add(c3); btn1=new Button(确定 btn2=new Button(取消 d.setLayout(new GridLayout(5,3); d.add(p1); p2.add(btn1); btn1.addActionListener(this); btn2.addActionListener(this); p2.add(btn2); d.add(p2); About=new Dialog(this,关于 About.addWindowListener(new WindowAdapter() Ab

9、out.setVisible(false); About.setBounds(300,300,150,150); About.add(new Label(蒋俊涛的计事体1.0版本); Menu mn=new Menu(文件 MenuItem miNewFile=new MenuItem(新建,new MenuShortcut(KeyEvent.VK_N); MenuItem miOpenFile=new MenuItem(打开,new MenuShortcut(KeyEvent.VK_O); MenuItem miSaveFile=new MenuItem(保存,new MenuShortcu

10、t(KeyEvent.VK_S); MenuItem miExit=new MenuItem(退出,new MenuShortcut(KeyEvent.VK_E); mn.add(miNewFile); mn.add(miOpenFile); mn.add(miSaveFile); mn.addSeparator(); mn.add(miExit); miNewFile.addActionListener(this); miOpenFile.addActionListener(this); miSaveFile.addActionListener(this); miExit.addAction

11、Listener(this); Menu mn1=new Menu(编辑 MenuItem miSelectAll=new MenuItem(全选,new MenuShortcut(KeyEvent.VK_P); MenuItem miClear=new MenuItem(清空 MenuItem miCopy=new MenuItem(复制,new MenuShortcut(KeyEvent.VK_C); MenuItem miPaste=new MenuItem(粘贴,new MenuShortcut(KeyEvent.VK_V); MenuItem miCut=new MenuItem(剪

12、切,new MenuShortcut(KeyEvent.VK_T); MenuItem miFind=new MenuItem(,new MenuShortcut(KeyEvent.VK_D); MenuItem miReplace=new MenuItem(,new MenuShortcut(KeyEvent.VK_R); MenuItem miAuto=new MenuItem(自动换行 miAuto.addActionListener(this); mn1.add(miSelectAll); mn1.add(miClear); mn1.add(miCopy); mn1.add(miPas

13、te); mn1.add(miCut); mn1.addSeparator(); mn1.add(miFind); mn1.add(miReplace); mn1.add(miAuto); miSelectAll.addActionListener(this); miClear.addActionListener(this); miCopy.addActionListener(this); miPaste.addActionListener(this); miCut.addActionListener(this); miFind.addActionListener(this); miRepla

14、ce.addActionListener(this); Menu mn2=new Menu(格式 MenuItem miFont=new MenuItem(字体,new MenuShortcut(KeyEvent.VK_F); MenuItem miColor=new MenuItem(颜色选择,new MenuShortcut(KeyEvent.VK_K); MenuItem miTime=new MenuItem(插入时间 miFont.addActionListener(this); miColor.addActionListener(this); miTime.addActionLis

15、tener(this); mn2.add(miFont); mn2.add(miColor); mn2.add(miTime); Menu mn3=new Menu(帮助 MenuItem miAbout=new MenuItem(,new MenuShortcut(KeyEvent.VK_A); miAbout.addActionListener(this); mn3.add(miAbout); FileDialog findDlg = new FileDialog(this); Panel p5=new Panel(); Panel p6=new Panel(); Panel p7=new

16、 Panel(); p7.setLayout(new GridLayout(1,2,30,30); p5.add(lFind); p5.add(tFind); p5.add(bFind); tFind.addActionListener(this); bFind.addActionListener(this); p6.add(lReplace); p6.add(tReplace); p7.add(bReplace); p7.add(bReplaceAll); p6.add(p7); tReplace.addActionListener(this); bReplace.addActionList

17、ener(this);bReplaceAll.addActionListener(this); findD.setLayout(new GridLayout(2,1,10,10); findD.setResizable(false); findD.add(p5); findD.add(p6); findD.setBounds(100,100,260,190); /弹出PopupMenu popm=new PopupMenu(); MenuItem OpenFile=new MenuItem( MenuItem SaveFile=new MenuItem( MenuItem SelectAll=

18、new MenuItem( MenuItem Copy=new MenuItem( MenuItem Paste=new MenuItem( MenuItem Cut=new MenuItem( OpenFile.addActionListener(this); SaveFile.addActionListener(this); SelectAll.addActionListener(this); Copy.addActionListener(this); Paste.addActionListener(this); Cut.addActionListener(this); popm.add(

19、OpenFile); popm.add(SaveFile); popm.add(SelectAll); popm.add(Copy); popm.add(Paste); popm.add(Cut); text.add(popm); text.addMouseListener(new MyMouseEvent(this); MenuBar Bar=new MenuBar(); Bar.add(mn); Bar.add(mn1); Bar.add(mn2); Bar.add(mn3); setMenuBar(Bar); setSize(800,600); setVisible(true); cla

20、ss MyMouseEvent extends MouseAdapter MyTextPad myParentFrame; MyMouseEvent(MyTextPad myf) myParentFrame=myf; public void mouseReleased(MouseEvent e) if(e.isPopupTrigger() myParentFrame.popm.show(Component)e.getSource(),e.getX(),e.getY(); public void actionPerformed(ActionEvent e) String strCmd=e.get

21、ActionCommand(); if(strCmd.equals() text.setFont(new Font(Str1,Font.PLAIN,15); text.setForeground(Color.black); text.setText( try openFile(); saveFile(); catch(IOException e1) System.exit(0); text.selectAll(); if(strCmd.equals( text.setText( str=text.getSelectedText(); text.insert(str,text.getCaretP

22、osition(); text.replaceRange(,text.getSelectionStart(),text.getSelectionEnd(); d.setVisible(true); Color c=JColorChooser.showDialog(this,Color.black); text.setForeground(c); Red=c.getRed(); Green=c.getGreen(); Blue=c.getBlue(); if(e.getSource()=tFind|e.getSource()=bFind) find(); return; if(e.getSour

23、ce()=tReplace|e.getSource()=bReplace) text.requestFocus(); String s1=tReplace.getText(); if (text.getSelectedText().equals(tFind.getText() int start=text.getSelectionStart(); text.replaceRange(s1, text.getSelectionStart(), text.getSelectionEnd(); text.select(start,start+s1.length(); else if(e.getSou

24、rce()=bReplaceAll) str = text.getText(); String strFind = tFind.getText(); int start = 0; int end = str.length(); int len = strFind.length(); int count=0; if (start=end-len) for (;start = end - len; start+) if (str.substring(start, start + len).equals(strFind) count+; text.replaceRange(s1, start,start + len); if

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2