import java.awt.*;
import java.awt.event.*;
import javax.swing.*;public class testframe extends Frame 
{
JTextArea t;
public testframe()
{
try {
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});
setLayout(new FlowLayout());
setBackground(Color.lightGray);
t=new JTextArea(5,8);            
t.setWrapStyleWord(true);
t.setLineWrap(true);
t.setText("1234567890abcdefghijklmnopqrstuvwxyz");
add(t);
Button b = new Button("button");
add(b);
b.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
p();
}
});
} catch (Exception e) {
System.out.println("err location");
}
} public void p()
{
try
{
System.out.println("lineCount "+ t.getLineCount()+ " "      + t.getColumns());
int start,end;
for (int i = 0; i < t.getLineCount(); i++)
{
int linelength = t.getColumns();
start = t.getLineStartOffset(i);
end = t.getLineEndOffset(i);
while ((end - start) > linelength)
{
System.out.println(t.getText(start, linelength));
start = start + linelength;
}
System.out.println(t.getText(start, end - start));
}
}
catch (Exception e)
{
e.printStackTrace();
} }
public static void main(String[] args) 
{
testframe f = new testframe();
f.setSize(400, 300);
f.setVisible(true);
}
}setColumns(int)也有反应的。