Package javax.swing.text

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


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


   
    // insert at location before start
    boolean pass = false;
    try
    {
      sc.insertString(-1, "XYZ");
    }
    catch (BadLocationException e)
    {
      pass = true;
    }
View Full Code Here

    harness.check(pass);
   
    // insert at index of last character - this is OK
    try
    {
      sc.insertString(3, "XYZ");
    }
    catch (BadLocationException e)
    {
      // ignore
    }
View Full Code Here

   
    // insert at index of last character + 1 - this raises BadLocationException
    pass = false;
    try
    {
      sc.insertString(7, "XYZ");
    }
    catch (BadLocationException e)
    {
      pass = true;
    }
View Full Code Here

    harness.check(pass);

    // insert empty string
    try
    {
      sc.insertString(0, "");
    }
    catch (BadLocationException e)
    {
      // ignore
    }
View Full Code Here

   
    // insert null string
    pass = false;
    try
    {
      sc.insertString(0, null);
    }
    catch (BadLocationException e)
    {
      // ignore
    }
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

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

    h.checkPoint("BadLocationTest");
    java.util.Locale.setDefault(java.util.Locale.US);
    StringContent sc = new StringContent();
    try
      {
        sc.insertString(-1, "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(1, "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

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.