Wednesday 15 February 2012

java - Quirk with my text editor app and DocumentListener -


I have a jetbedpad I add a tab based on an acceleration of a class (here known as textWrap) In which there is information for a JTextPane, I create a new example of the listener and pass it in the textWrap:

  tabEditorPane.addTab (filename, new text editor (New MyDocumentListener ... ..) .);  

My document changes the listener tab when the file changes. It all looks fine until I kiss Do not try to load the existing file in a text tab. The listener registers the initial BufferedReader input and an asterisk. How can I do this?

Is there a rule of thumb for this I know that after creating the text the listener can register, as the text file is loaded, but I have to see what the stack says.

When you load the file, / P>

  MyTextPane.getEditorKit (). Read (...);  

or any equivalent loading method. What you can do is replace this line with 4 steps:

  1. Remove or deactivate your document listener
  2. Load
  3. Remove the star
  4. Undo the document listener or reactivate.

To do this, you can expand, for example, type your text pane and a load method which will take these 4 steps. Anyway, the object file will handle loading, it will require reference of your DocumentListener


No comments:

Post a Comment