用JAVA编写一个 记事本 求助各位 我急交作业

来源:百度知道 编辑:UC知道 时间:2024/06/30 16:24:20
编写一个记事本 文件/ 新建 打开 保存 页面设置 打印 退出
编辑/ 复制 剪切 粘贴 删除 全选
查找/ 查找文件 查找下一个
要求使用JAVA Swing编写

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;
class TextEditorFrame extends JFrame{
File file=null;
Color color=Color.red;

TextEditorFrame(){
initTextPane();
initAboutDialog();
initToolBar();
initMenu();
}
void initTextPane(){
getContentPane().add(new JScrollPane(text));
}

JTextPane text=new JTextPane(); //这是用来做文本框的
JFileChooser filechooser=new JFileChooser(); //文件选择框
JColorChooser colorchooser=new JColorChooser();//
JDialog about=new JDialog(this); //关于对话框
JMenuBar menubar=new JMenuBar();//菜单

JMenu[] menus=new JMenu[]{
new JMenu("文件"),
new JMenu("编辑"),
new JMenu("帮助")
};

JMenuItem menuitems[][]=new JMenuItem[][]{{
new JMenuItem("新建"),
new JMenuItem("打开"),
new JMenuItem("保存"),
new JMenu