Package javax.swing.text

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


   
    GapContent gc = new GapContent();
    // regular insert
    try
    {
      gc.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
    {
      gc.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
    {
      gc.insertString(3, "XYZ");
    }
    catch (BadLocationException e)
    {
      // ignore
    }
View Full Code Here

   
    // Insert at index of last character + 1. This appends the new string to
    // the existing string. (This works since 1.5 of the RI)
    try
    {
      gc.insertString(7, "XYZ");
    }
    catch (BadLocationException e)
    {
      pass = false;
    }
View Full Code Here

    // insert at index of last character + 2
    pass = false;
    try
    {
      gc.insertString(gc.length() + 1, "XYZ");
    }
    catch (BadLocationException e)
    {
      pass = true;
    }
View Full Code Here

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

   
    // insert null string
    pass = false;
    try
    {
      gc.insertString(0, null);
    }
    catch (BadLocationException e)
    {
      // ignore
    }
View Full Code Here

      int posValue = -1;

      try
        {
    GapContent gc = new GapContent();
      gc.insertString(0, "foo\nbar\n");
    gc.remove(0, 4);

          // Gap starts at 0 now and the following Position
          // instance is created at the end of the gap.
          Position pos = gc.createPosition(0);
View Full Code Here

          // instance is created at the end of the gap.
          Position pos = gc.createPosition(0);

          // This insertion should not move the offset
          // of the Position object.
    gc.insertString(0, "z");

    posValue = pos.getOffset();
        }
      catch(BadLocationException ble)
        {
View Full Code Here

    harness.check(pass);

    // add some more text
    try
    {
      gc.insertString(0, "ABCDEFG");
    }
    catch (BadLocationException e)
    {
    }
    harness.check(gc.length(), 8);
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.