Package javax.swing.text

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


        h.check("Invalid location", ble.getMessage(), "BadLocation message should be 'Invalid location' and is: " + ble.getMessage());
        h.check(1, ble.offsetRequested(), "OffsetRequested() should be 1 and is: " + ble.offsetRequested());
      }
    try
      {
        sc.insertString(4, "path");
        h.fail("badlocation");
      }
    catch (BadLocationException ble)
      {
        h.check("Invalid location", ble.getMessage(), "BadLocation message should be 'Invalid location' and is: " + ble.getMessage());
View Full Code Here


        h.check("Invalid location", ble.getMessage(), "BadLocation message should be 'Invalid location' and is: " + ble.getMessage());
        h.check(1, ble.offsetRequested(), "OffsetRequested() should be 1 and is: " + ble.offsetRequested());
      }
    try
      {
        sc.insertString(0, "path");
        sc.getString(1, sc.length());
        h.fail("badlocation");
      }
    catch (BadLocationException ble)
      {
View Full Code Here

        h.check("Invalid range", ble.getMessage(), "BadLocation message should be 'Invalid range' and is: " + ble.getMessage());
        h.check(5, ble.offsetRequested(), "OffsetRequested() should be 5 and is: " + ble.offsetRequested());
      }
    try
      {
        sc.insertString(0, "path");
        sc.getString(0, sc.length()+1);
        h.fail("badlocation");
      }
    catch (BadLocationException ble)
      {
View Full Code Here

    harness.check(pass);

    // add some more text
    try
    {
      sc.insertString(0, "ABCDEFG");
    }
    catch (BadLocationException e)
    {
    }
    harness.check(sc.length(), 8);
View Full Code Here

    StringContent sc = new StringContent();
    try
      {
        h.checkPoint("StringContent -- insertString()");
        sc.insertString(0, "path");
        h.check("path\n", sc.getString(0, sc.length()),
                "StringContent.insertString(): insert 'path' at 0 getString() is: " + sc.getString(0, sc.length()));
        h.checkPoint("StringContent -- length()");
        h.check(5, sc.length(),
                "StringContent.length(): should be 5, is: " + sc.length());
View Full Code Here

                "StringContent.insertString(): insert 'path' at 0 getString() is: " + sc.getString(0, sc.length()));
        h.checkPoint("StringContent -- length()");
        h.check(5, sc.length(),
                "StringContent.length(): should be 5, is: " + sc.length());
        h.checkPoint("StringContent -- insertString() part2");
        sc.insertString(0, "class");
        h.checkPoint("StringContent -- getString()");
        h.check("classpath\n", sc.getString(0, sc.length()),
                "StringContent.insertString(): put 'class' at 0 should be 'classpath' and is: " + sc.getString(0, sc.length()));
        h.checkPoint("StringContent -- length() part2");
        h.check(10, sc.length(),
View Full Code Here

    UndoableEdit ue2 = null;
    UndoableEdit ue3 = null;
    try
      {
        h.checkPoint("StringContent -- insertString()");
        ue = sc.insertString(0, "path");
        h.check("path\n", sc.getString(0, sc.length()),
                "StringContent.insertString(): insert 'path' at 0");
        java.util.Locale.setDefault(java.util.Locale.US);
        String presentationName = ue.getPresentationName();
        h.check("", presentationName, "PresentationName should be '' and is: " + presentationName);
View Full Code Here

        ue.die();
        h.debug("UndoableEdit.die() no more undo/redo");
        h.check(false, ue.canUndo(), "die, no more undo");
        h.check(false, ue.canRedo(), "die, no more redo");
        sc = new StringContent();
        ue = sc.insertString(0, "path");
        ue2 = sc.insertString(0, "class");
        h.check("classpath\n", sc.getString(0, sc.length()), "should be classpath and is: " + sc.getString(0, sc.length()));
        h.check(true, ue.canUndo(), "double undo can undo?");
        ue.undo();
        h.check("spath\n", sc.getString(0, sc.length()), "double undo: should be 'spath\\n' and is: " + sc.getString(0, sc.length()));
View Full Code Here

        h.debug("UndoableEdit.die() no more undo/redo");
        h.check(false, ue.canUndo(), "die, no more undo");
        h.check(false, ue.canRedo(), "die, no more redo");
        sc = new StringContent();
        ue = sc.insertString(0, "path");
        ue2 = sc.insertString(0, "class");
        h.check("classpath\n", sc.getString(0, sc.length()), "should be classpath and is: " + sc.getString(0, sc.length()));
        h.check(true, ue.canUndo(), "double undo can undo?");
        ue.undo();
        h.check("spath\n", sc.getString(0, sc.length()), "double undo: should be 'spath\\n' and is: " + sc.getString(0, sc.length()));
        ue2.undo();
View Full Code Here

        h.check("\n", sc.getString(0, sc.length()), "double undo: should be '\\n' and is: " + sc.getString(0, sc.length()));
        ue.redo();
        h.check("clas\n", sc.getString(0, sc.length()), "double undo: should be 'clas\\n' and is: " + sc.getString(0, sc.length()));
        ue2.redo();
        h.check("spathclas\n", sc.getString(0, sc.length()), "double undo: should be 'spathclas\\n' and is: " + sc.getString(0, sc.length()));
        ue3 = sc.insertString(9, "X");
        h.check("spathclasX\n", sc.getString(0, sc.length()), "add an X: should be 'spathclasX\\n' and is: " + sc.getString(0, sc.length()));
        ue.undo();
        h.check("hclasX\n", sc.getString(0, sc.length()), "undo first position: should be 'hclasX\\n' and is: " + sc.getString(0, sc.length()));
      }
    catch (BadLocationException ble)
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.