欢迎来到天天文库
浏览记录
ID:41975818
大小:75.00 KB
页数:4页
时间:2019-09-05
《合肥学院java实验7-8--简易记事本》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、importjavax.swing.JTextArea;importjavax.swing」Frame;importjava.awt.PopupMenu;importjava.awt.Menu;importjava.awt.MenuShortcut;importjava.awt.event.ActionListener;importjava.awt.event.MouseListener;importjava.awt.eventA/VindowListener;importjava.awt.event.ActionEvent;importjava.awt
2、.event.WindowEvent;importjava.awt.event.MouseEvent;importjava.awt.MenuBar;importjava.awt.CheckboxMenultem;importjavax.swing.undo.UndoManager;importjavax.swing.event.UndoableEditEvent;importjavax.swing.event.UndoableEditListener;importjava.awt.event.KeyEvent;importjava.awt.Menulte
3、m;importjava.awt.Font;publicclassSimpleMenuimplementsActionListener,MouseListener;WincloA/Listenei;UndoableEditListenerprivateJTextAreaarea=newJTextArea(15,50);privateJFrameframe=newJFrame("Alex.o制作:记事本”);privateMenuBarmuBar=newMenuBar();PopupMenupop=newPopupMenu();FontFt=newFon
4、t(H楷体“,Font.ROMAN_BASEUNE,18);UndoManagerum=newUndoManager();//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX状态栏菜单IxxxxxxxxxxxMenufile=newMenu("文件”);Menuedit=newMenu("编辑”);newMenultem("新建笃newnewMenultem(n保存舄newnewMenultem(M退出",newnewMenultem(••全选蔦newnewMenultemC复制n,newnewMenultem(H剪切蔦new
5、MenultemnewltemMenuShortcut(KeyEvent.l//CA/));MenultemsaveitemMenuShortcut(KeyEvent.//C5));MenultemexititemMenuShortcut(KeyEvent.//CQ));Menultemallltem=MenuShortcut(KeyEventV/C^));Menultemcopyitem:MenuShortcut(KeyEvent.l//CC));MenuitemshearitemMenuShortcut(KeyEvent.V/(_X));Menu
6、ltempasteitem=newMenultem「粘贝占,,,newMenuShortcut(KeyEvent.l//7、));Menultemunnoteltem=newMenultem(M取消注释蔦newMenuShortcut(KeyEventV/CL/,true));CheckboxMenultemautoWrap2=newCheckboxMenultem("口动换行”);//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX鼠标右键菜单IxxxxxxxxxxMenultemcopyMouse=newMenuitem(”复制”);MenuitempasteMouse=newMenultem(H粘贴“);MenuitemallMouse=ne8、wMenultem(n金选”);MenultemshearMouse=newMe
7、));Menultemunnoteltem=newMenultem(M取消注释蔦newMenuShortcut(KeyEventV/CL/,true));CheckboxMenultemautoWrap2=newCheckboxMenultem("口动换行”);//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX鼠标右键菜单IxxxxxxxxxxMenultemcopyMouse=newMenuitem(”复制”);MenuitempasteMouse=newMenultem(H粘贴“);MenuitemallMouse=ne
8、wMenultem(n金选”);MenultemshearMouse=newMe
此文档下载收益归作者所有