哈哈哈....
final JTextArea textArea = new JTextArea();
textArea.setFont(new Font("Meiryo", Font.BOLD, 18));
textArea.setWrapStyleWord(true);
textArea.setLineWrap(true);
textArea.addKeyListener(new KeyAdapter() {
@Override
public void keyReleased(KeyEvent e) {
try {
Rectangle rect = textArea.modelToView(textArea.getText().length());
textArea.setBounds(10, 10, 100,Math.max(30, rect.y + rect.height));
} catch (BadLocationException e1) {
e1.printStackTrace();
}
}
});