Package javax.swing.text

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


            assertEquals(3, ta.getRows());
            assertEquals(8, ta.getColumns());
            assertFalse(ta.getLineWrap());
            assertFalse(ta.getWrapStyleWord());
            doc = new PlainDocument();
            doc.insertString(0, str2, null);
            ta = new ExtJTextArea(doc, null, 5, 6);
            assertEquals(str2, ta.getText());
            ta = new ExtJTextArea(doc, "", 5, 6);
            assertEquals("", ta.getText());
            try {
View Full Code Here


    }

    public void testJTextAreaDocument() {
        Document doc = new PlainDocument();
        try {
            doc.insertString(0, str2, null);
        } catch (BadLocationException e) {
            assertTrue("Unexpected exception: " + e.getMessage(), false);
        }
        ExtJTextArea ta = new ExtJTextArea(doc);
        assertEquals(str2, ta.getText());
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

                        InputStream is = ParsedURL.checkGZIP(u.openStream());

                        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

    public void testJTextFieldDocumentStringInt() {
        String str1 = "AAA";
        String str2 = "testJTextFieldDocumentStringInt()";
        Document doc = new PlainDocument();
        try {
            doc.insertString(0, str2, null);
        } catch (BadLocationException e) {
            assertTrue("Unexpected exception: " + e.getMessage(), false);
        }
        JTextField tf = new JTextField(doc, str2, 8);
        assertEquals(str2, tf.getText());
View Full Code Here

        assertEquals(str2, tf.getText());
        assertEquals(doc, tf.getDocument());
        assertEquals(8, tf.getColumns());
        doc = new PlainDocument();
        try {
            doc.insertString(0, str2, null);
        } catch (BadLocationException e) {
            assertTrue("Unexpected exception: " + e.getMessage(), false);
        }
        tf = new JTextField(doc, null, 6);
        assertEquals(str2, tf.getText());
View Full Code Here

       
        //present words
        Document present = new PlainDocument();
        for (String word : results) {
            try {
                present.insertString(present.getLength(), word + "\n", null);
            } catch (BadLocationException ex){
                lblStatus.setText("Error putting words into document.");
                ex.printStackTrace();
            }
        }
View Full Code Here

                     }
                 }
             };
             abstractDoc.setDocumentFilter(new NumberFilter());
             try {
        abstractDoc.insertString(0, spinner.getValue().toString(), null);
      } catch (BadLocationException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
      }
             myTextField.setDocument(abstractDoc);
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.