List of utility methods to do JTextComponent Select
boolean | selectLines(JTextComponent target) If the selection is multi lined, then the full lines are selected, otherwise, nothing is done. if (target.getSelectionStart() == target.getSelectionEnd()) { return false; PlainDocument pDoc = (PlainDocument) target.getDocument(); Element es = pDoc.getParagraphElement(target.getSelectionStart()); Element ee = pDoc.getParagraphElement(target.getSelectionEnd() - 1); if (es.equals(ee) && ee.getEndOffset() != target.getSelectionEnd()) { return false; ... |
void | toggleSelectionUpperCase(JTextComponent textPane) toggle Selection Upper Case if (isSelectionUpperCase(textPane)) { selectionToLowerCase(textPane); } else { selectionToUpperCase(textPane); |
boolean | useSelectedTextColor(Highlighter.Highlight h, JTextComponent c) Determines whether the SelectedTextColor should be used for painting text foreground for the specified highlight. Highlighter.HighlightPainter painter = h.getPainter(); String painterClass = painter.getClass().getName(); if (painterClass.indexOf("javax.swing.text.DefaultHighlighter") != 0 && painterClass.indexOf("com.sun.java.swing.plaf.windows.WindowsTextUI") != 0) { return false; try { DefaultHighlighter.DefaultHighlightPainter defPainter = (DefaultHighlighter.DefaultHighlightPainter) painter; ... |