There are 1 code examples for javax.swing.text.DefaultStyledDocument.
The API names are highlighted below.
You can use
button
to vote the code example(s) you like. The best code example will be ranked first next time. Thanks a lot for your feedback.
Project Name: weka Package: weka.gui.scripting
Source Code: SyntaxDocument.java (Click to view .java file)
Method Code:
/**
* Adds the matching block end.
* @param offsetthe offset
* @returnthe string after adding the matching block end
* @throws BadLocationExceptionif the offset is invalid
*/
protected String addMatchingBlockEnd(int offset) throws BadLocationException {
StringBuffer result;
StringBuffer whiteSpace=new StringBuffer();
int line=m_RootElement.getElementIndex(offset);
int i=m_RootElement.getElement(line).getStartOffset();
while (true) {
String temp=m_Self.getText(i,1);
if (temp.equals(" ") || temp.equals("\t")) {
whiteSpace.append(temp);
i++;
}
else {
break;
}
}
result=new StringBuffer();
result.append(m_BlockStart);
result.append("\n");
result.append(whiteSpace.toString());
if (m_UseBlanks) result.append(m_Indentation);
else result.append("\t");
result.append("\n");
result.append(whiteSpace.toString());
result.append(m_BlockEnd);
return result.toString();
}