Spark RichText - no word wrap with percentage width

With the old mx Text component, I could specify a percentage width, and have the height of the Text component automatically increase to show all the text.  I'm switching over to use the spark RichText component, and now this automatic wordwrap does not work with a percentage width (or by setting both left and right styles) - it just displays the first line of text and that's it.  It still works if I set an explicit width in pixels, but I want to be able to set a percentage width.
Is there a way to get the height to calculate automatically like it did before when using a percentage width?

Thanks for looking at it.  After some more digging, I found that it was because the RichText was inside a mx Canvas container.  I replaced it with a spark Group and it worked.

Similar Messages

  • Word Wrap with a Vertical Grid

    I've got a vertical grid with my headers in the left column and descriptive text in the column immediately to the right.  I'd like to have the descriptive text word wrap but checking the word wrap box on the layout tab doesn't seem to have any effect.
    Any ideas?  I'm using 11.5 SP3

    I'm not sure if it will work with the iGrid in a vertical orientation, but have you tried setting the RowHeight to something like 20 or 30 instead of the default of 0?  This setting will auto adjust the grid lines based upon the font-size, but you may need to force it to a certain height in order for the wrapping to work.

  • Word wrap with JTextPane

    Ok, at the risk of sounding stupid: How do you turn off the word wrap on a JTextPane.
    Thanks in advance, Ed

    ...and I forgot setSize public class NonScrollingPane extends JTextPane { 
      public NonScrollingPane() {   
      public boolean getScrollableTracksViewportWidth() {
        return false; 
      public void setSize(Dimension d) {
        if(d.width < getParent().getSize().width) {
          d.width = getParent().getSize().width;

  • Word wrap with jLabel

    Is it possible to word-wrap text in a jLabel field? If not, what would be a good choice of component?

    displayArea.setLineWrap (true);
    displayArea.setWrapStyleWord (true);I thought it wasn't added automatic.
    Kind regards,

  • Word wrap with JScrollPane

    Quick question. Trying to get word wrap in a JTextField
    using JSrollPane. Below is a small snippet of code
    from my program...
    displayArea = new JTextArea ( );
    JScrollPane scroll = new JScrollPane ( displayArea,
       JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); Doesn't using JScrollPane.HORIZONTAL_SCROLLBAR_NEVER automatically
    introduce word wrap? I'm not getting it in my program. Somebody please correct me. Thanks!

    displayArea.setLineWrap (true);
    displayArea.setWrapStyleWord (true);I thought it wasn't added automatic.
    Kind regards,

  • Word wrap with Flex 4

    Hi, Can someone help me in getting a wordwrap in Spark. Below is my code. Any help regarding this is highly Appreciated
    I  am trying to get wordwrap within a spark component, but I couldn't. Can someone fix this. Usoing Label or richtext or any control but not textinput or richeditabletext.
    I am also trying to copy paste the text. But I could not do that. How to do that?
    <?xml version="1.0" encoding="utf-8"?>
    xmlns:fx="" xmlns:s="
    library://" xmlns:mx="
    library://" minWidth="955" minHeight="600" xmlns:com="com.*" xmlns:local="*">
    <!-- Place non-visual elements (e.g., services, value objects) here -->
    <s:Panel x="229" y="158" width="250" height="200" >
    <s:VGroup id="vGroup1" top="5" bottom="5" left="5" right="5" gap="-2" variableRowHeight="true" width="240" height="190">
    <s:HGroup width="100%" gap="0" id="hGroup1" left="5" height="100%">
    <s:VGroup width="100%" id="vGroup2" gap="-2" right="35" height="100%">  
    <mx:Text id="t" fontWeight="bold" htmlText="You can format the text in a Text control using HTML tags, which are applied after the control's CSS 
    <mx:Text id="DIS_Subject" width="100%" htmlText="The Text hhhhhhhhh control displays multiline"/>
    <mx:Image id="iconComplete" width="16"/>
    <mx:Text textIndent="20" text="using HTML tags, which are hhhhhhhhh 888899999999 end " id="DIS_Author" width="100%" height="100%"/>
    <mx:Text text="ext control displays m mmmmmmmmmmmmm 5555555555end" id="lastReply" width="90%" height="100%"/>  

    well, it's more of a behavior, for lack of a better word, of  the component's width (rather than a documented property) You won't find it in the class definition. So, you just need to set the width.  In your code, you originally had;
    <mx:Text id="t" fontWeight="bold" htmlText="You can format the text in a Text control using HTML tags,which are applied after the control's CSS"/>
    you just need to set the width for that component, something like  <mx:Text id="t" width="100%" . . . />  just as you did with the others.  As soon as I set a width on it, it wrapped.
    * note, after setting the width, be sure to 'refresh' your design view to update your changes.

  • Word wrapping with JTextPane and styleDocument

    Can someone help me with the following problem.
    I have a JTextPane where i add a styledDocument.
    If i fill this with text it doen't word-warp the text!
    import javax.swing.JTextPane;
    import javax.swing.text.BadLocationException;
    import javax.swing.text.Style;
    import javax.swing.text.StyledDocument;
    public class LogField extends JTextPane implements LogFileTailerListener{
         public static StyledDocument doc;
         private LogFileTailer tailer;
         private TextStyles styles;
         public LogField(){
              doc = (StyledDocument)this.getDocument();
              styles = new TextStyles();
              tailer = new LogFileTailer( LogPanel.logFileName, 1000, true );
              tailer.addLogFileTailerListener( this );
         public void addText(String text, Style style){     
               try {
                  text = text + System.getProperty("line.separator");
                   doc.insertString(doc.getLength(), text, style);
              } catch (BadLocationException e) {
                   // TODO Auto-generated catch block
         public void newLogFileLine(String line) {

    Since you are simply appending text to the Document you should not be using a type of "text/html".
    If you need further help then you need to create a [Short, Self Contained, Compilable and Executable, Example Program (SSCCE)|], that demonstrates the incorrect behaviour.

  • Force word wrap in JTextPane (using HTMLEditorKit)

    I have a JTextPane on a JScrollPane inside a JPanel. My text pane is using HTMLEditorKit.
    I set the scrolling policies of my JScrollPane to: JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED & JScrollPane.HORIZONTAL_SCROLLBAR_NEVER.
    I did not find in JTextPane�s API any relevant property I can control word-wrapping with (similar to JTextArea�s setLineWrap) and I have tried a few things to force word-wrapping but nothing worked...
    What happens is my text is NOT being wrapped (even though there is no horizontal scrolling) and typed characters (it is an enabled editable text componenet) are being added to the same long line�
    I�d like to force word-wrapping (always) using the vertical scroll bar whenever the texts extends for more then one (wrapped) line.
    Any ideas?
    Message was edited by:

    Your suggestion of using the example only holds if it fits the requirements of the featureDid your questions state anywhere what your requirement was?
    You first questions said you had a problem, so I gave you a solution
    You next posting stated what your where currently doing, but it didn't say it was a requirement to do it that way. So again I suggested you change your code to match the working example.
    Finally on your third posting you state you have some server related issues causing the requirement which I did not know about in my first two postings.
    State your problem and special requirments up front so we don't waste time quessing.
    I've used code like this and it wraps fine:
    JTextPane textPane = new JTextPane();
    textPane.setContentType( "text/html" );
    HTMLEditorKit editorKit = (HTMLEditorKit)textPane.getEditorKit();
    HTMLDocument doc = (HTMLDocument)textPane.getDocument();
    textPane.setText( "<html><body>some long text ...</body></html>" );
    JScrollPane scrollPane = new JScrollPane( textPane );If you need further help then you need to create a [url]Short, Self Contained, Compilable and Executable, Example Program (SSCCE) that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.
    And don't forget to use the [url]Code Formatting Tags so the code retains its original formatting.

  • Word wrap in JList

    I was wondering if I can do a word wrap with JLists.
    I have this so far.
    JList pizza;
    DefaultListModel listPizza;
    JScrollPane scrollPizza;
    listPizza = new DefaultListModel();
    pizza = new JList(listPizza);
    scrollPizza = new JScrollPane(pizza);
    This will let me scroll horizontally if the text becomes longer than the screen, but I want it to wrap around the screen. I only want to it to scroll vertically.

    In the future, swing questions should be posted in the swing forum.
    If I recall correctly, you can do this by making a custom CellRenderer for your JList which uses a JTextArea to do the rendering. Search the swing forum or look at the sun java tutorial for custom renderers.

  • Prob with fixed column widths and word wrapping in viewer

    i have a report where each record has a very long paragraph of text in it.
    In desktop and plus, the text column is at a fixed width and the text just wraps nicely according to the column width.
    But in Viewer, the column widths do not stay fixed, the text does not wrap, and the long text is displayed in a single line that completely stretches the column width off the page and requires a horizontal scroll bar.
    is there anyway to fix the column width in viewer, have the text naturally wrap, and prevent the column stretching. All word wrapping settings are on, but seem to have no effect. I can't seem to find any solution to this.

    Hi Pritam,
    Per my understanding that you can't see the vertical scrollbar of the ReportViewer controls 2012 to scroll for the grid rows, but can see the vertical scrollbar of the web application, you also can't fix the headers while scrolling, right?
    I have tested on my local environment and can't reproduce your issue, but you have an alternative way to add some css  to the web form's source code to display the vertical scrollbar.
    Details information below for your reference:
    Please check below properties setting of the reportviewer which control the visibility of the scrollbar:
    Please check if this problem also occur on other version of IE and other type of browser.
    Please check if you have done correct setting of the Fix data to freeze the table header as the step of below:
    If step1 doesn't work, please click the source of webform.aspx and add below CSS to add the vertical scrollbar manually:
    #ReportViewer1 {
              overflow-y: scroll;
    Run the application you will see it display as below:
    Similar thread for your reference:
    If you still have any problem, please feel free to ask.
    Vicky Liu

  • Read Only TextAreas with Carriage Return, Line Breaks and Word Wrapping

    Hi all,
    I know there are a few posts around this subject but I cannot find the answer to the exact problem I have.
    I have a page that has a 'TextArea with Character Counter' (4000 Chars) that is conditionally read only based on the users credentials (using the 'Read Only' attributes of the TextArea item).
    When the field is editable (not Read Only) everything works fine but when I make the field Read Only I start to have problems:
    The first problem is that the Carriage Return and Line Breaks are ignored and the text becomes one continuos block. I have managed to fix this by adding pre and post element text of pre and /pre tags. This has made the Carriage Return and Line Breaks word nicely and dispaly correctly.
    However, it has introduced a second problem. Long lines, with no Carriage Returns or Line Breaks, now extend to the far right of the page with no word wrapping, making my page potentially 4000+ characters wide.
    How can I get the field to be display only, with recognised Carriage Returns and Line Breaks, and Word Wrapping inside a fixed width of, say, 150 characters?
    Many thanks,

    Just a cut and paste of yours with the field name changed:
    htp.p('</script>');I also have the following in the page HTML Header, could they be conflicting?
    <script type="text/javascript" language="JavaScript">
    function setReleaseToProd(wpTypeCode){
      var get = new htmldb_Get(null,$v('pFlowId'),'APPLICATION_PROCESS=set_release_to_prod',0);
      gReturn = get.get();
      if(gReturn) {
      get = null;
    </script>I am a long way from knowing much about Javascript (this page code was written by someone else) so all help is much appreciated.

  • TLF with Flex Spark RichText ColumnCount - only getting one column

    Hey, I'm new to using TLF, I'm just trying to get a block of text to display its text flow as 3 columns.  I'm using the Spark RichText control (this uses the TLF right?).  I have given the control an explicit width of 800 and a height of 200.  I've then attached a css style wich specifies a columnCount of 3 for the control.  I then populated the controls content property with xml representing a textflow using the tlf markup.  I expected this to result in 3 colums of text that are 200px high and each one around 253px wide (allowing 20px columnGap).
    However the actual result is a single column that is 253px wide and the text extends beyond the 200px bounds of the RichText control wich does seem to have the correct height of 200px.  So it seems the TextFlow is getting that it needs to fit into the columns correctly but it's ignoring the height of the RichText container and so never reaches a bottom so that it can break over to the next column.
    How do i get the RichTexts textflow to listen to the RichTexts height and break over to the next column when it reaches the bottom.  Do i need to be setting the height of the text flow or somthing.
    I'm using the flash builder/ gumbo beta release from the adobe labs site and the TLF version that comes with that version of the sdk.  So maybe this is a bug? I cant find any tutorials or solid info about how to use the RichText control to make columns of text so everything I have done here has been guess work, is there anything i am missing?
    Heres the relevent code bits....
    {SHIPPING_COPY}" styleName="
    200" width="800" />
    <TextFlow xmlns=""><p>
    <span>doopey dooo Lorem ipsum dolor sit amet... </span>
    </TextFlow> ;
     static var SHIPPING_COPY:XML =  
    .footerBody { 
    font-family: Verdana; 
    color: #999999; 
    font-size: 10pt; 
    line-height: "200%"; 
    text-align: justify; 
    text-align-last: left;}

    Hey just a quick update to let you know this seems to be working now! not too sure whats happend, tried a few different things then ended up back at my origional possition and it has broken up into the columns!  I feel like I hit an old TV on the side and the picture went clear .
    One thing of note that held me up for a while...  I read in the decs that the default column gap is 20px so i didn't bother to change it... turns out it wasn't, it was 0px.  Combine this with some confusing looking lorem ipsum copy, and I had what appeared to be a solid block of text... meaning i had my 3 columns for a while without realising my achivement... just a little tip incase anyone else out there stumbles on the same thing

  • Help with a tabel word wrap

    Any one help me please below is the html I have. its reading
    a .js file from an external source. The problem is word wrapping
    the content I need to make the conten wrap with in this table as i
    have no control of how the external content is constructed.
    Any help please.
    <table width="100%" border="0" cellpadding="0"
    cellspacing="0" id="PARA2">
    <td><script language="JavaScript"
    type="text/javascript" src=""></script></td>

    anyone not help with this please

  • Problems with embedded font on spark RichText control

    « Hide
    I have an embedded font that appears correctly when used with Halo components, but when associated with the spark RichText component, it is not recognized.
    The embedded font is defined in css file, my css file
    @namespace s "library://";
    @namespace mx "library://";
    @font-face {
    fontFamily: "Helvetica Neue";
    @font-face {
    fontFamily:"Helvetica Neue";
    fontWeight: bold;
    fontFamily: "Helvetica Neue";
    The embedded font it used in the following manner:
    <mx:Label styleName="panelTitle" text="Hello There"  width="263" x="21" y="11"/>
    <s:Group width="410" x="38" y="52" height="50">
    <s:RichText styleName="panelTitle" text="Hello There" fontFamily="Helvetica Neue"  width="263" x="21" y="11"/>
    The Label shows the embedded font correctly while the RichText control does not. It does not matter if the fontFamily is specified explicitly on the control or not.
    I created a bug SDK-22137, but since I'd need to get this working soon any help would be appreciated.

    Just a friendly reminder. Many of the examples on that site are fairly old and havent been updated to use the latest APIs. For example, "cff" has recently been renamed to "embedAsCFF". In fact, here's a better example:
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx=""
            <s:VerticalLayout paddingLeft="20" paddingTop="20" />
            @namespace mx "library://";
            @namespace s "library://";
            /* DefineFont3 (embedAsCFF == false) */
            @font-face {
                src: url("assets/georgia.TTF");
                fontFamily: embGeorgia;
                fontWeight: normal;
                embedAsCFF: false;
            @font-face {
                src: url("assets/georgiab.TTF");
                fontFamily: embGeorgia;
                fontWeight: bold;
                embedAsCFF: false;
            /* DefineFont4 (embedAsCFF == true) */
            @font-face {
                src: url("assets/georgia.TTF");
                fontFamily: embGeorgiaCFF;
                fontWeight: normal;
                embedAsCFF: true;
            @font-face {
                src: url("assets/georgiab.TTF");
                fontFamily: embGeorgiaCFF;
                fontWeight: bold;
                embedAsCFF: true;
            mx|Label {
                fontFamily: embGeorgia;
            s|RichText {
                fontFamily: embGeorgiaCFF;
                fontLookup: embeddedCFF;
        <mx:Label text="Halo Label" />
        <mx:Label text="Halo Label (bold)" fontWeight="bold" />
        <s:RichText text="Spark RichText" />
        <s:RichText text="Spark RichText (bold)" fontWeight="bold" />
    Also, depending on what you're trying to do, this may help you: l-in-flex-4/. Basically, you can set the textFieldClass style on certain Halo controls and have them use the mx.core.UITLFTextFieldClass (instead of the default mx.core.UITextFieldClass) so they can take advantage of the new CFF fonts.
    In fact, here's the same example as above, but with the single embedded font:
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx=""
            <s:VerticalLayout paddingLeft="20" paddingTop="20" />
            @namespace mx "library://";
            @namespace s "library://";
            /* DefineFont4 (embedAsCFF == true) */
            @font-face {
                src: url("assets/georgia.TTF");
                fontFamily: embGeorgiaCFF;
                fontWeight: normal;
                embedAsCFF: true;
            @font-face {
                src: url("assets/georgiab.TTF");
                fontFamily: embGeorgiaCFF;
                fontWeight: bold;
                embedAsCFF: true;
            mx|Label {
                fontFamily: embGeorgiaCFF;
                textFieldClass: ClassReference("mx.core.UITLFTextField");
            s|RichText {
                fontFamily: embGeorgiaCFF;
                fontLookup: embeddedCFF;
        <mx:Label text="Halo Label" />
        <mx:Label text="Halo Label (bold)" fontWeight="bold" />
        <s:RichText text="Spark RichText" />
        <s:RichText text="Spark RichText (bold)" fontWeight="bold" />

  • Getting error with word wrap

    So this is the error im getting:
    Error: Error #1502: A script has executed for longer than the default timeout period of 15 seconds.
              at flashx.textLayout.elements::FlowElement/getAbsoluteStart()[C:\Vellum\branches\v1\1.0\dev\ output\openSource\textLayout\src\flashx\textLayout\elements\]
              at flashx.textLayout.compose::TextFlowLine/get location()[C:\Vellum\branches\v1\1.0\dev\output\openSource\textLayout\src\flashx\textLayo ut\compose\]
              at flashx.textLayout.compose::ComposeState/createTextLine()[C:\Vellum\branches\v1\1.0\dev\ou tput\openSource\textLayout\src\flashx\textLayout\compose\]
              at flashx.textLayout.compose::ComposeState/composeNextLine()[C:\Vellum\branches\v1\1.0\dev\o utput\openSource\textLayout\src\flashx\textLayout\compose\]
              at flashx.textLayout.compose::BaseCompose/composeParagraphElementIntoLines()[C:\Vellum\branc hes\v1\1.0\dev\output\openSource\textLayout\src\flashx\textLayout\compose\ 45]
              at flashx.textLayout.compose::ComposeState/composeParagraphElement()[C:\Vellum\branches\v1\1 .0\dev\output\openSource\textLayout\src\flashx\textLayout\compose\]
              at flashx.textLayout.compose::BaseCompose/composeBlockElement()[C:\Vellum\branches\v1\1.0\de v\output\openSource\textLayout\src\flashx\textLayout\compose\]
              at flashx.textLayout.compose::BaseCompose/composeInternal()[C:\Vellum\branches\v1\1.0\dev\ou tput\openSource\textLayout\src\flashx\textLayout\compose\]
              at flashx.textLayout.compose::ComposeState/composeInternal()[C:\Vellum\branches\v1\1.0\dev\o utput\openSource\textLayout\src\flashx\textLayout\compose\]
              at flashx.textLayout.compose::BaseCompose/composeTextFlow()[C:\Vellum\branches\v1\1.0\dev\ou tput\openSource\textLayout\src\flashx\textLayout\compose\]
              at flashx.textLayout.compose::ComposeState/composeTextFlow()[C:\Vellum\branches\v1\1.0\dev\o utput\openSource\textLayout\src\flashx\textLayout\compose\]
              at flashx.textLayout.compose::StandardFlowComposer/[C:\Vellum\branches\v1\1.0\dev\output\openSource\textLayout\src\flashx\textLayout\compos e\]
              at flashx.textLayout.compose::StandardFlowComposer/internalCompose()[C:\Vellum\branches\v1\1 .0\dev\output\openSource\textLayout\src\flashx\textLayout\compose\ 758]
              at flashx.textLayout.compose::StandardFlowComposer/compose()[C:\Vellum\branches\v1\1.0\dev\o utput\openSource\textLayout\src\flashx\textLayout\compose\]
              at flashx.textLayout.container::TextContainerManager/compose()[C:\Vellum\branches\v1\1.0\dev \output\openSource\textLayout\src\flashx\textLayout\container\ ]
              at flashx.textLayout.container::TextContainerManager/updateContainer()[C:\Vellum\branches\v1 \1.0\dev\output\openSource\textLayout\src\flashx\textLayout\container\TextContainerManager .as:1292]
              at spark.components::RichEditableText/updateDisplayList()[E:\dev\4.0.0\frameworks\projects\s park\src\spark\components\]
              at mx.core::UIComponent/validateDisplayList()[E:\dev\4.0.0\frameworks\projects\framework\src \mx\core\]
              at mx.managers::LayoutManager/validateClient()[E:\dev\4.0.0\frameworks\projects\framework\sr c\mx\managers\]
              at mx.core::UIComponent/validateNow()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core \]
              at spark.components::DataGroup/getVirtualElementAt()[E:\dev\4.0.0\frameworks\projects\spark\ src\spark\components\]
              at layouts::SemiCarouselLayout/updateDisplayListVirtual()[C:\ColdFusion9\wwwroot\com\schooli mprovement\pd360\layouts\]
              at layouts.supportClasses::NavigatorLayoutBase/updateDisplayList()[C:\ColdFusion9\wwwroot\co m\schoolimprovement\pd360\layouts\supportClasses\]
              at layouts.supportClasses::PerspectiveNavigatorLayoutBase/updateDisplayList()[C:\ColdFusion9 \wwwroot\com\schoolimprovement\pd360\layouts\supportClasses\PerspectiveNavigatorLayoutBase .as:132]
              at layouts::SemiCarouselLayout/updateDisplayList()[C:\ColdFusion9\wwwroot\com\schoolimprovem ent\pd360\layouts\]
              at spark.components.supportClasses::GroupBase/updateDisplayList()[E:\dev\4.0.0\frameworks\pr ojects\spark\src\spark\components\supportClasses\]
              at spark.components::DataGroup/updateDisplayList()[E:\dev\4.0.0\frameworks\projects\spark\sr c\spark\components\]
              at mx.core::UIComponent/validateDisplayList()[E:\dev\4.0.0\frameworks\projects\framework\src \mx\core\]
              at mx.managers::LayoutManager/validateDisplayList()[E:\dev\4.0.0\frameworks\projects\framewo rk\src\mx\managers\]
              at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.0.0\frameworks\projects\frame work\src\mx\managers\]
              at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\4.0.0\frameworks\projec ts\framework\src\mx\managers\]
    From what I can tell I have several links and the end of my text flow they are formatted like this "" they reference to a code. If I add text to so that one of them kicks down to then next line the error goes away. also if I change the textAlign to justify it goes away as well. it looks like it has to do with the word wrap. If you have any suggestions or help that would be great thanks.

    "Error: Error #1502: A script has executed for longer than the default timeout period of 15 seconds." means there is an endless loop in getAbsoluteStart(). That is to say, one of the elements in the textflow has a incorrect '_parent'. You can debug to see if it's your fault or ours.

Maybe you are looking for