-
大小: 105KB文件類型: .rar金幣: 2下載: 0 次發(fā)布日期: 2021-06-08
- 語言: Java
- 標簽:
資源簡介
仿照windows記事本設(shè)計,具有“文件”,“編輯”,“格式”,“幫助”四個主菜單,文件菜單包含“新建”,“打開”,“保存”和“另存為”四個功能,編輯菜單包含“剪切”,“復(fù)制”,“粘貼”,“刪除”,“全選”和“加解密功能”,格式菜單主要包括“字形”,“字體顏色”,“大小”和“大小寫轉(zhuǎn)換” 的功能

代碼片段和文件信息
/*
?*?To?change?this?template?choose?Tools?|?Templates
?*?and?open?the?template?in?the?editor.
?*/
package?texteditor;
/**
?*
?*?@author?Administrator
?*/
import?java.awt.*;
import?java.awt.event.*;
import?javax.swing.*;
import?java.io.*;
public?class?TextEditor?extends?frame?implements?ActionListener
{
????private?frame?mainframe;//主框架
????private?MenuBar?menubar?=?new?MenuBar();//菜單條
????private?Menu?filemenu?=?new?Menu(“文件“);
????private?Menu?editmenu?=?new?Menu(“編輯“);
????private?Menu?formmenu?=?new?Menu(“格式“);
????private?Menu?helpmenu?=?new?Menu(“幫助“);
????private?MenuItem?mNew??mOpen??mSave??mSaveAs??mExit;//文件菜單項:新建,打開,保存,另存為,退出
????private?MenuItem?mCut??mCopy??mPaste??mDelete??mAll;//編輯菜單項:剪切,復(fù)制,粘貼,刪除
????private?MenuItem?mFont??mColor??mSize??mLowtoCapital??mCapitaltoLow??mEncrypt??mDisencrypt;//格式菜單項:字體
????private?MenuItem?mAbout;
????private?TextArea?tf?=?new?TextArea();//文本區(qū)
????private?int?id_font;//字體
????private?int?id_size;//大小
????private?String?tempString;//臨時字符串用于存儲需要復(fù)制粘貼的字符串
????String?fileName?=?““;//上次保存后的文件名和地址
????public?int?a?=?0??b?=?0??c?=?0;
????public?String?s1?=?“red:“?+?a?+?“?“?+?“green:“?+?b?+?“?“?+?“blue“?+?c;
????JDialog?dialog?=?new?JDialog(this?“顏色“?true);
????Container?cp?=?dialog.getContentPane();
????JLabel[]?lb?=?new?JLabel[8];
????JLabel?lb1?=?new?JLabel(s1?JLabel.LEFT);
????JButton?b1?=?new?JButton(“確定“)
????????????b2?=?new?JButton(“取消“);
????JComboBox?jc1?=?new?JComboBox()//組合框
????????????jc2?=?new?JComboBox()
????????????jc3?=?new?JComboBox();
????JScrollBar?jb1?=?new?JScrollBar(JScrollBar.HORIZONTAL?10?5?0?260);//卷東條
????JScrollBar?jb2?=?new?JScrollBar(JScrollBar.HORIZONTAL?10?5?0?260);
????JScrollBar?jb3?=?new?JScrollBar(JScrollBar.HORIZONTAL?10?5?0?260);
????public?TextEditor()?{
????????//框架
????????super(“文本編輯器“);
????????tf?=?new?TextArea(30?60);
????????tf.setFont(new?Font(“Times?New?Rome“?Font.PLAIN?15));
????????//文件
????????mNew?=?new?MenuItem(“新建“);
????????mNew.addActionListener(this);
????????mOpen?=?new?MenuItem(“打開“);
????????mOpen.addActionListener(this);
????????mSave?=?new?MenuItem(“保存“);
????????mSave.addActionListener(this);
????????mSaveAs?=?new?MenuItem(“另存為“);
????????mSaveAs.addActionListener(this);
????????mExit?=?new?MenuItem(“退出“);
????????mExit.addActionListener(this);
????????//添加文件菜單項
????????filemenu.add(mNew);
????????filemenu.add(mOpen);
????????filemenu.addSeparator();
????????filemenu.add(mSave);
????????filemenu.add(mSaveAs);
????????filemenu.addSeparator();
????????filemenu.add(mExit);
????????//編輯
????????mCut?=?new?MenuItem(“剪切“);
????????mCut.addActionListener(this);
????????mCopy?=?new?MenuItem(“復(fù)制“);
????????mCopy.addActionListener(this);
????????mPaste?=?new?MenuItem(“粘貼“);
????????mPaste.addActionListener(this);
????????mDelete?=?new?MenuItem(“刪除“);
????????mDelete.addActionListener(this);
????????mEncrypt?=?new?MenuItem(“加密“);
????????mEncrypt.addActionListener(this);
????????mDisencrypt?=?new?MenuItem(“解密“);
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????580??2009-05-14?20:00??文本編輯器\nbproject\project.xm
?????文件????????271??2009-05-18?19:27??文本編輯器\nbproject\private\private.properties
?????文件????????211??2009-05-18?21:09??文本編輯器\nbproject\private\private.xm
?????文件???????1917??2009-05-14?20:00??文本編輯器\nbproject\project.properties
?????文件??????34060??2009-05-14?20:00??文本編輯器\nbproject\build-impl.xm
?????文件????????455??2009-05-14?20:00??文本編輯器\nbproject\genfiles.properties
?????文件???????3725??2009-05-14?20:00??文本編輯器\build.xm
?????文件??????22974??2009-05-18?20:41??文本編輯器\src\texteditor\TextEditor.java
?????文件?????????85??2009-05-14?20:00??文本編輯器\manifest.mf
?????文件??????????0??2009-05-14?20:45??文本編輯器\nullnull
?????文件????????654??2009-05-18?20:41??文本編輯器\build\classes\texteditor\TextEditor$win.class
?????文件????????733??2009-05-18?20:41??文本編輯器\build\classes\texteditor\TextEditor$1.class
?????文件????????733??2009-05-18?20:41??文本編輯器\build\classes\texteditor\TextEditor$2.class
?????文件????????733??2009-05-18?20:41??文本編輯器\build\classes\texteditor\TextEditor$3.class
?????文件????????799??2009-05-18?20:41??文本編輯器\build\classes\texteditor\TextEditor$4.class
?????文件????????780??2009-05-18?20:41??文本編輯器\build\classes\texteditor\TextEditor$5.class
?????文件????????754??2009-05-18?20:41??文本編輯器\build\classes\texteditor\TextEditor$6.class
?????文件????????780??2009-05-18?20:41??文本編輯器\build\classes\texteditor\TextEditor$7.class
?????文件????????754??2009-05-18?20:41??文本編輯器\build\classes\texteditor\TextEditor$8.class
?????文件???????1355??2009-05-18?20:41??文本編輯器\build\classes\texteditor\TextEditor$adjust.class
?????文件???????1407??2009-05-18?20:41??文本編輯器\build\classes\texteditor\TextEditor$MyItemListener_font.class
?????文件???????1412??2009-05-18?20:41??文本編輯器\build\classes\texteditor\TextEditor$MyItemListener_size.class
?????文件??????14126??2009-05-18?20:41??文本編輯器\build\classes\texteditor\TextEditor.class
?????文件??????????0??2009-05-14?20:46??文本編輯器\build\classes\.netbeans_automatic_build
?????文件???????1449??2009-05-14?20:46??文本編輯器\dist\README.TXT
?????文件??????25309??2009-05-14?20:46??文本編輯器\dist\javadoc\texteditor\TextEditor.html
?????文件????????910??2009-05-14?20:46??文本編輯器\dist\javadoc\texteditor\package-fr
?????文件???????5716??2009-05-14?20:46??文本編輯器\dist\javadoc\texteditor\package-summary.html
?????文件???????5801??2009-05-14?20:46??文本編輯器\dist\javadoc\texteditor\package-tree.html
?????文件???????5569??2009-05-14?20:46??文本編輯器\dist\javadoc\texteditor\class-use\TextEditor.html
............此處省略41個文件信息
評論
共有 條評論