1 /* 2 * File: TextAreaDemo.java 3 * 4 * Create an noneditable text area 5 * 6 * Copyright: Northeast Parallel Architectures Center 7 * 8 */ 9 10 import java.awt.TextArea; 11 12 public class TextAreaDemo extends java.applet.Applet { 13 14 private TextArea verse; 15 16 public void init() { 17 setBackground( java.awt.Color.white ); 18 19 String str = 20 "Once upon a midnight dreary, while I pondered, weak and weary,\n" + 21 "Over many a quaint and curious volume of forgotten lore,\n" + 22 "While I nodded, nearly napping, suddenly there came a tapping,\n" + 23 "As of some one gently rapping, rapping at my chamber door.\n" + 24 "\"'Tis some visitor,\" I muttered, \"tapping at my chamber door-\n" + 25 "Only this, and nothing more.\"\n\n" + 26 "Ah, distinctly I remember it was in the bleak December,\n" + 27 "And each separate dying ember wrought its ghost upon the floor.\n" + 28 "Eagerly I wished the morrow;- vainly I had sought to borrow\n" + 29 "From my books surcease of sorrow- sorrow for the lost Lenore-\n" + 30 "For the rare and radiant maiden whom the angels name Lenore-\n" + 31 "Nameless here for evermore."; 32 33 verse = new TextArea( str, 7, 60, TextArea.SCROLLBARS_VERTICAL_ONLY ); 34 verse.setEditable( false ); 35 36 add(verse); 37 } 38 39 }