@Override public void close() throws IOException { logger.trace("close called"); if (thread != null && !thread.isInterrupted()) { thread = null; logger.trace("building doc "); final PlainDocument doc = new CharInsertableDocument(content); logger.trace("built doc"); try { SwingUtilities.invokeAndWait(() -> { jtextArea.setDocument(doc); logger.trace("set doc"); }); } catch (InterruptedException | InvocationTargetException e) { throw new IOException(e); } } } }
@Override public void close() throws IOException { logger.trace("close called"); if (thread != null && !thread.isInterrupted()) { thread = null; logger.trace("building doc "); final PlainDocument doc = new CharInsertableDocument(content); logger.trace("built doc"); try { SwingUtilities.invokeAndWait(() -> { jtextArea.setDocument(doc); logger.trace("set doc"); }); } catch (InterruptedException | InvocationTargetException e) { throw new IOException(e); } } } }
/** * Constructs a plain text document. A default root element is created, * and the tab size set to 8. Text already in c is processed as if it had been inserted - i.e. elements are * created for each line. * * @param c the container for the content */ CharInsertableDocument(CharInsertableGapContent c) { super(c); DefaultDocumentEvent event = new DefaultDocumentEvent(0, c.length(), DocumentEvent.EventType.INSERT); insertUpdate(event, null); event.end(); fireInsertUpdate(event); } }
/** * Constructs a plain text document. A default root element is created, * and the tab size set to 8. Text already in c is processed as if it had been inserted - i.e. elements are * created for each line. * * @param c the container for the content */ CharInsertableDocument(CharInsertableGapContent c) { super(c); DefaultDocumentEvent event = new DefaultDocumentEvent(0, c.length(), DocumentEvent.EventType.INSERT); insertUpdate(event, null); event.end(); fireInsertUpdate(event); } }