JEditorPane has no word wrap?

Hi All,
There is no word wrap for JEditorPane, only characater-boundary wrapping. Does anyone know if I need to dig deeper into this? Such as learning about different document styles or something along those lines?
JTextArea supports word wrap, but I wants a little more style, mang.
Thanks for any info.

Subclass JEditorPane to return a new StyledEditorKit for content type 'text/plain'.
public EditorKit getEditorKitForContentType( String type )
    if (type.equalsIgnoreCase( "text/plain" )) {    
        return new javax.swing.text.StyledEditorKit( ); 
    } else {    
        return super.getEditorKitForContentType( type ); 
}

Similar Messages

  • Word wrap in JEditorPane...

    hi
    by default, the JEditorPane set the word wrap to true.
    how can i change it?

    thankyou very much. I have been looking for a book that went into detail on creating a word processor with Java components. This will help alot.
    thanks,
    dean

  • How to  word wrap the Print from JEditorPane correctly to a print page?

    Hi,
    I'm trying to print text from the JEditorPane. However the printout does not word wrap and some gets cutoff. Is there a way to set the word wrap when printing?
    Thanks for you help.

    Some of my Hotmail emails are not word wrapping properly. Partial word wrapping is done,but each sentence requires the use of the scroll bar to reach the end.
    Other emails are normal.I opened Hotmail in IE9,and the same email wraps normally.I have FF 9.0.1 running on Win7 Home Premium.

  • JEditorPane word wrap problems

    I am using a JEditorPane in a chat window that is used, like instant messenger, between two clients. The ability to insert icons and different fonts is available after setting the editor kit to an HTMLEditorKit. However, after using an HTMLEditorKit, the word wrapping is a bit funky in that the words are cut off when wrapping.
    Is there any way to get aroudn this while STILL using a JEditorPane (or something similar that can accept HTML?). I would be able to use JTextPane, which wraps correct (I believe...I'm trying to think back to my first implementation), but the icons begin to get tricky there. I know how to insert them, but if I have multiple icons, I would need to find all of the first occuring icons since the string needs to be printed immediately to the screen.
    Thanks for any help.

    I don't have an HTML document. Maybe you are mis-interpreting what I am trying to do :)
    I am implementing a simple instant messenger (much like AIM). Right now, I have a JEditorPane that is using an HTMLEditorKit to render HTML. This is used to display emoticons and also change the font and font color. So, the HTML I am generating is manually put in there in the code so text will show up differently - say, the senders name will be red and the recipient will be blue.
    Everything is working fine, except the text is wrapping and words are being cut off. In other words, this is happening:
    | This is an exa |
    | mple of some |
    | thing that is ha |
    | ppenning in m |
    | y chat window. |
    -----------------------

  • JEdtiorPane/HTMLEditorKit word wrapping problems

    Hi,
    I have a JFrame component that has a splitPane, on the left side is a JTree and the right side has a JEditorPane that has it's content updated with HTML using a method to generate the HTML via the setText() method . (no url, and no html file)
    The searching I did indicates that word wrapping is the default behavior, and I saw a lot of posts from people trying to get rid of the word wrapping, but it isn't wrapping at all for me. I get the horizontal scroll bar.
    I had the same problem using a JTextPane...anyone know how to wrap text?
    here's the relevant code:
    descriptionPanel = new JPanel(new BorderLayout());
              descriptionEditorPane = new JEditorPane();
              HTMLEditorKit htmlEditorKit = new HTMLEditorKit();
              descriptionEditorPane.setEditorKit(htmlEditorKit);
              descriptionEditorPane.setSize(new Dimension(610,800));
              descriptionEditorPane.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
              descriptionPanel.add(descriptionEditorPane);

    Did you place the components into scroll panes and then put those into the split pane?
    If so, then I guess that calling setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER) on the editor pane's scroll pane might solve your problem.

  • 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,
    Martin

    Hi,
    Just a cut and paste of yours with the field name changed:
    htp.p('<script>');
    htp.p('$x("P3_COMMENTS").readonly=true;');
    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){
       //setReleaseToProd($v(this))
      var get = new htmldb_Get(null,$v('pFlowId'),'APPLICATION_PROCESS=set_release_to_prod',0);
      get.addParam('x01',wpTypeCode);
      gReturn = get.get();
      if(gReturn) {
         $s('P3_RELEASE_TO_PROD',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.
    Martin

  • DataGrid, HTML Text, and WORD WRAPPING

    I have a datagrid, with 2 columns:
    - comment
    - date
    The dataprovider that feeds the datagrid is an array
    collection, with each object containing the following fields:
    - comment
    - date
    - viewed
    What I want to do is BOLD the comment cell if the comment has
    not yet been viewed. What I first tried doing was to just insert
    the <b></b> tags on the server and then feed them up to
    Flex. So here's the code that I had tried to do this with:
    <mx:DataGridColumn>
    <mx:itemRenderer>
    <mx:Component>
    <mx:HBox>
    <mx:Label htmlText="{data.comment}" />
    </mx:HBox>
    </mx:Component>
    </mx:itemRenderer>
    </mx:DataGridColumn>
    This works, but I lose the word wrapping for long comments (I
    have wordwrap="true" defined on my DataGrid).
    Then I tried changing my approach and doing something a
    little more simple to try and preserve the word wrapping, like
    this:
    <mx:DataGridColumn dataField="comment" width="100"
    wordWrap="true" fontWeight="{(data.viewed==0 ? 'bold' : 'normal')}"
    />
    Yet that doesn't seem to work either, it appears to just
    completely ignore everything... no bolding whatsoever.
    So my question is: what's the best to to control the BOLDING
    of a DataGrid cell while at the same time retaining the word wrap
    features?
    Thanks,
    Jacob

    <mx:DataGridColumn>
    <mx:itemRenderer>
    <mx:Component>
    <mx:HBox>
    <mx:Label htmlText="{data.comment}"
    wordWrap="true" height="100%"/>
    </mx:HBox>
    </mx:Component>
    </mx:itemRenderer>
    </mx:DataGridColumn>
    You might also have a little more luck working with a
    TextArea

  • [Solved]Conky and word wrapping - Is there a way?

    So I have a very limited area to work with, something like 176x360 (+/- a few pixels), and I want the ability to show an RSS feed. Well, the feed works of course, but due to the limited width, I'm in great need of word wrapping, and for that problem I have found no solution and going on for 2-3 hours straight, my head hurts
    Anyway, here's my .conkyrc, not that it's needed of course.
    # ~/.conkyrc
    double_buffer yes
    use_xft yes
    xftfont Bitstream Vera Sans Mono:size=8
    xftalpha 0.8
    update_interval 1.0
    total_run_times 0
    own_window yes
    own_window_type override
    own_window_transparent yes
    own_window_colour hotpink
    own_window_hints undecorated,below,skip_taskbar,sticky,skip_pager
    minimum_size 176 360
    maximum_size 176 360
    maximum_width 176
    draw_shades no
    draw_outline no
    draw_borders no
    stippled_borders 0
    border_margin 0
    border_width 0
    default_color green
    default_shade_color green
    default_outline_color green
    alignment bottom_right
    gap_x 16
    gap_y 16
    no_buffers yes
    uppercase no
    TEXT
    $alignc${nodename}
    $alignc${sysname} ${kernel}
    $hr
    CPU:$alignr$cpu% ${cpubar 10,106}
    RAM:$alignr$memperc% ${membar 10,106}
    HDD:$alignr${fs_used_perc /}% ${fs_bar 10,106 /}
    BAT:$alignr${battery_percent}% ${battery_bar 10,106}
    $hr
    Download: Upload:
    eth0 ${downspeed eth0} $alignr${upspeed eth0}
    wlan0 ${downspeed wlan0} $alignr${upspeed wlan0}
    $hr
    ${alignc}ARCH NEWS
    ${rss http://www.archlinux.org/feeds/news/ 1 item_titles 10 }
    I know this looks confusing and probably is full of critical error, but that simple because I'm a conky noob. I basically just downloaded a profile I liked and completely changed it over the course of a few hours.
    Anyway, I'm rambling again, but if you've got any idea's, please do let me know.
    Best regards.
    Last edited by zacariaz (2012-08-27 17:19:35)

    Okay, so I've found sort of a solution to part of the problem, so what I have so far look like this:
    wget -quiet -O - archlinux.org/feeds/news/ | fmt -w 25 -g 25
    It works as long as there are no words longer than 25 character, which I should think is rare, even including package names and such.
    However there's still the issue parsing the xml so I get only what I want:
    <item><title>$content</title><link>
    This may be solved using some sort of terminal rss parser, but I would rather prefer not to.
    Then there's the issue with reloading.
    My current conky is set to reload every second, but of course one can't just pull the feed every second and I'm not convinced that conky has any built in solution for that problem. Of course I can always start a cronjob and save it all to a file, but portability would be nice.
    anyway, I'll return later.

  • 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.
    Thanks...

    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:
    AsyncRendering="true"
    SizeToReportContent="false"
    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:
    http://technet.microsoft.com/en-us/library/bb934257(v=sql.100).aspx
    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:
    https://social.msdn.microsoft.com/forums/sqlserver/en-US/f96b3b56-e920-411b-82ea-40467c922e66/reportviewer-control-vertical-scroll-bars
    If you still have any problem, please feel free to ask.
    Regards
    Vicky Liu

  • Word wrapping of HTML source

    The source (HTML) view of a topic is always formatted with
    extra carriage returns and tabs. I appreciate the fact that the
    lines of html are word wrapped. However, I don't need or want all
    these extra formatting characters. It makes search and replace very
    difficult. Can I disable this feature?

    I use EditPlus for these operations. You can search multiple
    files, replace Breaks and <p> and do other searches quickly.
    In addition, it has a very nice macro function for tweaking blocks
    of text.
    You can also deal with hhk and other text-based files. This
    is very useful for changing a whole wad of broken links at once
    including links in the hhc and hhk files.
    I can open stuff in EditPlus while RoboHTML is running.
    RoboHTML's editor also does a nice job of deleting unmatched
    formating openers like <span> <blockquote> <p>,
    etc. As soon as you save the EditPlus file, RoboHTML updates the
    page.
    In addition, EditPlus will open hundreds of files at
    once.

  • Word Wrap in ipad email

    My email consistently is seen by my recipients in a long line, without word wrap.  How can I change  this?  I'm using Yahoo, but it doesn't happen with any other mail client beyond my ipad.

    Yes, and here we are 7 months later still looking totally stupid when we send emails with lines that don't wrap to fit the window (like it just did here).  I saw this happen with a friends iPad and we spent hours looking to turn on word wrap, which has been a minimum standard since the 1980's.  I assumed this would have been fixed by the time I bought this iPad2 but NO.  It is truly an UGLY fact that Apple can produce elegant devices that don't have the basic minimum programming to make them work properly.  I am so angry that I bought an Android phone instead because it word wraps emails beautifully and instantly reformists to wide or narrow screen.  Conversely, if I type an iPad email and the line continues beyond the edge of the window the type is made smaller and smaller the longer the line gets.  The reply to my email showed that my type size was about 2 points in height and looked like unreadable ants on the screen.  Wake up Apple, Linux is going to Eat Your Lunch if some Smart programming isn't applied to your devices!

  • Word wrap - add return within cell

    I have the need of putting word(s) on definitive lines within a cell. The particular case I am working with at the moment is a cemetery listing that has additional information particularly multiple spouses. I want each spouse's name to appear on a different line within that cell which Xcel does by using either ctl/enter or option/enter rather than putting a number of spaces in a wrapped cell so the next name would shift to the next line. Does Numbers have something similar?
    Tks

    Found another neat feature that also works with word wrap. Use Inspector to Merge two or more cells, I happen to have a long text in the first cell of three cell I wanted to use. Follow that by adding Word Wrap while still in Inspector. Low and Behold, the text that far exceeded the one cell now uses three cell for display and if the data then exceeds that amount of space it wraps as if the three cell are a single cell. It just so happened that the data I mentioned above needed three lines. Also, if you want specific parts of the data to be on specific lines within the unified cell, both line break functions previously mentioned will force the next part of the data to go to the next line ad infintum(??) or until the combined cell space/character limit is reached.

  • Word Wrap In Excel File

    Hi experts,
    I am trying to send an excel file as attachment . I have a column called remarks which is way too long. So  i need to Wrap the text
    Can any one help me out in this?
    CONCATENATE DUMMY BUKRS WERKS  it_inv-bstnk_vf IT_INV-ORT01 VEHNO 'SUGAR' FKLMG BP EXCDUTY EXINVNO
    EXDAT NETVL IT_INV-NAM_1 IT_INV-KZABE IT_INV-KZGBE  INTO IT_ATTACH SEPARATED BY CON_TAB.
    CONCATENATE IT_ATTACH CL_ABAP_CHAR_UTILITIES=>CR_LF INTO IT_ATTACH."nam_1 has to be Word Wrapped
    APPEND IT_ATTACH.
    With thanks in Advance
    Syed Ibrahim .G

    thanks simone,
    I tried with converting to XML and then to excel.It is getting generated , but i cannot open the excel file.
    It is showing the error when i am trying to open the file in the log.
    XML PARSE ERROR:  Undefined namespace
    this is the code i am using.
      l_ixml = cl_ixml=>create( ).
    * Creating the DOM Object Model
      l_document = l_ixml->create_document( ).
    * Create Root Node 'Workbook'
      l_element_root  = l_document->create_simple_element( name = 'Workbook'  parent = l_document ).
      l_element_root->set_attribute( name = 'xmlns'  value = 'urn:schemas-microsoft-com:office:spreadsheet' ).
      call method l_element_root->set_attribute_node"( ns_attribute ).
      exporting
        NEW_ATTR = ns_attribute.
      r_element_properties = l_document->create_simple_element( name = 'TEST_REPORT'  parent = l_element_root ).
      l_value = sy-uname.
      l_document->create_simple_element( name = 'Author'  value = l_value  parent = r_element_properties  ).
      r_styles = l_document->create_simple_element( name = 'Styles'  parent = l_element_root  ).
    call method r_style->set_attribute_ns
      exporting
         name = 'ID'
         prefix = 'ss'
         value = 'Header' .
      r_format  = l_document->create_simple_element( name = 'Font'  parent = r_style  ).
      r_format->set_attribute_ns( name = 'Bold'  prefix = 'ss'  value = '1' ).
      r_format  = l_document->create_simple_element( name = 'Interior' parent = r_style  ).
      r_format->set_attribute_ns( name = 'Color'   prefix = 'ss'  value = '#92D050' ).
      r_format->set_attribute_ns( name = 'Pattern' prefix = 'ss'  value = 'Solid' ).
      r_format  = l_document->create_simple_element( name = 'Alignment'  parent = r_style  ).
      r_format->set_attribute_ns( name = 'Vertical'  prefix = 'ss'  value = 'Center' ).
      r_format->set_attribute_ns( name = 'WrapText'  prefix = 'ss'  value = '1' ).
      r_border  = l_document->create_simple_element( name = 'Borders'  parent = r_style ).
      r_format  = l_document->create_simple_element( name = 'Border'   parent = r_border  ).
      r_format->set_attribute_ns( name = 'Position'  prefix = 'ss'  value = 'Bottom' ).
      r_format->set_attribute_ns( name = 'LineStyle'  prefix = 'ss'  value = 'Continuous' ).
      r_format->set_attribute_ns( name = 'Weight'  prefix = 'ss'  value = '1' ).
      r_format  = l_document->create_simple_element( name = 'Border'   parent = r_border  ).
      r_format->set_attribute_ns( name = 'Position'  prefix = 'ss'  value = 'Left' ).
      r_format->set_attribute_ns( name = 'LineStyle'  prefix = 'ss'  value = 'Continuous' ).
      r_format->set_attribute_ns( name = 'Weight'  prefix = 'ss'  value = '1' ).
      r_format  = l_document->create_simple_element( name = 'Border'   parent = r_border  ).
      r_format->set_attribute_ns( name = 'Position'  prefix = 'ss'  value = 'Top' ).
      r_format->set_attribute_ns( name = 'LineStyle'  prefix = 'ss'  value = 'Continuous' ).
      r_format->set_attribute_ns( name = 'Weight'  prefix = 'ss'  value = '1' ).
      r_format  = l_document->create_simple_element( name = 'Border'   parent = r_border  ).
      r_format->set_attribute_ns( name = 'Position'  prefix = 'ss'  value = 'Right' ).
      r_format->set_attribute_ns( name = 'LineStyle'  prefix = 'ss'  value = 'Continuous' ).
      r_format->set_attribute_ns( name = 'Weight'  prefix = 'ss'  value = '1' ).
      r_worksheet = l_document->create_simple_element( name = 'Worksheet'  parent = l_element_root ).
      r_worksheet->set_attribute_ns( name = 'Name'  prefix = 'ss'  value = 'Sheet1' ).
      r_table = l_document->create_simple_element( name = 'Table'  parent = r_worksheet ).
      r_table->set_attribute_ns( name = 'FullColumns'  prefix = 'x'  value = '1' ).
      r_table->set_attribute_ns( name = 'FullRows'     prefix = 'x'  value = '1' ).
      r_column = l_document->create_simple_element( name = 'Column'  parent = r_table ).
      r_column->set_attribute_ns( name = 'Width'  prefix = 'ss'  value = '40' ).
      r_column = l_document->create_simple_element( name = 'Column'  parent = r_table ).
      r_column->set_attribute_ns( name = 'Width'  prefix = 'ss'  value = '90' ).
      r_column = l_document->create_simple_element( name = 'Column'  parent = r_table ).
      r_column->set_attribute_ns( name = 'Width'  prefix = 'ss'  value = '140' ).
      r_column = l_document->create_simple_element( name = 'Column'  parent = r_table ).
      r_column->set_attribute_ns( name = 'Width'  prefix = 'ss'  value = '150' ).
    With thanks in advance,
    Syed Ibrahim . G

  • Word wrap problems in 36.0

    When entering text into a web form the text no longer "wraps" at the end of the box. The first part of the text runs off the left side. It is working fine in THIS text entry box but is now a problem on some other sites.
    See: http://www.thedirectoryclassifieds.com. Start placing a listing and then start entering text into the description box. Once you reach the end of the line the text does not wrap, just runs off the left side as typing continues. After this testing, just exit (back out) without continuing placing the listing.
    When encountering this problem I did a test on another computer that had 35.0.1 and word wrapping worked fine. Then I upgraded to 36.0 on that computer and now the problem is there too.
    So this definitely means a problem with 36.0 as it wasn't there in earlier versions.

    That particular form control has:
    &lt;textarea id="main_description" name="b[description]" '''style="white-space: pre;"''' class="editor field">&lt;/textarea>
    For the first time in Firefox 36, the white-space property is being honored for textarea controls. So there's your trouble: "pre" means Firefox should emulate the preformatted tag, which requires manual line breaks.
    It would be great if you can convince the site to change this to:
    &lt;textarea id="main_description" name="b[description]" '''style="white-space: pre-wrap;"''' class="editor field"></textarea>
    which is supported by all modern browsers (per the compatibility table here: [https://developer.mozilla.org/docs/Web/CSS/white-space#Browser_compatibility]).
    But that likely will take some time, so what is the best short-term workaround? I need to think about that a bit.
    To manually hack this form control, you can right-click it and choose Inspect Element (Q). This should open the web console to the Inspector in the lower part of the tab. Firefox should highlight the HTML tag I listed first above, and on the right, show the style rules for it. Under "This Element" you can uncheck the box for that rule to have the textarea styled using default rules. But you would need to do this after each time you load the page, which is a hassle.

  • Word wrap seems to expand.

    I have noticed for quite a while now that with some emails I reply to that my written txt goes off the page ie is does not stop at the edge of the screen and wraps, it carries on for several words and then comes back. its as if the word wrap feature has expanded. Has anyone else found this.
    Thanks in advance

    anyone?

Maybe you are looking for