List of usage examples for javax.swing.text StyledDocument setCharacterAttributes
public void setCharacterAttributes(int offset, int length, AttributeSet s, boolean replace);
From source file:de.codesourcery.jasm16.utils.ASTInspector.java
private void clearCompilationErrors(ICompilationUnit unit) { StyledDocument doc = editorPane.getStyledDocument(); disableDocumentListener();//www . j a va 2 s . c o m try { doc.setCharacterAttributes(0, doc.getLength(), defaultStyle, true); } finally { enableDocumentListener(); } }
From source file:de.codesourcery.jasm16.ide.ui.views.SourceCodeView.java
protected final void clearCompilationErrors() { disableDocumentListener();//from www . jav a 2 s.c om try { final StyledDocument doc = editorPane.getStyledDocument(); doc.setCharacterAttributes(0, doc.getLength(), defaultStyle, true); } finally { enableDocumentListener(); } }
From source file:uk.ac.kcl.texthunter.core.AnnotationEditor.java
private void updateInfoTextPane(String newText) { StyledDocument doc; doc = infoTextPane.getStyledDocument(); // Define a keyword attribute SimpleAttributeSet newString = new SimpleAttributeSet(); StyleConstants.setForeground(newString, Color.RED); StyleConstants.setBold(newString, true); SimpleAttributeSet oldString = new SimpleAttributeSet(); StyleConstants.setForeground(oldString, Color.BLACK); StyleConstants.setBold(oldString, false); // Add some text try {/* w w w . jav a 2 s . c o m*/ doc.setCharacterAttributes(0, doc.getLength(), oldString, true); doc.insertString(doc.getLength(), "\n" + newText, newString); } catch (Exception e) { System.out.println(e); } }