📄 texteditor4.java
字号:
if (toExit()) { //检查文件状态,然后退出
System.exit(0);
}
}
void document_changedUpdate(DocumentEvent e) {
if (!isSaved) {
isSaved = true; //设置文件已改动
updateFileName(); //设置文件标题
}
}
void document_insertUpdate(DocumentEvent e) {
if (!isSaved) {
isSaved = true; //设置文件已改动
updateFileName(); //设置文件标题
}
}
void document_removeUpdate(DocumentEvent e) {
if (!isSaved) {
isSaved = true; //设置文件已改动
updateFileName(); //设置文件标题
}
}
void jMenuItem6_actionPerformed(ActionEvent e) {
Color color = JColorChooser.showDialog(this, "前景色",
jTextArea1.getForeground()); //打开颜色选择对话框,选择前景色
if (color != null) {
jTextArea1.setForeground(color); //设置前景色
}
}
void jMenuItem7_actionPerformed(ActionEvent e) {
Color color = JColorChooser.showDialog(this, "前景色",
jTextArea1.getBackground()); //打开颜色选择对话框,选择背景色
if (color != null) {
jTextArea1.setBackground(color); //设置背景色
}
}
void jMenuItem8_actionPerformed(ActionEvent e) {
/* fontChooser1.setSelectedFont(jTextArea1.getFont());
if(fontChooser1.showDialog()){
Font font = fontChooser1.getSelectedFont();
if (font != null) {
jTextArea1.setFont(font);
}
}*/
fontChooser1.setSelectedFont(jTextArea1.getFont()); //设置文本域中的字体
if (fontChooser1.showDialog()) {
Font font = fontChooser1.getSelectedFont();
jTextArea1.setFont(font);
}
this.repaint();
jTextArea1.repaint();
}
void jButton1_actionPerformed(ActionEvent e) {
newFile();
}
void jButton2_actionPerformed(ActionEvent e) {
openFile();
}
void jButton3_actionPerformed(ActionEvent e) {
save();
}
void jButton4_actionPerformed(ActionEvent e) {
saveAs();
}
void jMenuItem9_actionPerformed(ActionEvent e) {
AboutDialog aboutDialog = new AboutDialog(this, "关于", false);
Dimension dlgSize =new Dimension(300,225);
Dimension frmSize = getSize();
Point loc = getLocation();
aboutDialog.setLocation( (frmSize.width - dlgSize.width) / 2 + loc.x,
(frmSize.height - dlgSize.height) / 2 + loc.y);
aboutDialog.setModal(true);
aboutDialog.setSize(dlgSize);
aboutDialog.show();
}
}
class TextEditor4_jMenuItem1_actionAdapter
implements java.awt.event.ActionListener {
TextEditor4 adaptee;
TextEditor4_jMenuItem1_actionAdapter(TextEditor4 adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jMenuItem1_actionPerformed(e);
}
}
class TextEditor4_jMenuItem2_actionAdapter
implements java.awt.event.ActionListener {
TextEditor4 adaptee;
TextEditor4_jMenuItem2_actionAdapter(TextEditor4 adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jMenuItem2_actionPerformed(e);
}
}
class TextEditor4_jMenuItem3_actionAdapter
implements java.awt.event.ActionListener {
TextEditor4 adaptee;
TextEditor4_jMenuItem3_actionAdapter(TextEditor4 adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jMenuItem3_actionPerformed(e);
}
}
class TextEditor4_jMenuItem4_actionAdapter
implements java.awt.event.ActionListener {
TextEditor4 adaptee;
TextEditor4_jMenuItem4_actionAdapter(TextEditor4 adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jMenuItem4_actionPerformed(e);
}
}
class TextEditor4_jMenuItem5_actionAdapter
implements java.awt.event.ActionListener {
TextEditor4 adaptee;
TextEditor4_jMenuItem5_actionAdapter(TextEditor4 adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jMenuItem5_actionPerformed(e);
}
}
class TextEditor4_document_documentAdapter
implements javax.swing.event.DocumentListener {
TextEditor4 adaptee;
TextEditor4_document_documentAdapter(TextEditor4 adaptee) {
this.adaptee = adaptee;
}
public void insertUpdate(DocumentEvent e) {
adaptee.document_insertUpdate(e);
}
public void removeUpdate(DocumentEvent e) {
adaptee.document_removeUpdate(e);
}
public void changedUpdate(DocumentEvent e) {
adaptee.document_changedUpdate(e);
}
}
class TextEditor4_jMenuItem6_actionAdapter
implements java.awt.event.ActionListener {
TextEditor4 adaptee;
TextEditor4_jMenuItem6_actionAdapter(TextEditor4 adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jMenuItem6_actionPerformed(e);
}
}
class TextEditor4_jMenuItem7_actionAdapter
implements java.awt.event.ActionListener {
TextEditor4 adaptee;
TextEditor4_jMenuItem7_actionAdapter(TextEditor4 adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jMenuItem7_actionPerformed(e);
}
}
class TextEditor4_jMenuItem8_actionAdapter
implements java.awt.event.ActionListener {
TextEditor4 adaptee;
TextEditor4_jMenuItem8_actionAdapter(TextEditor4 adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jMenuItem8_actionPerformed(e);
}
}
class TextEditor4_jButton1_actionAdapter
implements java.awt.event.ActionListener {
TextEditor4 adaptee;
TextEditor4_jButton1_actionAdapter(TextEditor4 adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton1_actionPerformed(e);
}
}
class TextEditor4_jButton2_actionAdapter
implements java.awt.event.ActionListener {
TextEditor4 adaptee;
TextEditor4_jButton2_actionAdapter(TextEditor4 adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton2_actionPerformed(e);
}
}
class TextEditor4_jButton3_actionAdapter
implements java.awt.event.ActionListener {
TextEditor4 adaptee;
TextEditor4_jButton3_actionAdapter(TextEditor4 adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton3_actionPerformed(e);
}
}
class TextEditor4_jButton4_actionAdapter
implements java.awt.event.ActionListener {
TextEditor4 adaptee;
TextEditor4_jButton4_actionAdapter(TextEditor4 adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton4_actionPerformed(e);
}
}
class TextEditor4_jMenuItem9_actionAdapter
implements java.awt.event.ActionListener {
TextEditor4 adaptee;
TextEditor4_jMenuItem9_actionAdapter(TextEditor4 adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jMenuItem9_actionPerformed(e);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -