Results 1 to 7 of 7
  1. #1
    jogendar is offline Member
    Join Date
    Jan 2010
    Posts
    13
    Rep Power
    0

    Default problem with editorkit-undo/redo

    hello everyone,
    i am creating simple text editor,in that i created text pane like this
    Java Code:
    final JTextPane jta;
        jta = new JTextPane();
        jta.setEditable(true);
        final StyledDocument doc = jta.getStyledDocument();
        final UndoManager manager = new UndoManager();
        final RTFEditorKit kit = new RTFEditorKit();
        jta.setEditorKit(kit);
    but my problem is that undo/redo are not working if i set rtf editorkit
    to the textpane,but without rtf-editorkit i cant save the document with font styles..

    how can i manage these two and get them happen

  2. #2
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,457
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by jogendar View Post
    hello everyone,
    i am creating simple text editor,in that i created text pane like this
    Java Code:
    final JTextPane jta;
        jta = new JTextPane();
        jta.setEditable(true);
        final StyledDocument doc = jta.getStyledDocument();
        final UndoManager manager = new UndoManager();
        final RTFEditorKit kit = new RTFEditorKit();
        jta.setEditorKit(kit);
    but my problem is that undo/redo are not working if i set rtf editorkit
    to the textpane,but without rtf-editorkit i cant save the document with font styles..

    how can i manage these two and get them happen
    What happens when you do: doc.addUndoableEditListener(manager)?

    kind regards,

    Jos

  3. #3
    jogendar is offline Member
    Join Date
    Jan 2010
    Posts
    13
    Rep Power
    0

    Default

    @above person

    i have added the line u said also in the code but it doesnt helped me,i cant undo/redo until rtf editor kit is deleted..... whats the problem with these two???

  4. #4
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,457
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by jogendar View Post
    @above person

    i have added the line u said also in the code but it doesnt helped me,i cant undo/redo until rtf editor kit is deleted..... whats the problem with these two???
    What happens when you first set the kit and then set the undoable manager?

    kind regards,

    Jos

  5. #5
    jogendar is offline Member
    Join Date
    Jan 2010
    Posts
    13
    Rep Power
    0

    Default

    i have tried by changing the order of declaring and setting them to the textpane,but none of them worked...

  6. #6
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,457
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by jogendar View Post
    @above person

    i have added the line u said also in the code but it doesnt helped me,i cant undo/redo until rtf editor kit is deleted..... whats the problem with these two???
    Darn, there's also a line in the API documentation for the RTFEditorKit that worries me: "The RTF support was not written by the Swing team ...". The rest of the Swing API documentation is fuzzy at best when it comes to this; sorry, I'm out of ideas for now; I'll let you know when I find something.

    kind regards,

    Jos

  7. #7
    jogendar is offline Member
    Join Date
    Jan 2010
    Posts
    13
    Rep Power
    0

Similar Threads

  1. redo and undo feature for jtable
    By anilkumar_vist in forum AWT / Swing
    Replies: 1
    Last Post: 01-05-2010, 09:45 AM
  2. [Beginner]Eclipse RCP Undo/redo operation
    By pollux in forum Eclipse
    Replies: 2
    Last Post: 02-18-2009, 06:39 PM
  3. SWT Undo Redo
    By Java Tip in forum SWT
    Replies: 0
    Last Post: 07-11-2008, 04:43 PM
  4. Undo/Redo JTextArea
    By Java Tip in forum javax.swing
    Replies: 0
    Last Post: 06-27-2008, 07:52 PM
  5. undo java
    By new214 in forum New To Java
    Replies: 1
    Last Post: 11-20-2007, 09:16 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •