Here you can find the source of columns(JTextArea testString)
static int columns(JTextArea testString)
//package com.java2s; import javax.swing.JTextArea; public class Main { static int columns(JTextArea testString) { return Math.min((int) (testString.getText().length() * 0.66), 80); }/*from w ww.jav a 2s. com*/ }