/*
* NotePad.java
*
* Created on __DATE__, __TIME__
*/
package gui.com;
import java.awt.event.*;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import javax.swing.JFileChooser;
/**
*
* @author __USER__
*/
public class NotePad extends javax.swing.JFrame implements ActionListener {
/** Creates new form NotePad */
public NotePad() {
initComponents(); //注册监听
this.itemCopy.addActionListener(this);
this.itemZhuangTai.addActionListener(this);
this.itemSave.addActionListener(this);
this.itemPaste.addActionListener(this);
this.itemOpen.addActionListener(this);
this.itemNew.addActionListener(this);
this.itemCut.addActionListener(this);
this.itemDelete.addActionListener(this);
this.itemExit.addActionListener(this);
this.itemFont.addActionListener(this);
this.mPaste.addActionListener(this);
this.mCut.addActionListener(this);
this.mCopy.addActionListener(this);
this.mDelete.addActionListener(this);
this.setLocationRelativeTo(null); //窗体显示位置
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
//GEN-BEGIN:initComponents
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
popMenu = new javax.swing.JPopupMenu();
mCut = new javax.swing.JMenuItem();
mCopy = new javax.swing.JMenuItem();
mPaste = new javax.swing.JMenuItem();
mDelete = new javax.swing.JMenuItem();
jScrollPane1 = new javax.swing.JScrollPane();
ta = new javax.swing.JTextArea();
jMenuBar1 = new javax.swing.JMenuBar();
mFile = new javax.swing.JMenu();
itemNew = new javax.swing.JMenuItem();
itemOpen = new javax.swing.JMenuItem();
itemSave = new javax.swing.JMenuItem();
jSeparator1 = new javax.swing.JSeparator();
itemExit = new javax.swing.JMenuItem();
mEdit = new javax.swing.JMenu();
itemCut = new javax.swing.JMenuItem();
itemCopy &
java记事本中的格式设置
最新推荐文章于 2022-08-07 16:54:52 发布
本文档展示了如何使用Java创建一个简单的记事本程序,包括文件打开、保存、编辑功能。程序集成了常见的文本编辑操作,如复制、粘贴、剪切、删除,以及字体设置等。
摘要由CSDN通过智能技术生成