3个回答
展开全部
package com.bu3g.LMS.SDK.book;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JTabbedPane;
import javax.swing.JTable;
import javax.swing.JTextArea;
import javax.swing.JToolBar;
import javax.swing.JTree;
import javax.swing.border.BevelBorder;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.filechooser.FileFilter;
import javax.swing.tree.DefaultMutableTreeNode;
/**
* 一个简单的文本编辑器,能够编辑html、java、cpp、txt文件,
* 并支持java的编译与运行
*/
@SuppressWarnings("serial")
public class SimpleEditor extends JInternalFrame {
/********菜单栏、菜单和菜单项*********/
JMenuBar menuBar = new JMenuBar();
JMenu fileMenu = new JMenu("文件");
JMenu helpMenu = new JMenu("帮助");
JMenu editMenu = new JMenu("编辑");
JMenuItem newMenuItem = new JMenuItem("新建");
JMenuItem openMenuItem = new JMenuItem("打开");
JMenuItem saveMenuItem = new JMenuItem("保存");
JMenuItem exitMenuItem = new JMenuItem("退出");
JMenuItem helpMenuItem = new JMenuItem("帮助");
JMenuItem copyMenuItem = new JMenuItem("复制");
JMenuItem cutMenuItem = new JMenuItem("剪切");
JMenuItem pasteMenuItem = new JMenuItem("粘贴");
/********文件内容的显示****/
//用多个文本域存放多个文件内容,文本域放在JScrollPane里
//而JScrollPane放在JTabbedPane中,这就是一个多页面的布局
//多个文本域,每个文本域显示一个文件的内容
JTextArea[] fileTextAreas = new JTextArea[10];
JScrollPane[] fileScrollPanes = new JScrollPane[10];
JScrollPane consoleScrollPane;
//多个文本域放在不同tab里
JTabbedPane fileTabbedPane = new JTabbedPane();
/**********工具栏以及工具栏上的按钮**********/
JToolBar toolBar = new JToolBar();
JButton openButton = new JButton(new ImageIcon(loadImage("image/open.gif")));
JButton newButton = new JButton(new ImageIcon(loadImage("image/new.gif")));
JButton saveButton = new JButton(new ImageIcon(loadImage("image/save.gif")));
JButton helpButton = new JButton(new ImageIcon(loadImage("image/help.gif")));
JButton exitButton = new JButton(new ImageIcon(loadImage("image/close.gif")));
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JTabbedPane;
import javax.swing.JTable;
import javax.swing.JTextArea;
import javax.swing.JToolBar;
import javax.swing.JTree;
import javax.swing.border.BevelBorder;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.filechooser.FileFilter;
import javax.swing.tree.DefaultMutableTreeNode;
/**
* 一个简单的文本编辑器,能够编辑html、java、cpp、txt文件,
* 并支持java的编译与运行
*/
@SuppressWarnings("serial")
public class SimpleEditor extends JInternalFrame {
/********菜单栏、菜单和菜单项*********/
JMenuBar menuBar = new JMenuBar();
JMenu fileMenu = new JMenu("文件");
JMenu helpMenu = new JMenu("帮助");
JMenu editMenu = new JMenu("编辑");
JMenuItem newMenuItem = new JMenuItem("新建");
JMenuItem openMenuItem = new JMenuItem("打开");
JMenuItem saveMenuItem = new JMenuItem("保存");
JMenuItem exitMenuItem = new JMenuItem("退出");
JMenuItem helpMenuItem = new JMenuItem("帮助");
JMenuItem copyMenuItem = new JMenuItem("复制");
JMenuItem cutMenuItem = new JMenuItem("剪切");
JMenuItem pasteMenuItem = new JMenuItem("粘贴");
/********文件内容的显示****/
//用多个文本域存放多个文件内容,文本域放在JScrollPane里
//而JScrollPane放在JTabbedPane中,这就是一个多页面的布局
//多个文本域,每个文本域显示一个文件的内容
JTextArea[] fileTextAreas = new JTextArea[10];
JScrollPane[] fileScrollPanes = new JScrollPane[10];
JScrollPane consoleScrollPane;
//多个文本域放在不同tab里
JTabbedPane fileTabbedPane = new JTabbedPane();
/**********工具栏以及工具栏上的按钮**********/
JToolBar toolBar = new JToolBar();
JButton openButton = new JButton(new ImageIcon(loadImage("image/open.gif")));
JButton newButton = new JButton(new ImageIcon(loadImage("image/new.gif")));
JButton saveButton = new JButton(new ImageIcon(loadImage("image/save.gif")));
JButton helpButton = new JButton(new ImageIcon(loadImage("image/help.gif")));
JButton exitButton = new JButton(new ImageIcon(loadImage("image/close.gif")));
追问
有没有现成的文件?
追答
有
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询