⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 notoedit.txt

📁 恩自己写的记事本 自己写的记事本 自己写的记事本 自己写的记事本
💻 TXT
📖 第 1 页 / 共 2 页
字号:
} 

void jMenuEditRedo_actionPerformed(ActionEvent e) { 
edit.redo(); 
} 

void jMenuEdit_focusGained(FocusEvent e) { 
boolean selFlag = false; 
if (jTextArea1.getSelectedText() != null) { 
selFlag = true; 
} 
jMenuEditCopy.setEnabled(selFlag); 
jMenuEditCut.setEnabled(selFlag); 
boolean copyedFlag = false; 
if (sysClipboard.getContents(this) != null) { 
copyedFlag = true; 
} 
jMenuEditPaste.setEnabled(copyedFlag); 
jMenuEditUndo.setEnabled(edit.canUndo() ); 
jMenuEditRedo.setEnabled(edit.canRedo() ); 
} 
} 


class TextEditorFrame_jMenuHelpAbout_ActionAdapter implements ActionListener { 
TextEditorFrame adaptee; 

TextEditorFrame_jMenuHelpAbout_ActionAdapter(TextEditorFrame adaptee) { 
this.adaptee = adaptee; 
} 
public void actionPerformed(ActionEvent e) { 
adaptee.jMenuHelpAbout_actionPerformed(e); 
} 
} 

class TextEditorFrame_jMenuFileNew_actionAdapter implements java.awt.event.ActionListener { 
TextEditorFrame adaptee; 

TextEditorFrame_jMenuFileNew_actionAdapter(TextEditorFrame adaptee) { 
this.adaptee = adaptee; 
} 
public void actionPerformed(ActionEvent e) { 
adaptee.jMenuFileNew_actionPerformed(e); 
} 
} 

class TextEditorFrame_jMenuFileOpen_actionAdapter implements java.awt.event.ActionListener { 
TextEditorFrame adaptee; 

TextEditorFrame_jMenuFileOpen_actionAdapter(TextEditorFrame adaptee) { 
this.adaptee = adaptee; 
} 
public void actionPerformed(ActionEvent e) { 
adaptee.jMenuFileOpen_actionPerformed(e); 
} 
} 

class TextEditorFrame_jMenuFileSave_actionAdapter implements java.awt.event.ActionListener { 
TextEditorFrame adaptee; 

TextEditorFrame_jMenuFileSave_actionAdapter(TextEditorFrame adaptee) { 
this.adaptee = adaptee; 
} 
public void actionPerformed(ActionEvent e) { 
adaptee.jMenuFileSave_actionPerformed(e); 
} 
} 

class TextEditorFrame_jMenuFileSaveas_actionAdapter implements java.awt.event.ActionListener { 
TextEditorFrame adaptee; 

TextEditorFrame_jMenuFileSaveas_actionAdapter(TextEditorFrame adaptee) { 
this.adaptee = adaptee; 
} 
public void actionPerformed(ActionEvent e) { 
adaptee.jMenuFileSaveas_actionPerformed(e); 
} 
} 

class TextEditorFrame_jMenuFileExit_actionAdapter implements java.awt.event.ActionListener { 
TextEditorFrame adaptee; 

TextEditorFrame_jMenuFileExit_actionAdapter(TextEditorFrame adaptee) { 
this.adaptee = adaptee; 
} 
public void actionPerformed(ActionEvent e) { 
adaptee.jMenuFileExit_actionPerformed(e); 
} 
} 

class TextEditorFrame_jMenuEditCopy_actionAdapter implements java.awt.event.ActionListener { 
TextEditorFrame adaptee; 

TextEditorFrame_jMenuEditCopy_actionAdapter(TextEditorFrame adaptee) { 
this.adaptee = adaptee; 
} 
public void actionPerformed(ActionEvent e) { 
adaptee.jMenuEditCopy_actionPerformed(e); 
} 
} 

class TextEditorFrame_jMenuEditCut_actionAdapter implements java.awt.event.ActionListener { 
TextEditorFrame adaptee; 

TextEditorFrame_jMenuEditCut_actionAdapter(TextEditorFrame adaptee) { 
this.adaptee = adaptee; 
} 
public void actionPerformed(ActionEvent e) { 
adaptee.jMenuEditCut_actionPerformed(e); 
} 
} 

class TextEditorFrame_jMenuEditPaste_actionAdapter implements java.awt.event.ActionListener { 
TextEditorFrame adaptee; 

TextEditorFrame_jMenuEditPaste_actionAdapter(TextEditorFrame adaptee) { 
this.adaptee = adaptee; 
} 
public void actionPerformed(ActionEvent e) { 
adaptee.jMenuEditPaste_actionPerformed(e); 
} 
} 


class TextEditorFrame_jMenuEditColor_actionAdapter implements java.awt.event.ActionListener { 
TextEditorFrame adaptee; 

TextEditorFrame_jMenuEditColor_actionAdapter(TextEditorFrame adaptee) { 
this.adaptee = adaptee; 
} 
public void actionPerformed(ActionEvent e) { 
adaptee.jMenuEditColor_actionPerformed(e); 
} 
} 

class TextEditorFrame_jMenuEditBColor_actionAdapter implements java.awt.event.ActionListener { 
TextEditorFrame adaptee; 

TextEditorFrame_jMenuEditBColor_actionAdapter(TextEditorFrame adaptee) { 
this.adaptee = adaptee; 
} 
public void actionPerformed(ActionEvent e) { 
adaptee.jMenuEditBColor_actionPerformed(e); 
} 
} 

class TextEditorFrame_document1_documentAdapter implements javax.swing.event.DocumentListener { 
TextEditorFrame adaptee; 

TextEditorFrame_document1_documentAdapter(TextEditorFrame adaptee) { 
this.adaptee = adaptee; 
} 
public void insertUpdate(DocumentEvent documentEvent) { 
adaptee.document1_insertUpdate(documentEvent); 
} 
public void removeUpdate(DocumentEvent documentEvent) { 
adaptee.document1_removeUpdate(documentEvent); 
} 
public void changedUpdate(DocumentEvent documentEvent) { 
adaptee.document1_changedUpdate(documentEvent); 
} 
} 

class TextEditorFrame_document1_undoableEditAdapter implements javax.swing.event.UndoableEditListener { 
TextEditorFrame adaptee; 

TextEditorFrame_document1_undoableEditAdapter(TextEditorFrame adaptee) { 
this.adaptee = adaptee; 
} 
public void undoableEditHappened(UndoableEditEvent e) { 
adaptee.document1_undoableEditHappened(e); 
} 
} 

class TextEditorFrame_jMenuEditUndo_actionAdapter implements java.awt.event.ActionListener { 
TextEditorFrame adaptee; 

TextEditorFrame_jMenuEditUndo_actionAdapter(TextEditorFrame adaptee) { 
this.adaptee = adaptee; 
} 
public void actionPerformed(ActionEvent e) { 
adaptee.jMenuEditUndo_actionPerformed(e); 
} 
} 

class TextEditorFrame_jMenuEditRedo_actionAdapter implements java.awt.event.ActionListener { 
TextEditorFrame adaptee; 

TextEditorFrame_jMenuEditRedo_actionAdapter(TextEditorFrame adaptee) { 
this.adaptee = adaptee; 
} 
public void actionPerformed(ActionEvent e) { 
adaptee.jMenuEditRedo_actionPerformed(e); 
} 
} 

class TextEditorFrame_jMenuEdit_focusAdapter extends java.awt.event.FocusAdapter { 
TextEditorFrame adaptee; 

TextEditorFrame_jMenuEdit_focusAdapter(TextEditorFrame adaptee) { 
this.adaptee = adaptee; 
} 
public void focusGained(FocusEvent e) { 
adaptee.jMenuEdit_focusGained(e); 
} 
} 


package texteditor; 

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

/** 
* <p>Title: 文本编辑器</p> 
* <p>Description: </p> 
* <p>Copyright: Copyright (c) 2003</p> 
* <p>Company: bjut</p> 
* @author haofeng 
* @version 1.0 
*/ 

public class TextEditorFrame_AboutBox extends JDialog implements ActionListener { 

JPanel panel1 = new JPanel(); 
JPanel panel2 = new JPanel(); 
JPanel insetsPanel1 = new JPanel(); 
JPanel insetsPanel2 = new JPanel(); 
JPanel insetsPanel3 = new JPanel(); 
JButton button1 = new JButton(); 
JLabel imageLabel = new JLabel(); 
JLabel label1 = new JLabel(); 
JLabel label2 = new JLabel(); 
JLabel label3 = new JLabel(); 
JLabel label4 = new JLabel(); 
ImageIcon image1 = new ImageIcon(); 
BorderLayout borderLayout1 = new BorderLayout(); 
BorderLayout borderLayout2 = new BorderLayout(); 
FlowLayout flowLayout1 = new FlowLayout(); 
GridLayout gridLayout1 = new GridLayout(); 
String product = "\u6587\u672c\u7f16\u8f91\u5668"; 
String version = "1.0"; 
String copyright = "Copyright (c) 2003"; 
String comments = ""; 
public TextEditorFrame_AboutBox(Frame parent) { 
super(parent); 
enableEvents(AWTEvent.WINDOW_EVENT_MASK); 
try { 
jbInit(); 
} 
catch(Exception e) { 
e.printStackTrace(); 
} 
} 
//Component initialization 
private void jbInit() throws Exception { 
image1 = new ImageIcon(texteditor.TextEditorFrame.class.getResource("about.png")); 
imageLabel.setIcon(image1); 
this.setTitle("About"); 
panel1.setLayout(borderLayout1); 
panel2.setLayout(borderLayout2); 
insetsPanel1.setLayout(flowLayout1); 
insetsPanel2.setLayout(flowLayout1); 
insetsPanel2.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); 
gridLayout1.setRows(4); 
gridLayout1.setColumns(1); 
label1.setText(product); 
label2.setText(version); 
label3.setText(copyright); 
label4.setText(comments); 
insetsPanel3.setLayout(gridLayout1); 
insetsPanel3.setBorder(BorderFactory.createEmptyBorder(10, 60, 10, 10)); 
button1.setText("Ok"); 
button1.addActionListener(this); 
insetsPanel2.add(imageLabel, null); 
panel2.add(insetsPanel2, BorderLayout.WEST); 
this.getContentPane().add(panel1, null); 
insetsPanel3.add(label1, null); 
insetsPanel3.add(label2, null); 
insetsPanel3.add(label3, null); 
insetsPanel3.add(label4, null); 
panel2.add(insetsPanel3, BorderLayout.CENTER); 
insetsPanel1.add(button1, null); 
panel1.add(insetsPanel1, BorderLayout.SOUTH); 
panel1.add(panel2, BorderLayout.NORTH); 
setResizable(true); 
} 
//Overridden so we can exit when window is closed 
protected void processWindowEvent(WindowEvent e) { 
if (e.getID() == WindowEvent.WINDOW_CLOSING) { 
cancel(); 
} 
super.processWindowEvent(e); 
} 
//Close the dialog 
void cancel() { 
dispose(); 
} 
//Close the dialog on a button event 
public void actionPerformed(ActionEvent e) { 
if (e.getSource() == button1) { 
cancel(); 
} 
} 
} 

package texteditor; 

import javax.swing.UIManager; 
import java.awt.*; 

/** 
* <p>Title: 文本编辑器</p> 
* <p>Description: </p> 
* <p>Copyright: Copyright (c) 2003</p> 
* <p>Company: bjut</p> 
* @author haofeng 
* @version 1.0 
*/ 

public class TextEditor { 
boolean packFrame = false; 

//Construct the application 
public TextEditor() { 
TextEditorFrame frame = new TextEditorFrame(); 
//Validate frames that have preset sizes 
//Pack frames that have useful preferred size info, e.g. from their layout 
if (packFrame) { 
frame.pack(); 
} 
else { 
frame.validate(); 
} 
//Center the window 
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); 
Dimension frameSize = frame.getSize(); 
if (frameSize.height > screenSize.height) { 
frameSize.height = screenSize.height; 
} 
if (frameSize.width > screenSize.width) { 
frameSize.width = screenSize.width; 
} 
frame.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); 
frame.setVisible(true); 
} 
//Main method 
public static void main(String[] args) { 
try { 
UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); 
} 
catch(Exception e) { 
e.printStackTrace(); 
} 
new TextEditor(); 
} 
} 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -