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