用JAVA实现windows写字板

来源:百度知道 编辑:UC知道 时间:2024/09/26 20:07:24
需要源程序 谢谢~

保存名字为 EditorDemo.txt
请尽管使用,不明白的地方,乐意交流,我的qq396173307

import java.awt.*;
import java.awt.event.*;
import java.io.*;
import javax.swing.*;
import javax.swing.text.*;

//简单的文本编辑器

public class EditorDemo extends JFrame {
JTextPane textPane = new JTextPane(); //文本窗格,编辑窗口
JLabel statusBar = new JLabel(); //状态栏
JFileChooser filechooser = new JFileChooser(); //文件选择器

public EditorDemo() { //构造函数
super("简单的文本编辑器"); //调用父类构造函数

Action[] actions = //Action数组,各种操作命令
{
new NewAction(),
new OpenAction(),
new SaveAction(),
new CutAction(),
new CopyAction(),
new PasteAction(),
new AboutAction(),
new ExitAction()};

setJMenuBar(createJMenuBar(actions)); //设置菜单栏
Container container = getContentPane(); //得到容器
container.add(createJToolBar(actions), BorderLayout.NORTH); //增加工具栏
container.add(textPane, Bo