Package javax.swing.text

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


    public void guiTestDocumentSwap() throws Exception {
        final JTextField textField = new JTextField();
        final AbstractDocument documentA = (AbstractDocument) textField.getDocument();
        documentA.insertString(0, "documentA", null);
        final AbstractDocument documentB = new PlainDocument();
        documentB.insertString(0, "documentB", null);

        final int originalDocumentAListenerCount = documentA.getDocumentListeners().length;
        final int originalDocumentBListenerCount = documentB.getDocumentListeners().length;

        // using the textField in a TextComponentMatcherEditor will install a DocumentListener
View Full Code Here


                        // u.openStream(MimeTypeConstants.MIME_TYPES_SVG);

                        Reader in = XMLUtilities.createXMLDocumentReader(is);
                        int len;
                        while ((len=in.read(buffer, 0, buffer.length)) != -1) {
                            doc.insertString(doc.getLength(),
                                             new String(buffer, 0, len), null);
                        }

                        ta.setDocument(doc);
                        ta.setEditable(false);
View Full Code Here

                        // u.openStream(MimeTypeConstants.MIME_TYPES_SVG);

                        Reader in = XMLUtilities.createXMLDocumentReader(is);
                        int len;
                        while ((len=in.read(buffer, 0, buffer.length)) != -1) {
                            doc.insertString(doc.getLength(),
                                             new String(buffer, 0, len), null);
                        }

                        ta.setDocument(doc);
                        ta.setEditable(false);
View Full Code Here

  {
    h.checkPoint("contentChange");
    try
      {
        PlainDocument doc = new PlainDocument();
        doc.insertString(0, "hallo", null);
        AbstractDocument.LeafElement l = doc.new LeafElement(null, null, 20, 5);
        h.check(l.getStartOffset(), 20);
        doc.insertString(0, "hiyo", null);
        h.check(l.getStartOffset(), 24);
      }
View Full Code Here

      {
        PlainDocument doc = new PlainDocument();
        doc.insertString(0, "hallo", null);
        AbstractDocument.LeafElement l = doc.new LeafElement(null, null, 20, 5);
        h.check(l.getStartOffset(), 20);
        doc.insertString(0, "hiyo", null);
        h.check(l.getStartOffset(), 24);
      }
    catch (BadLocationException ex)
      {
        h.fail("BadLocationException");
View Full Code Here

                            = u.openStream(MimeTypeConstants.MIME_TYPES_SVG);

                        Reader in = XMLUtilities.createXMLDocumentReader(is);
                        int len;
                        while ((len=in.read(buffer, 0, buffer.length)) != -1) {
                            doc.insertString(doc.getLength(),
                                             new String(buffer, 0, len), null);
                        }

                        ta.setDocument(doc);
                        ta.setEditable(false);
View Full Code Here

                            = u.openStream(MimeTypeConstants.MIME_TYPES_SVG);

                        Reader in = XMLUtilities.createXMLDocumentReader(is);
                        int len;
                        while ((len=in.read(buffer, 0, buffer.length)) != -1) {
                            doc.insertString(doc.getLength(),
                                             new String(buffer, 0, len), null);
                        }

                        ta.setDocument(doc);
                        ta.setEditable(false);
View Full Code Here

                            = u.openStream(MimeTypeConstants.MIME_TYPES_SVG);

                        Reader in = XMLUtilities.createXMLDocumentReader(is);
                        int len;
                        while ((len=in.read(buffer, 0, buffer.length)) != -1) {
                            doc.insertString(doc.getLength(),
                                             new String(buffer, 0, len), null);
                        }

                        ta.setDocument(doc);
                        ta.setEditable(false);
View Full Code Here

    PlainDocument d = new PlainDocument();
   
    // check default result
    try
    {
      d.insertString(0, "XYZ", null);
      harness.check(d.getText(0, 3).equals("XYZ"));
    }
    catch (BadLocationException e)
    {
      harness.fail(e.toString());
View Full Code Here

    }   

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