TextArea Elements 2
/* Core SWING Advanced Programming By Kim Topley ISBN: 0 13 083292 8 Publisher: Prentice Hall */ import javax.swing.JFrame; import javax.swing.JTextArea; import javax.swing.UIManager; import javax.swing.text.AbstractDocument; public class TextAreaElements2 { public static void main(String[] args) { try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); } catch (Exception evt) {} JFrame f = new JFrame("Text Area Elements 2"); JTextArea ta = new JTextArea(5, 32); ta .setText("That's one small step for man...\nOne giant leap for mankind."); ta.setLineWrap(true); ta.setWrapStyleWord(true); f.getContentPane().add(ta); f.setSize(100, 100); f.setVisible(true); ((AbstractDocument) ta.getDocument()).dump(System.out); } }