用Java程序编写记事本

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

public class Notepad extends JFrame {

// 系统组件声明
private JMenuBar menuBar = new JMenuBar();
private JEditorPane content = new JEditorPane();
private JScrollPane scroll = new JScrollPane(content);
private JFileChooser filechooser = new JFileChooser() ;
private BorderLayout bord = new BorderLayout();
private JLabel statusBar = new JLabel();
private JPanel pane = new JPanel();
private File file = null;

// 定义文件菜单
private JMenu fileMenu = new JMenu();
private JMenuItem newMenuItem = new JMenuItem();
private JMenuItem openMenuItem = new JMenuItem();
private JMenuItem saveMenuItem = new JMenuItem();
private JMenuItem saveAsMenuItem = new JMenuItem();
private JMenuItem pageSetupMenuItem = new JMenuItem();
private JMenuItem printMenuItem = new JMenuItem();
private JMenuItem exitMenuItem = new JMenuItem();
// 定义风格菜单
private JMenu styleMenu = new JMenu();
private ButtonGroup styleMenuGroup = new ButtonGroup();
private JRadioButtonMenuItem javaStyleMenuItem = new JRadioButtonMenuItem();
private JRadioButtonMenuItem metalStyleMenuItem = new JRadioButtonMenuItem();
private JRadioButtonMenuItem windowsStyleMenuItem = new JRadioButtonMenuItem();

// 定义帮助菜单
private JMenuItem aboutMenuItem = new JMenuItem();
private JMenuItem helpTopicMenuItem = new JMenuItem();
private JMenu helpMenu = new JMenu();

// 构造函数
public Notepad(){
initComponents();
}

private void initComponents(){

// 添加子菜单项到文件菜单 
fileMenu.setText("/u6587/u4ef6 (F)");
newMenuItem.setText(" 新建(N)    Ctrl+N");
openMenuItem.setText(" 打开(O)...    Ctrl+O");
saveMenuItem.setText(" 保存(S)    Ctrl+S");
saveAsMenuItem.setText(" 另存为(A)...");
pageSetupMenuItem.setText(" 页面设置(U)...");
printMenuItem.setText(" 打印(P)...    Ctrl+P");
exitMenuItem.setText(" 退出");
fileMenu.add(newMenuItem);
fileMenu.add(openMenuItem);
fileMenu.add(saveMenuItem);
fileMenu.add(saveAsMenuItem);
fileMenu.addSeparator();
fileMenu.add(pageSetupMenuItem);
fileMenu.add(printMenuItem);
fileMenu.addSeparator();
fileMenu.add(exitMenuItem);

// 添加子菜单项到风格菜单
     styleMenu.setText("风格(S)");
        javaStyleMenuItem.setText("Java默认");
     metalStyleMenuItem.setText("Metal风格");
     windowsStyleMenuItem.setText("Windows风格");
styleMenuGroup.add(javaStyleMenuItem);
     styleMenuGroup.add(metalStyleMenuItem);
     styleMenuGroup.add(windowsStyleMenuItem);
styleMenu.add(javaStyleMenuItem);
styleMenu.add(metalStyleMenuItem);
styleMenu.add(windowsStyleMenuItem);

// 添加子菜单项到帮助菜单
helpMenu.setText("帮助(H)");
helpTopicMenuItem.setText(" 帮助主题(H)");
aboutMenuItem.setText(" 关于记事本(A)");
helpMenu.add(helpTopicMenuItem);
helpMenu.addSeparator();
helpMenu.add(aboutMenuItem);

// 定义文件菜单下的事件监听
newMenuItem.addActionListener(new newMenuItem_actionAdapter(this));
openMenuItem.addActionListener(new openMenuItem_actionAdapter(this));
saveMenuItem.addActionListener(new saveMenuItem_actionAdapter(this));
saveAsMenuItem.addActionListener(new saveAsMenuItem_actionAdapter(this));
pageSetupMenuItem.addActionListener(new pageSetupMenuItem_actionAdapter(this));
printMenuItem.addActionListener(new printMenuItem_actionAdapter(this));
exitMenuItem.addActionListener(new exitMenuItem_actionAdapter(this));

// 定义风格菜单下的事件监听
javaStyleMenuItem.addActionListener(new javaStyleMenuItem_actionAdapter(this));
metalStyleMenuItem.addActionListener(new metalStyleMenuItem_actionAdapter(this));
windowsStyleMenuItem.addActionListener(new windowsStyleMenuItem_actionAdapter(this));

// 定义帮助菜单下的事件监听
helpTopicMenuItem.addActionListener(new helpTopicMenuItem_actionAdapter(this));
aboutMenuItem.addActionListener(new aboutMenuItem_actionAdapter(this));

// 填加菜单到菜单栏
menuBar.add(fileMenu);
menuBar.add(styleMenu);
menuBar.add(helpMenu);

// 对主窗口的一些设置
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
this.setTitle("无标题 - /u8bb0/u4e8b/u672c");
this.setSize(640,480);

setJMenuBar(menuBar);
pane.setLayout(bord);
pane.add("Center",scroll);
setContentPane(pane);
}
// 定义新建菜单项方法
public void newMenuItemActionPerformed(ActionEvent evt){
  file = null;
if(!("".equals(content.getText()))){
Object[] options = { " 是(Y) ", " 否(N) "," 取消 " };
int s = JOptionPane.showOptionDialog(null, "/u6587/u4ef6 "+getTitle()+" /u7684/u6587/u5b57/u5df2/u7ecf/u6539/u53d8/u3002/n/u60f3/u4fdd/u5b58/u6587/u4ef6/u5417/uff1f", "/u8bb0/u4e8b/u672c", 
JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE,
null, options, options[0]);
switch(s){
case 0:
int returnVal=filechooser.showSaveDialog(this);
if(returnVal == JFileChooser.APPROVE_OPTION) {
file=filechooser.getSelectedFile();
try{
   FileWriter fw=new FileWriter(file);
   fw.write(content.getText());
   setTitle(filechooser.getSelectedFile().getName()+" - /u8bb0/u4e8b/u672c");
   fw.close();
   }
   catch(Exception e){
   e.printStackTrace();
   }
break;
  }
  case 1:
  content.setText("");
  setTitle("无标题 - /u8bb0/u4e8b/u672c");
  }
}
}

// 定义打开菜单项方法
public void openMenuItemActionPerformed(ActionEvent evt){
try {
file = null;
int returnVal = filechooser.showOpenDialog(this);
if(returnVal == JFileChooser.APPROVE_OPTION){
file = filechooser.getSelectedFile();
FileReader fr = new FileReader(file);
int len = (int)file.length();
char[] buffer = new char[len];
fr.read(buffer,0,len);
fr.close();
content.setText(new String(buffer));
}
}
catch(Exception e){
   e.printStackTrace();
   }
}

// 定义退出菜单项方法
  public void exitMenuItem_actionPerformed(ActionEvent e){
if(!("".equals(content.getText()))){
Object[] options = { " 是(Y) ", " 否(N) "," 取消 " };
int s = JOptionPane.showOptionDialog(null, "文件的文字已经改变。/n想保存文件吗?", "/u8bb0/u4e8b/u672c", 
JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE,
null, options, options[0]);
switch(s){
case 0:
int returnVal=filechooser.showSaveDialog(this);
if(returnVal == JFileChooser.APPROVE_OPTION) {
file=filechooser.getSelectedFile();
try{
   FileWriter fw=new FileWriter(file);
   fw.write(content.getText());
   setTitle(filechooser.getSelectedFile().getName()+" - /u8bb0/u4e8b/u672c");
   fw.close();
   }
   catch(Exception ex){
   ex.printStackTrace();
   }
break;
  }
  case 1:
System.exit(0);
  }
}
else{
System.exit(0);
}
}

// 保存事件
public void saveMenuItemActionPerformed(ActionEvent evt){
int returnVal=filechooser.showSaveDialog(this);
if(returnVal == JFileChooser.APPROVE_OPTION) {
file=filechooser.getSelectedFile();
 
try{
   FileWriter fw=new FileWriter(file);
   fw.write(content.getText());
   setTitle(filechooser.getSelectedFile().getName()+" - /u8bb0/u4e8b/u672c");
   fw.close();
   }
   catch(Exception e){
   e.printStackTrace();
   }
}
}

// 另存为事件
public void saveAsMenuItemActionPerformed(ActionEvent evt){
filechooser.setDialogTitle("另存为...");
int returnVal = filechooser.showSaveDialog(this);
if(returnVal == JFileChooser.APPROVE_OPTION) {
file=filechooser.getSelectedFile();
try{
   FileWriter fw=new FileWriter(file);
   fw.write(content.getText());
   setTitle(filechooser.getSelectedFile().getName()+" - /u8bb0/u4e8b/u672c");
   fw.close();
   }
   catch(Exception e){
   e.printStackTrace();
   }

}

}

// 页面设置事件 
public void pageSetupMenuItemActionPerformed(ActionEvent evt){
JOptionPane.showMessageDialog(null,"此功能正在开发中...");
}

// 打印事件
public void printMenuItemActionPerformed(ActionEvent evt){
JOptionPane.showMessageDialog(null,"打印中...");
  }
 
// 更新风格外观方法
void changeLookFeel(String className) {
try {
UIManager.setLookAndFeel(className);
}
catch (Exception e) {
System.out.println(e);
}
SwingUtilities.updateComponentTreeUI(this);
}
 
  // Java风格事件
  public void javaStyleMenuItemActionPerformed(ActionEvent evt){
     changeLookFeel("javax.swing.plaf.metal.MetalLookAndFeel");
  }
 
// Motif风格事件
  public void metalStyleMenuItemActionPerformed(ActionEvent evt){
     changeLookFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
  }

// MAC风格事件
  public void windowsStyleMenuItemActionPerformed(ActionEvent evt){
     changeLookFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
  }  
  // 帮助事件
  public void helpTopicMenuItemActionPerformed(ActionEvent evt){
  JOptionPane.showMessageDialog(null,"/u9700/u8981/u5e2e/u52a9/u5417/uff1f");
  }

   // 关于事件
   public void aboutMenuItemActionPerformed(ActionEvent evt){
   JOptionPane.showMessageDialog(null,"/n/u7a0b/u5e8f/u540d/u79f0/uff1aJava /u8bb0/u4e8b/u672c/n/u4ee3/u7801/u7f16/u5199/uff1aCavien/n/u4f5c/u8005/u7f51/u7ad9/uff1ahttp:/www.cavien.com/nE-mail/u3000/uff1aCavien@163.com");

  }
    // 主函数
   public static void main(String args[]) {
Notepad notepad = new Notepad();
notepad.setVisible(true);
}

}

// 定义新建事件类
class newMenuItem_actionAdapter implements ActionListener{
Notepad adaptee;

newMenuItem_actionAdapter(Notepad adaptee){
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent evt){
adaptee.newMenuItemActionPerformed(evt);
}
}
// 定义打开事件类
class openMenuItem_actionAdapter implements ActionListener{
Notepad adaptee;

openMenuItem_actionAdapter(Notepad adaptee){
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent evt){
adaptee.openMenuItemActionPerformed(evt);
}
}

// 定义保存事件类
class saveMenuItem_actionAdapter implements ActionListener{
Notepad adaptee;

saveMenuItem_actionAdapter(Notepad adaptee){
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent evt){
adaptee.saveMenuItemActionPerformed(evt);
}
}

// 定义另存为事件类
class saveAsMenuItem_actionAdapter implements ActionListener{
Notepad adaptee;

saveAsMenuItem_actionAdapter(Notepad adaptee){
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent evt){
adaptee.saveAsMenuItemActionPerformed(evt);
}
}

// 定义页面设置事件类
class pageSetupMenuItem_actionAdapter implements ActionListener{
Notepad adaptee;

pageSetupMenuItem_actionAdapter(Notepad adaptee){
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent evt){
adaptee.pageSetupMenuItemActionPerformed(evt);
}
}

// 定义打印事件类
class printMenuItem_actionAdapter implements ActionListener{
Notepad adaptee;

printMenuItem_actionAdapter(Notepad adaptee){
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent evt){
adaptee.printMenuItemActionPerformed(evt);
}
}

// 定义Java风格事件类
class javaStyleMenuItem_actionAdapter implements ActionListener{
Notepad adaptee;

javaStyleMenuItem_actionAdapter(Notepad adaptee){
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent evt){
adaptee.javaStyleMenuItemActionPerformed(evt);

}
}

// 定义Java风格事件类
class metalStyleMenuItem_actionAdapter implements ActionListener{
Notepad adaptee;

metalStyleMenuItem_actionAdapter(Notepad adaptee){
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent evt){
adaptee.metalStyleMenuItemActionPerformed(evt);
}
}

// 定义Java风格事件类
class windowsStyleMenuItem_actionAdapter implements ActionListener{
Notepad adaptee;

windowsStyleMenuItem_actionAdapter(Notepad adaptee){
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent evt){
adaptee.windowsStyleMenuItemActionPerformed(evt);
}
}

// 定义帮助主题事件类
class helpTopicMenuItem_actionAdapter implements ActionListener{
Notepad adaptee;

helpTopicMenuItem_actionAdapter(Notepad adaptee){
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent evt){
adaptee.helpTopicMenuItemActionPerformed(evt);
}
}

// 定义关于软件事件类
class aboutMenuItem_actionAdapter implements ActionListener{
Notepad adaptee;

aboutMenuItem_actionAdapter(Notepad adaptee){
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent evt){
adaptee.aboutMenuItemActionPerformed(evt);
}
}

// 定义退出事件类
class exitMenuItem_actionAdapter implements ActionListener  {
Notepad adaptee;

exitMenuItem_actionAdapter(Notepad adaptee){
this.adaptee = adaptee;

public void actionPerformed(ActionEvent evt){
adaptee.exitMenuItem_actionPerformed(evt);
}

import java.awt.BorderLayout; import java.awt.Container; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.InputEvent; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import javax.swing.BorderFactory; import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JOptionPane; import javax.swing.JPopupMenu; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.KeyStroke; import javax.swing.ScrollPaneConstants; import javax.swing.SwingConstants; public class JNotePadUI extends JFrame { private JMenuItem menuOpen; private JMenuItem menuSave; private JMenuItem menuSaveAs; private JMenuItem menuClose; private JMenu editMenu; private JMenuItem menuCut; private JMenuItem menuCopy; private JMenuItem menuPaste; private JMenuItem menuAbout; private JTextArea textArea; private JLabel stateBar; private JFileChooser fileChooser; private JPopupMenu popUpMenu; public JNotePadUI() { super("新建文本文件"); setUpUIComponent(); setUpEventListener(); setVisible(true); } private void setUpUIComponent() { setSize(640, 480); // 菜单栏 JMenuBar menuBar = new JMenuBar(); // 设置「文件」菜单 JMenu fileMenu = new JMenu("文件"); menuOpen = new JMenuItem("打开"); // 快捷键设置 menuOpen.setAccelerator( KeyStroke.getKeyStroke( KeyEvent.VK_O, InputEvent.CTRL_MASK)); menuSave = new JMenuItem("保存"); menuSave.setAccelerator( KeyStroke.getKeyStroke( KeyEvent.VK_S, InputEvent.CTRL_MASK)); menuSaveAs = new JMenuItem("另存为"); menuClose = new JMenuItem("关闭"); menuClose.setAccelerator( KeyStroke.getKeyStroke( KeyEvent.VK_Q, InputEvent.CTRL_MASK)); fileMenu.add(menuOpen); fileMenu.addSeparator(); // 分隔线 fileMenu.add(menuSave); fileMenu.add(menuSaveAs); fileMenu.addSeparator(); // 分隔线 fileMenu.add(menuClose); // 设置「编辑」菜单 JMenu editMenu = new JMenu("编辑"); menuCut = new JMenuItem("剪切"); menuCut.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_X, InputEvent.CTRL_MASK)); menuCopy = new JMenuItem("复制"); menuCopy.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_MASK)); menuPaste = new JMenuItem("粘贴"); menuPaste.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_V, InputEvent.CTRL_MASK)); editMenu.add(menuCut); editMenu.add(menuCopy); editMenu.add(menuPaste); // 设置「关于」菜单 JMenu aboutMenu = new JMenu("关于"); menuAbout = new JMenuItem("关于JNotePad"); aboutMenu.add(menuAbout); menuBar.add(fileMenu); menuBar.add(editMenu); menuBar.add(aboutMenu); setJMenuBar(menuBar); // 文字编辑区域 textArea = new JTextArea(); textArea.setFont(new Font("宋体", Font.PLAIN, 16)); textArea.setLineWrap(true); JScrollPane panel = new JScrollPane(textArea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); Container contentPane = getContentPane(); contentPane.add(panel, BorderLayout.CENTER); // 状态栏 stateBar = new JLabel("未修改"); stateBar.setHorizontalAlignment(SwingConstants.LEFT); stateBar.setBorder( BorderFactory.createEtchedBorder()); contentPane.add(stateBar, BorderLayout.SOUTH); popUpMenu = editMenu.getPopupMenu(); fileChooser = new JFileChooser(); } private void setUpEventListener() { // 按下窗口关闭钮事件处理 addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { closeFile(); } } ); // 菜单 - 打开 menuOpen.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { openFile(); } } ); // 菜单 - 保存 menuSave.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { saveFile(); } } ); // 菜单 - 另存为 menuSaveAs.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { saveFileAs(); } } ); // 菜单 - 关闭文件 menuClose.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { closeFile(); } } ); // 菜单 - 剪切 menuCut.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { cut(); } } ); // 菜单 - 复制 menuCopy.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { copy(); } } ); // 菜单 - 粘贴 menuPaste.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { paste(); } } ); // 菜单 - 关于 menuAbout.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { // 显示对话框 JOptionPane.showOptionDialog(null, "程序名称:\n JNotePad \n" + "程序设计:\n \n" + "简介:\n 一个简单的文字编辑器\n" + " 可作为验收Java的实现对象\n" + " 欢迎网友下载研究交流\n\n" + " /", "关于JNotePad", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, null, null, null); } } ); // 编辑区键盘事件 textArea.addKeyListener( new KeyAdapter() { public void keyTyped(KeyEvent e) { processTextArea(); } } ); // 编辑区鼠标事件 textArea.addMouseListener( new MouseAdapter() { public void mouseReleased(MouseEvent e) { if(e.getButton() == MouseEvent.BUTTON3) popUpMenu.show(editMenu, e.getX(), e.getY()); } public void mouseClicked(MouseEvent e) { if(e.getButton() == MouseEvent.BUTTON1) popUpMenu.setVisible(false); } } ); } private void openFile() { if(isCurrentFileSaved()) { // 文件是否为保存状态 open(); // 打开 } else { // 显示对话框 int option = JOptionPane.showConfirmDialog( null, "文件已修改,是否保存?", "保存文件?", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null); switch(option) { // 确认文件保存 case JOptionPane.YES_OPTION: saveFile(); // 保存文件 break; // 放弃文件保存 case JOptionPane.NO_OPTION: open(); break; } } } private boolean isCurrentFileSaved() { if(stateBar.getText().equals("未修改")) { return false; } else { return true; } } private void open() { // fileChooser 是 JFileChooser 的实例 // 显示文件选取的对话框 int option = fileChooser.showDialog(null, null); // 使用者按下确认键 if(option == JFileChooser.APPROVE_OPTION) { try { // 开启选取的文件 BufferedReader buf = new BufferedReader( new FileReader( fileChooser.getSelectedFile())); // 设定文件标题 setTitle(fileChooser.getSelectedFile().toString()); // 清除前一次文件 textArea.setText(""); // 设定状态栏 stateBar.setText("未修改"); // 取得系统相依的换行字符 String lineSeparator = System.getProperty("line.separator"); // 读取文件并附加至文字编辑区 String text; while((text = buf.readLine()) != null) { textArea.append(text); textArea.append(lineSeparator); } buf.close(); } catch(IOException e) { JOptionPane.showMessageDialog(null, e.toString(), "开启文件失败", JOptionPane.ERROR_MESSAGE); } } } private void saveFile() { // 从标题栏取得文件名称 File file = new File(getTitle()); // 若指定的文件不存在 if(!file.exists()) { // 执行另存为 saveFileAs(); } else { try { // 开启指定的文件 BufferedWriter buf = new BufferedWriter( new FileWriter(file)); // 将文字编辑区的文字写入文件 buf.write(textArea.getText()); buf.close(); // 设定状态栏为未修改 stateBar.setText("未修改"); } catch(IOException e) { JOptionPane.showMessageDialog(null, e.toString(), "写入文件失败", JOptionPane.ERROR_MESSAGE); } } } private void saveFileAs() { // 显示文件对话框 int option = fileChooser.showSaveDialog(null); // 如果确认选取文件 if(option == JFileChooser.APPROVE_OPTION) { // 取得选择的文件 File file = fileChooser.getSelectedFile(); // 在标题栏上设定文件名称 setTitle(file.toString()); try { // 建立文件 file.createNewFile(); // 进行文件保存 saveFile(); } catch(IOException e) { JOptionPane.showMessageDialog(null, e.toString(), "无法建立新文件", JOptionPane.ERROR_MESSAGE); } } } private void closeFile() { // 是否已保存文件 if(isCurrentFileSaved()) { // 释放窗口资源,而后关闭程序 dispose(); } else { int option = JOptionPane.showConfirmDialog( null, "文件已修改,是否保存?", "保存文件?", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null); switch(option) { case JOptionPane.YES_OPTION: saveFile(); break; case JOptionPane.NO_OPTION: dispose(); } } } private void cut() { textArea.cut(); stateBar.setText("已修改"); popUpMenu.setVisible(false); } private void copy() { textArea.copy(); popUpMenu.setVisible(false); } private void paste() { textArea.paste(); stateBar.setText("已修改"); popUpMenu.setVisible(false); } private void processTextArea() { stateBar.setText("已修改"); } public static void main(String[] args) { new JNotePadUI(); } }
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值