Java记事本源程序代码,Java记事本源代码(完整)

资源描述:

/** * 作品记事本 * 作者*** * 功能简单的文字编辑 */ import java.awt.*; import java.awt.event.*; import java.io.*; import javax.swing.*; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; class NotePad extends JFrame{ private JMenuBar menuBar; private JMenu fielMenu,editMenu,Menu,aboutMenu; private JMenuItem newMenuItem,openMenuItem,saveMenuItem,exitMenuItem; private JMenuItem cutMenuItem,copyMenuItem,pasteMenuItem,foundItem,replaceItem,selectAll; private JMenuItem font,about; private JTextArea textArea; private JFrame foundFrame,replaceFrame; private JCheckBoxMenuItem wrapline; private JTextField textField1new JTextField15; private JTextField textField2new JTextField15; private JButton startButton,replaceButton,reallButton; int start0; String value; File filenull; JFileChooser fileChoosernew JFileChooser; boolean wrapfalse; public NotePad{ //创建文本域 textAreanew JTextArea; addnew JScrollPanetextArea,BorderLayout.CENTER; //创建文件菜单及文件菜单项 fielMenunew JMenu“文件“; fielMenu.setFontnew Font“微软雅黑“,0,15; newMenuItemnew JMenuItem“新建“,new ImageIcon“icons\\new24.gif“; newMenuItem.setFontnew Font“微软雅黑“,Font.BOLD,13; newMenuItem.setAcceleratorKeyStroke.getKeyStrokeKeyEvent.VK_N,Event.CTRL_MASK; newMenuItem.addActionListenerlistener; openMenuItemnew JMenuItem“打开“,new ImageIcon“icons\\open24.gif“; openMenuItem.setFontnew Font“微软雅黑“,Font.BOLD,13; openMenuItem.setAcceleratorKeyStroke.getKeyStrokeKeyEvent.VK_O,Event.CTRL_MASK; openMenuItem.addActionListenerlistener; saveMenuItemnew JMenuItem“保存“,new ImageIcon“icons\\save.gif“; saveMenuItem.setFontnew Font“微软雅黑“,Font.BOLD,13; saveMenuItem.setAcceleratorKeyStroke.getKeyStrokeKeyEvent.VK_S,Event.CTRL_MASK; saveMenuItem.addActionListenerlistener; exitMenuItemnew JMenuItem“退出“,new ImageIcon“icons\\exit24.gif“; exitMenuItem.setFontnew Font“微软雅黑“,Font.BOLD,13; exitMenuItem.setAcceleratorKeyStroke.getKeyStrokeKeyEvent.VK_E,Event.CTRL_MASK; exitMenuItem.addActionListenerlistener; //创建编辑菜单及菜单项 editMenunew JMenu“编辑“; editMenu.setFontnew Font“微软雅黑“,0,15; cutMenuItemnew JMenuItem“剪切“,new ImageIcon“icons\\cut24.gif“; cutMenuItem.setFontnew Font“微软雅黑“,Font.BOLD,13; cutMenuItem.setAcceleratorKeyStroke.getKeyStrokeKeyEvent.VK_X,Event.CTRL_MASK; cutMenuItem.addActionListenerlistener; copyMenuItemnew JMenuItem“复制“,new ImageIcon“icons\\copy24.gif“; copyMenuItem.setFontnew Font“微软雅黑“,Font.BOLD,13; copyMenuItem.setAcceleratorKeyStroke.getKeyStrokeKeyEvent.VK_C,Event.CTRL_MASK; copyMenuItem.addActionListenerlistener; pasteMenuItemnew JMenuItem“粘贴“,new ImageIcon“icons\\paste24.gif“; pasteMenuItem.setFontnew Font“微软雅黑“,Font.BOLD,13; pasteMenuItem.setAcceleratorK

展开阅读全文

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值