List of usage examples for javax.swing.text DefaultStyledDocument getLength
public int getLength()
From source file:org.af.gMCP.gui.dialogs.TellAboutOnlineUpate.java
private DefaultStyledDocument getDocument() { DefaultStyledDocument doc = new DefaultStyledDocument(); logger.info("Creating About-Text."); try {/* w ww . j a va 2s . co m*/ doc.insertString(doc.getLength(), "The gMCP-GUI would like to check online for updates on each start-up.\n", getH1()); doc.insertString(doc.getLength(), "No information about your computer is send.\n" + "Nevertheless you can disable this feature with the following checkbox\n" + "or later from the options dialog.", getT()); doc.setParagraphAttributes(0, doc.getLength(), getC(), true); } catch (BadLocationException ble) { logger.error("BadLocationException was thrown. Should never happen.", ble); } return doc; }
From source file:org.mutoss.gui.dialogs.AboutDialog.java
private DefaultStyledDocument getDocument() { DefaultStyledDocument doc = new DefaultStyledDocument(); logger.info("Creating About-Text."); try {//from w w w. j a va 2s. com doc.insertString(doc.getLength(), "Crossover " + Configuration.getInstance().getGeneralConfig().getVersionNumber() + "\n\n", getH1()); doc.insertString(doc.getLength(), "by Kornelius Rohmeyer is distributed under GPL 2.0.\n\n", getT()); doc.insertString(doc.getLength(), "This program uses the libraries log4j, jxlayer,\n " + "swingworker, commons logging/lang, JRI and JGoodies Forms.\n", getT()); doc.insertString(doc.getLength(), "\n" + "This program is free software; you can redistribute it and/or\n" + "modify it under the terms of the GNU General Public License\n" + "as published by the Free Software Foundation, Version 2.\n" + "\n" + "This program is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details. It is included\n" + "in the R distribution (in directory share/licenses) or can be\n" + "found at: http://www.gnu.org/licenses/\n", getT()); doc.setParagraphAttributes(0, doc.getLength(), getC(), true); } catch (BadLocationException ble) { logger.error("BadLocationException was thrown. Should never happen.", ble); } return doc; }
From source file:org.rockyroadshub.planner.core.gui.calendar.FormPane.java
private void update0(JLabel limit, String format, DefaultStyledDocument doc) { limit.setText(String.format(format, doc.getLength())); }
From source file:simplealbum.mvc.autocomplete.JTextPaneX.java
protected void colorStyledDocument(final DefaultStyledDocument document) { EventQueue.invokeLater(new Runnable() { @Override/* www . java2s . com*/ public void run() { String input = ""; try { input = document.getText(0, document.getLength()); } catch (BadLocationException ex) { Logger.getLogger(JTextPaneX.class.getName()).log(Level.SEVERE, null, ex); } StringBuilder inputMut = new StringBuilder(input); String[] split = StringUtils.split(inputMut.toString()); int i = 0; for (String string : split) { int start = inputMut.indexOf(string); int end = start + string.length(); inputMut.replace(start, end, StringUtils.repeat(" ", string.length())); document.setCharacterAttributes(start, string.length(), styles[i++ % styles.length], true); } } }); }