List of usage examples for javax.swing.text JTextComponent validate
public void validate()
From source file:Main.java
public static void refreshJTextComponent(JTextComponent textComponent) { // borrowed from metaphase editor int pos = textComponent.getCaretPosition(); textComponent.setText(textComponent.getText()); textComponent.validate(); try {/*from w ww .j ava2 s . c om*/ textComponent.setCaretPosition(pos); } catch (IllegalArgumentException e) { // swallow the exception // seems like a bug in the JTextPane component // only happens occasionally when pasting text at the end of a document System.err.println(e.getMessage()); } }