Package javax.swing.text

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


        h.checkPoint("cannot undo");
      }
    try
      {
        sc = new StringContent();
        ue = sc.insertString(0, "class");
        ue2 = sc.insertString(0, "super ");
        ue3 = sc.insertString(11, "path");
        h.check("super classpath\n", sc.getString(0, sc.length()), "insert 'super classpath': " + sc.getString(0, sc.length()));
        ue.undo();
        h.check(" classpath\n", sc.getString(0, sc.length()), "undo ' classpath': " + sc.getString(0, sc.length()));
View Full Code Here


      }
    try
      {
        sc = new StringContent();
        ue = sc.insertString(0, "class");
        ue2 = sc.insertString(0, "super ");
        ue3 = sc.insertString(11, "path");
        h.check("super classpath\n", sc.getString(0, sc.length()), "insert 'super classpath': " + sc.getString(0, sc.length()));
        ue.undo();
        h.check(" classpath\n", sc.getString(0, sc.length()), "undo ' classpath': " + sc.getString(0, sc.length()));
        ue.undo();
View Full Code Here

    try
      {
        sc = new StringContent();
        ue = sc.insertString(0, "class");
        ue2 = sc.insertString(0, "super ");
        ue3 = sc.insertString(11, "path");
        h.check("super classpath\n", sc.getString(0, sc.length()), "insert 'super classpath': " + sc.getString(0, sc.length()));
        ue.undo();
        h.check(" classpath\n", sc.getString(0, sc.length()), "undo ' classpath': " + sc.getString(0, sc.length()));
        ue.undo();
        h.fail("should not be able to undo two times");
View Full Code Here

  {
    StringContent sc = new StringContent();
    harness.check(sc.length(), 1);
    try
    {
      sc.insertString(0, "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
      harness.check(sc.length(), 27);
      sc.remove(0, 3);
      harness.check(sc.length(), 24);
      sc.insertString(4, "123");
      harness.check(sc.length(), 27);
View Full Code Here

    {
      sc.insertString(0, "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
      harness.check(sc.length(), 27);
      sc.remove(0, 3);
      harness.check(sc.length(), 24);
      sc.insertString(4, "123");
      harness.check(sc.length(), 27);
      sc.remove(20, 5);
      harness.check(sc.length(), 22)
    }
    catch (BadLocationException e)
View Full Code Here

  {
    StringContent sc = new StringContent();
    // regular insert
    try
    {
      sc.insertString(0, "ABCDEFG");
      // ignoring undo/redo here - see insertUndo.java
    }
    catch (BadLocationException e)
    {
      // ignore - checks below will fail if this happens
View Full Code Here

  {
    StringContent sc = new StringContent();
    harness.check(sc.length(), 1);
    try
    {
      sc.insertString(0, "ABC");
    }
    catch (BadLocationException e)
    {
      // ignore
    }
View Full Code Here

    h.checkPoint("StringContent");

    StringContent sc = new StringContent();
    try
      {
        sc.insertString(0, "classpath");
        Position position = sc.createPosition(1);
        Position position2 = sc.createPosition(4);
        Position position3 = sc.createPosition(sc.length());
        h.check(1, position.getOffset(), "createPosition(1): Position.getOffset() should be 1 and is: " + position.getOffset());
        h.check(4, position2.getOffset(), "createPosition(4): Position2.getOffset() should be 4 and is: " + position2.getOffset());
View Full Code Here

        Position position2 = sc.createPosition(4);
        Position position3 = sc.createPosition(sc.length());
        h.check(1, position.getOffset(), "createPosition(1): Position.getOffset() should be 1 and is: " + position.getOffset());
        h.check(4, position2.getOffset(), "createPosition(4): Position2.getOffset() should be 4 and is: " + position2.getOffset());
        h.check(10, position3.getOffset(), "createPosition(10): Position3.getOffset() should be 10 and is: " + position3.getOffset());
        sc.insertString(2, "-");
        h.check(1, position.getOffset(), "Position.getOffset() should be 1 and is: " + position.getOffset());
        h.check(5, position2.getOffset(), "Position2.getOffset() should be 5 and is: " + position2.getOffset());
        h.check(11, position3.getOffset(), "Position3.getOffset() should be 11 and is: " + position3.getOffset());
        sc.insertString(1, "-");
        h.check(2, position.getOffset(), "Position.getOffset() should be 2 and is: " + position.getOffset());
View Full Code Here

        h.check(10, position3.getOffset(), "createPosition(10): Position3.getOffset() should be 10 and is: " + position3.getOffset());
        sc.insertString(2, "-");
        h.check(1, position.getOffset(), "Position.getOffset() should be 1 and is: " + position.getOffset());
        h.check(5, position2.getOffset(), "Position2.getOffset() should be 5 and is: " + position2.getOffset());
        h.check(11, position3.getOffset(), "Position3.getOffset() should be 11 and is: " + position3.getOffset());
        sc.insertString(1, "-");
        h.check(2, position.getOffset(), "Position.getOffset() should be 2 and is: " + position.getOffset());
        h.check(6, position2.getOffset(), "Position2.getOffset() should be 6 and is: " + position2.getOffset());
        h.check(12, position3.getOffset(), "Position3.getOffset() should be 12 and is: " + position3.getOffset());
        sc.remove(0, 2);
        h.check(0, position.getOffset(), "Position.getOffset() should be 0 and is: " + position.getOffset());
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.