public void convertTabsToSpaces(){
  int caretPosition=getCaretPosition();
  int tabSize=getTabSize();
  StringBuffer tabInSpaces=new StringBuffer();
  for (int i=0; i < tabSize; i++)   tabInSpaces.append(' ');
  String text=getText();
  setText(text.replaceAll("\t",tabInSpaces.toString()));
  setCaretPosition(caretPosition);
}

public void convertTabsToSpaces ( ) { int caretPosition = getCaretPosition ( ) ; int tabSize = getTabSize ( ) ; StringBuffer tabInSpaces = new StringBuffer ( ) ; for ( int i = 0 ; i < tabSize ; i ++ ) tabInSpaces . append ( ' ' ) ; String text = getText ( ) ; setText ( text . replaceAll ( "\t" , tabInSpaces . toString ( ) ) ) ; setCaretPosition ( caretPosition ) ; }
converts all instances of a tab into a number of spaces equivalent to a tab in this text area .
