2个回答
2013-08-23
展开全部
import java.awt.*;
import java.awt.event.*;
import java.io.*;
public class Note extends Frame implements ActionListener{
private Menu filemenu = new Menu("文件");
private Menu editmenu = new Menu("编辑");
private Menu formatmenu = new Menu("格式");
private Menu helpmenu = new Menu("帮助");
private Menu lookmenu = new Menu("查看");
private MenuItem filenew = new MenuItem("新建");
private MenuItem fileopen = new MenuItem("打开...");
private MenuItem filesave = new MenuItem("保存");
private MenuItem fileexit = new MenuItem("退出");
private MenuItem filesaveas = new MenuItem("另存为...");
private MenuItem cut = new MenuItem("剪切");
private MenuItem copy = new MenuItem("复制");
private MenuItem paste = new MenuItem("粘贴");
private MenuItem allselect = new MenuItem("全选");
private MenuItem delete = new MenuItem("删除");
private MenuItem font = new MenuItem("字体...");
private MenuItem statusbar = new MenuItem("状态栏");
private MenuItem help = new MenuItem("帮助...");
private TextArea text = new TextArea();
private String filename="";//用来记录文件地址和文件名
private String pasteplate;//剪切板
private class WindowCloser extends WindowAdapter
{
public void windowClosing(WindowEvent e)
{System.exit(0);}
}
public Note(String title)
{
super(title);
//添加文件菜单项
filemenu.add(filenew);
filemenu.add(fileopen);
filemenu.add(filesave);
filemenu.add(filesaveas);
filemenu.addSeparator();
filemenu.add(fileexit);
//添加编辑菜单项
editmenu.add(cut);
editmenu.add(copy);
editmenu.add(paste);
editmenu.add(allselect);
editmenu.add(delete);
//添加格式菜单项
formatmenu.add(font);
//添加查看菜单项
lookmenu.add(statusbar);
//添加帮助菜单项
helpmenu.add(help);
MenuBar menu = new MenuBar();
menu.add(filemenu);
menu.add(editmenu);
menu.add(formatmenu);
menu.add(lookmenu);
menu.add(helpmenu);
setMenuBar(menu);
setLayout(new BorderLayout());
add("Center",text);
text.setEditable(true);
setSize(800,500);
import java.awt.event.*;
import java.io.*;
public class Note extends Frame implements ActionListener{
private Menu filemenu = new Menu("文件");
private Menu editmenu = new Menu("编辑");
private Menu formatmenu = new Menu("格式");
private Menu helpmenu = new Menu("帮助");
private Menu lookmenu = new Menu("查看");
private MenuItem filenew = new MenuItem("新建");
private MenuItem fileopen = new MenuItem("打开...");
private MenuItem filesave = new MenuItem("保存");
private MenuItem fileexit = new MenuItem("退出");
private MenuItem filesaveas = new MenuItem("另存为...");
private MenuItem cut = new MenuItem("剪切");
private MenuItem copy = new MenuItem("复制");
private MenuItem paste = new MenuItem("粘贴");
private MenuItem allselect = new MenuItem("全选");
private MenuItem delete = new MenuItem("删除");
private MenuItem font = new MenuItem("字体...");
private MenuItem statusbar = new MenuItem("状态栏");
private MenuItem help = new MenuItem("帮助...");
private TextArea text = new TextArea();
private String filename="";//用来记录文件地址和文件名
private String pasteplate;//剪切板
private class WindowCloser extends WindowAdapter
{
public void windowClosing(WindowEvent e)
{System.exit(0);}
}
public Note(String title)
{
super(title);
//添加文件菜单项
filemenu.add(filenew);
filemenu.add(fileopen);
filemenu.add(filesave);
filemenu.add(filesaveas);
filemenu.addSeparator();
filemenu.add(fileexit);
//添加编辑菜单项
editmenu.add(cut);
editmenu.add(copy);
editmenu.add(paste);
editmenu.add(allselect);
editmenu.add(delete);
//添加格式菜单项
formatmenu.add(font);
//添加查看菜单项
lookmenu.add(statusbar);
//添加帮助菜单项
helpmenu.add(help);
MenuBar menu = new MenuBar();
menu.add(filemenu);
menu.add(editmenu);
menu.add(formatmenu);
menu.add(lookmenu);
menu.add(helpmenu);
setMenuBar(menu);
setLayout(new BorderLayout());
add("Center",text);
text.setEditable(true);
setSize(800,500);
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-08-23
展开全部
给你、给你、来拿哈、
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询