Package java.text

Examples of java.text.AttributedString.addAttribute()


            fastInit(text, font, attributes, frc);
        } else {
            AttributedString as = attributes == null
                ? new AttributedString(string)
                : new AttributedString(string, attributes);
            as.addAttribute(TextAttribute.FONT, font);
            standardInit(as.getIterator(), text, frc);
        }
    }

    /**
 
View Full Code Here


        private int s = 0;

        @Override
        public void normalText(final String tok) {
          if (tok.length() > 0) {
            aStyledText.addAttribute(TextAttribute.FONT, normalFont, s, s
                + tok.length());
            aStyledText.addAttribute(TextAttribute.FOREGROUND, normalColor, s, s
                + tok.length());
            s += tok.length();
          }
View Full Code Here

        @Override
        public void normalText(final String tok) {
          if (tok.length() > 0) {
            aStyledText.addAttribute(TextAttribute.FONT, normalFont, s, s
                + tok.length());
            aStyledText.addAttribute(TextAttribute.FOREGROUND, normalColor, s, s
                + tok.length());
            s += tok.length();
          }
        }
View Full Code Here

        }

        @Override
        public void colorText(final String tok) {
          if (tok.length() > 0) {
            aStyledText.addAttribute(TextAttribute.FONT, specialFont, s, s
                + tok.length());
            aStyledText.addAttribute(TextAttribute.FOREGROUND, Color.blue, s, s
                + tok.length());
            s += tok.length();
          }
View Full Code Here

        @Override
        public void colorText(final String tok) {
          if (tok.length() > 0) {
            aStyledText.addAttribute(TextAttribute.FONT, specialFont, s, s
                + tok.length());
            aStyledText.addAttribute(TextAttribute.FOREGROUND, Color.blue, s, s
                + tok.length());
            s += tok.length();
          }
        }
      };
View Full Code Here

      // The description text
      int descriptionTextHeight = 0;
      for (String descText : tooltipInfo.getDescriptionSections()) {
        AttributedString attributedDescription = new AttributedString(
            descText);
        attributedDescription.addAttribute(TextAttribute.FONT, font);
        LineBreakMeasurer lineBreakMeasurer = new LineBreakMeasurer(
            attributedDescription.getIterator(), frc);
        while (true) {
          TextLayout tl = lineBreakMeasurer.nextLayout(descTextWidth);
          if (tl == null)
View Full Code Here

          availableWidth += tooltipInfo.getMainImage().getWidth(null);
        }
        for (String footerText : tooltipInfo.getFooterSections()) {
          AttributedString attributedDescription = new AttributedString(
              footerText);
          attributedDescription
              .addAttribute(TextAttribute.FONT, font);
          LineBreakMeasurer lineBreakMeasurer = new LineBreakMeasurer(
              attributedDescription.getIterator(), frc);
          while (true) {
            TextLayout tl = lineBreakMeasurer
View Full Code Here

      // The description text
      int descLabelWidth = parent.getWidth() - x - ins.right;
      for (String descText : tooltipInfo.getDescriptionSections()) {
        AttributedString attributedDescription = new AttributedString(
            descText);
        attributedDescription.addAttribute(TextAttribute.FONT, font);
        LineBreakMeasurer lineBreakMeasurer = new LineBreakMeasurer(
            attributedDescription.getIterator(), frc);
        int currOffset = 0;
        while (true) {
          TextLayout tl = lineBreakMeasurer
View Full Code Here

        // The footer text
        int footerLabelWidth = parent.getWidth() - x - ins.right;
        for (String footerText : tooltipInfo.getFooterSections()) {
          AttributedString attributedDescription = new AttributedString(
              footerText);
          attributedDescription
              .addAttribute(TextAttribute.FONT, font);
          LineBreakMeasurer lineBreakMeasurer = new LineBreakMeasurer(
              attributedDescription.getIterator(), frc);
          int currOffset = 0;
          while (true) {
View Full Code Here

    /**
     * Tests the serialization of an {@link AttributedString}.
     */
    public void testAttributedStringSerialization3() {
        AttributedString s1 = new AttributedString("ABC");
        s1.addAttribute(TextAttribute.LANGUAGE, "English");
        AttributedString s2 = null;
        try {
            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
            ObjectOutputStream out = new ObjectOutputStream(buffer);
            SerialUtilities.writeAttributedString(s1, out);
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.