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