FileDocCategorySizeDatePackage
PlainDocExample.javaAPI DocExample716Mon Nov 09 12:45:52 GMT 1998None

PlainDocExample

public class PlainDocExample extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

    try {

      // Dump an empty document
      PlainDocument doc = new PlainDocument();
      doc.dump(System.out);
      System.out.println("==========");

      // Add 3 lines of text, dump again
      doc.insertString(0, "Line One\n", null);
      doc.insertString(doc.getLength(), "Line Two\n", null);
      doc.insertString(doc.getLength(), "Line Three", null);
      doc.dump(System.out);
      System.out.println("==========");

      // Remove "One/Line Two/Line ", dump again
      doc.remove(5, 18);
      doc.dump(System.out);
    } catch (BadLocationException ex) {}