📄 textedit.java
字号:
package util2;import javax.swing.*;import javax.swing.text.*;import javax.swing.event.*;import java.awt.event.*;import java.awt.*;import javax.swing.text.AbstractDocument.*;import util2.*;import util3.*;import util4.*;import util5.*;public class TextEdit extends Xeditor implements DocumentListener{ public TextEdit() { super(); this.getDocument().addDocumentListener(this); } public void insertUpdate(DocumentEvent e){ DefaultDocumentEvent dde=(DefaultDocumentEvent)e; System.out.println("offset:"+dde.getOffset()+" length:"+dde.getLength()); ((AbstractElement)((AbstractDocument)getDocument()).getBidiRootElement()).toString(); } public void removeUpdate(DocumentEvent e){System.out.println("remove");} public void changedUpdate(DocumentEvent e){System.out.println("change");} public static void main(String[] arg) { class Trymain implements CountListener,ERCListener{ Trymain(){} public void setCountText(String cou){} public void dispPopMen(MouseEvent e){} } JFrame jf=new JFrame("try it."); JScrollPane scroPan = new JScrollPane(); jf.setSize(400,300); TextEdit xe=new TextEdit(); Trymain tm=new Trymain(); xe.addCountListener(tm); xe.addERCListener(tm); scroPan.getViewport().add(xe, null); jf.getContentPane().add(scroPan); JPanel panel=new JPanel(); //panel.add(undoBtn); //panel.add(redoBtn); jf.getContentPane().add(panel,BorderLayout.SOUTH); //jf.getContentPane().add(jtf,BorderLayout.SOUTH); //FileDialog fd=new FileDialog(jf); //fd.setBounds(250,200,200,140); jf.show(); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -