Here you can find the source of isNonWhitespaceBetween(JTextComponent editor, int iStart, int iEnd)
public static boolean isNonWhitespaceBetween(JTextComponent editor, int iStart, int iEnd)
//package com.java2s; //License from project: Apache License import javax.swing.text.BadLocationException; import javax.swing.text.JTextComponent; public class Main { public static boolean isNonWhitespaceBetween(JTextComponent editor, int iStart, int iEnd) { if (iStart > iEnd) { int iTemp = iEnd; iEnd = iStart;/*from w ww .j a va 2 s. c o m*/ iStart = iTemp; } try { String strText = editor.getText(iStart, iEnd - iStart); return strText.trim().length() > 0; } catch (BadLocationException e) { // ignore } return false; } }