Undo « JTextPane « Java Swing Q&A





2. urgent help needed ..... regarding undo/redo and JTextPane    forums.oracle.com

import javax.swing.*; import javax.swing.event.UndoableEditEvent; import javax.swing.event.UndoableEditListener; import javax.swing.text.Document; import javax.swing.undo.*; import javax.swing.*; import javax.swing.event.*; import javax.swing.text.*; import java.awt.*; import java.util.*; import java.util.regex.*; public class jTextPane extends JTextPane { protected LineNr txtarea; protected int fileflag=0,changeFlag; protected FileDialog fd_save,fd_saveas; protected String filePath,fileName,fileDirectory; protected UndoManager undo; String outputFile=""; Document doc; public jTextPane() { undo = new UndoManager(); doc = this.getDocument(); try { doc.addUndoableEditListener(new UndoableEditListener() ...