Package javax.swing.text

Examples of javax.swing.text.PlainDocument.insertString()


    harness.check(pass);

    // add some more text
    try
    {
      d.insertString(0, "ABCDEFG", null);
    }
    catch (BadLocationException e)
    {
    }
    harness.check(d.getLength(), 7);
View Full Code Here


    Segment seg2 = new Segment();
    Segment seg3 = new Segment();
    PlainDocument d2 = new PlainDocument();
    try
    {
      d2.insertString(0, "XYZ", null);
      d2.getText(0, 3, seg2);
      seg2.array[1] = '5';
      d2.getText(0, 3, seg3);
    }
    catch (BadLocationException e)
View Full Code Here

        c.insertString(5, "12345");
        harness.check(p1.getOffset(), 0);
        harness.check(p2.getOffset(), 21);
       
        PlainDocument doc = new PlainDocument();
        doc.insertString(0, "cdefgh", null);
        Position s = doc.createPosition(1);
        harness.check(s.getOffset(), 1);

        doc.insertString(0, "a", null);
        harness.check(s.getOffset(), 2);
View Full Code Here

        PlainDocument doc = new PlainDocument();
        doc.insertString(0, "cdefgh", null);
        Position s = doc.createPosition(1);
        harness.check(s.getOffset(), 1);

        doc.insertString(0, "a", null);
        harness.check(s.getOffset(), 2);
        Position a = doc.createPosition(1);
        harness.check(a.getOffset(), 1);

        doc.insertString(1, "b", null);
View Full Code Here

        doc.insertString(0, "a", null);
        harness.check(s.getOffset(), 2);
        Position a = doc.createPosition(1);
        harness.check(a.getOffset(), 1);

        doc.insertString(1, "b", null);
        harness.check(s.getOffset(), 3);
        harness.check(a.getOffset(), 2);
      }
    catch (BadLocationException ex)
      {
View Full Code Here

  {
    h.checkPoint("border case");
    try
      {
        PlainDocument doc = new PlainDocument();
        doc.insertString(0, "One Three Four", null);
        Position pos = doc.createPosition(4);
        doc.insertString(4, "Two ", null);
        h.check(pos.getOffset(), 8);
      }
    catch (BadLocationException ex)
View Full Code Here

    try
      {
        PlainDocument doc = new PlainDocument();
        doc.insertString(0, "One Three Four", null);
        Position pos = doc.createPosition(4);
        doc.insertString(4, "Two ", null);
        h.check(pos.getOffset(), 8);
      }
    catch (BadLocationException ex)
      {
        h.fail("BadLocationException thrown")
View Full Code Here

  private void testBeyondBoundary(TestHarness h)
  {
    PlainDocument doc = new PlainDocument();
    try
      {
        doc.insertString(0, "hello\n", null);
      }
    catch (BadLocationException ex)
      {
         h.fail(ex.getMessage());
      }
View Full Code Here

    harness.checkPoint("testNewline");

    PlainDocument doc = new PlainDocument();
    try
      {
        doc.insertString(0, "Hello\nWorld", new SimpleAttributeSet());
      }
    catch (BadLocationException ex)
      {
        harness.fail("BadLocationException");
      }
View Full Code Here

    PlainDocument doc = new PlainDocument();
    doc.putProperty("filterNewlines", Boolean.TRUE);
    try
      {
        doc.insertString(0, "Hello\nWorld", new SimpleAttributeSet());
      }
    catch (BadLocationException ex)
      {
        harness.fail("BadLocationException");
      }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.