Java tutorial
//package com.java2s; //License from project: Apache License import javax.swing.text.BadLocationException; import javax.swing.text.Document; public class Main { public static String getDocumentText(final Document document) { try { return document.getText(0, document.getLength()); } catch (BadLocationException e) { throw new RuntimeException(e); } } }