List of usage examples for java.text AttributedString AttributedString
public AttributedString(AttributedCharacterIterator text, int beginIndex, int endIndex)
From source file:net.sf.jasperreports.engine.util.JRStyledTextParser.java
/** * Outputs the String representation of a styled text chunk. * //ww w . j a v a 2 s.c o m * @param styledText the styled text * @param startIndex the start index * @param endIndex the end index * @return the String styled text representation of the chunk delimited by * the start index and the end index * @see #write(Map, AttributedCharacterIterator, String) */ public String write(JRStyledText styledText, int startIndex, int endIndex) { AttributedCharacterIterator subIterator = new AttributedString( styledText.getAttributedString().getIterator(), startIndex, endIndex).getIterator(); String subText = styledText.getText().substring(startIndex, endIndex); return write(styledText.getGlobalAttributes(), subIterator, subText); }