Package javax.swing.text

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


    h2 = harness;
    StyledDocument doc = new StyledDocument4();
    try
      {
        doc.insertString(0, "aaaaaaaaa\nbbbbbbbbb", null);
        doc.insertString(5, "\nN", null);
      }
    catch (Exception ex)
      {
        // ex.printStackTrace();
        harness.debug(ex);
View Full Code Here


            } else {
                attrs = getInputAttributes();
            }

            if (content != null) {
                doc.insertString(start, content, attrs);
            }
        } catch (BadLocationException e) {
        }
    }
View Full Code Here

                  possible |= actionnable.isPossibleReplacement(newText);
                }
              }
              if (possible) {
                doc.remove(startOffset, endOffset - startOffset);
                doc.insertString(startOffset, newText, attr);
                lastEnd = startOffset + newText.length();
              }
            }
          }
        }
View Full Code Here

          statsBuff.append("Load time: ").append(res.getTime()).append(NL);
          statsBuff.append("Latency: ").append(res.getLatency()).append(NL);
          statsBuff.append("Size in bytes: ").append(res.getBytes()).append(NL);
          statsBuff.append("Sample Count: ").append(res.getSampleCount()).append(NL);
          statsBuff.append("Error Count: ").append(res.getErrorCount()).append(NL);
          statsDoc.insertString(statsDoc.getLength(), statsBuff.toString(), null);
          statsBuff = new StringBuffer(); //reset for reuse
         
          String responseCode = res.getResponseCode();
          log.debug("valueChanged1 : response code - " + responseCode);
View Full Code Here

            style = statsDoc.getStyle(STYLE_SERVER_ERROR);
            break;
          }

          statsBuff.append("Response code: ").append(responseCode).append(NL);
          statsDoc.insertString(statsDoc.getLength(), statsBuff.toString(), style);
          statsBuff = new StringBuffer(100); //reset for reuse

          // response message label
          String responseMsgStr = res.getResponseMessage();
View Full Code Here

          log.debug("valueChanged1 : response message - " + responseMsgStr);
          statsBuff.append("Response message: ").append(responseMsgStr).append(NL);

          statsBuff.append(NL).append("Response headers:").append(NL);
          statsBuff.append(res.getResponseHeaders()).append(NL);
          statsDoc.insertString(statsDoc.getLength(), statsBuff.toString(), null);
          statsBuff = null; // Done

          // get the text response and image icon
          // to determine which is NOT null
          if ((SampleResult.TEXT).equals(res.getDataType())) // equals(null) is OK
View Full Code Here

          StringBuffer statsBuff = new StringBuffer(100);
          statsBuff.append("Assertion error: ").append(res.isError()).append(NL);
          statsBuff.append("Assertion failure: ").append(res.isFailure()).append(NL);
          statsBuff.append("Assertion failure message : ").append(res.getFailureMessage()).append(NL);
          statsDoc.insertString(statsDoc.getLength(), statsBuff.toString(), null);
          statsBuff = null;
        }
      }
    } catch (BadLocationException exc) {
      log.error("Error setting statistics text", exc);
View Full Code Here

        SimpleAttributeSet s = new SimpleAttributeSet();
        StyleConstants.setAlignment(s, StyleConstants.ALIGN_CENTER);
        StyleConstants.setBold(s, true);
        try {
            doc.setParagraphAttributes(0,content.length(), s, false);
            doc.insertString(0, content, s);
            if (_showWebsite) {
              String webContent = Version.getWebSite();
              SimpleAttributeSet w = new SimpleAttributeSet();
                StyleConstants.setAlignment(w, StyleConstants.ALIGN_CENTER);
                StyleConstants.setUnderline(w, true);
View Full Code Here

                StyleConstants.setUnderline(w, true);
                SimpleAttributeSet hrefAttr = new SimpleAttributeSet();
                hrefAttr.addAttribute(HTML.Attribute.HREF, Version.getWebSite());
                w.addAttribute(HTML.Tag.A, hrefAttr);
                doc.setParagraphAttributes(content.length(),webContent.length(), w, false);
                doc.insertString(content.length(), webContent, w);
                if (Desktop.isDesktopSupported()){
                  addMouseListener(this);
                  addMouseMotionListener(this);
                }
            }
View Full Code Here

    }

    // add text from CAS
    try {
      doc.remove(0, doc.getLength());
      doc.insertString(0, mCAS.getDocumentText(), new SimpleAttributeSet());
    } catch (BadLocationException e) {
      throw new RuntimeException(e);
    }

    // Iterate over annotations
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.