Hard Line Breaks in JEditorPane

Hello All - How can I create hard line breaks in a JEditorPane's document with HTMLEditorKit after a line wraps. In other words, I'd like to see a <br> when the cursor moves to the next line.
Please Help !
Norman

Your answer is in your question....This is an old post and the OP had already been given the correct answer at the link shown below:
http://forum.java.sun.com/thread.jsp?thread=482553&forum=57&message=2251721
;o)
V.V.

Similar Messages

  • PHP deletes .swf line breaks

    Hi all -
    I have a designed a Flash based interface to send email via
    PHP.
    I capture the variables in Flash using:
    var my_lv:LoadVars=new LoadVars();
    my_lv.name=name_txt.text;
    my_lv.message=message_txt.text;
    my_lv.send("mail.php","POST");
    My PHP reads:
    <?php
    $headers = "From: " . $_POST["name"];
    $headers .= "<" . $_POST["from"] . ">\r\n";
    $headers .= "Reply-To: " . $_POST["from"] . "\r\n";
    $headers .= "Return-Path: " . $_POST["from"];
    $to = $_POST['to'];
    $message=stripslashes($_POST['message']);
    //NOTE: I tried $message without stripslashes - same results
    $subject=stripslashes($_POST['subject']);
    mail($to, $subject, $message, $headers);
    ?>
    When the message is received all line breaks using
    RETURN/ENTER in Flash message .swf are deleted making the message
    one long line when viewed by the recipient. Is there something I
    need to write into my actionscript/php to allow the message to
    recognize these hard line breaks and display properly in the
    recipient's email client? I'm guessing (hoping!) it's an easy fix.
    BTW, the messages do display properly in 'some' clients and not
    others. I need some fix that will correct this across the board.
    Thanks in advance -

    Couple of things to note,
    You should have a ","not a ";" separating the message and headers fields.
    Secondly, "$name.=$phone.$message" is meaningless. If you are trying to concatenate the three fields together, you have to use "." and add in whatever spaces of carriage returns/linefeeds you want. So:
    $name."<br>".$phone."<br>".$message
    It's frequently good to add labels to the fields so the reader knows what sorts of information should be there.
    The text in any line should not exceed70 characters, according to the PHP rules. You will have to break up the message if it's longer than that.
    Unless you are doing a lot of error checking for bad input, you are exposing yourself to a lot of harm using this function, like opening you and your server up to all sorts of nasty attacks.
    Never trust any input from the user.

  • Exporting EPUB from InDesign CC not including line breaks

    I am done with a book and have it formatted the way I want. I am exporting it to EPUB through InDesign CC and previewing it in iBooks and also through Kindle previewer. Everything is fine except for one thing... where I have created page breaks, the exported file is not including them.
    I tried exporting to HTML just to see what it did and there is no line breaks there. I know its proprietary markup ( in kindle ) but I still would like to include them in a few specific places ( to mark seperations of chapters ).
    In kindle this is the tag they say to use: <mbp:pagebreak />
    In iBooks, I have not yet figured out how to create them, I am going to work on that today once I sort out the kindle version.
    Is there any way to force it to include line breaks on export. Or alternatively, I could export to HTML but I am having trouble figuring out how to go back to the EPUB format from there and also it didn't include the fonts, so there was other issues to consider as I have a custom font I was using for the headers that looks really good and matches the font on the book cover as well... so I really want to keep that consistent if possible.
    Are there any tricks or things I can try here to improve on my workflow and do a better job of seperating the chapters ?

    Ok, I hadn't tested the advanced options out in the export menu. It works and does so on both the iBooks and Kindle previewer.. which is good news since that is really important to me to try and find a workflow I can update both of these formats from when I continue to work on my book.
    The only strange part is that on some chapters its adding an extra blank page between the chapter and the next. What is odd is that it only happens on some of them (in the iBook reader only, the kindle previewer isn't doing this)
    I am going to look into this more closely but its not a major deal as I would prefer a little seperation in the chapters anyways, its not really a bad thing. It is just hard to figure out why its doing this.

  • LE7:Score Layout:Global Format:Maximum Bars per Line - Line Break Bug!

    Hello
    This problem occurs in Logic Express version 7.
    (I am using MacOS version 10.4.2 on an eMac)
    I am currently compiling and editing a large score for a big band composition consisting of 22 parts:
    Flute 1
    Flute 2
    Clarinet 1
    Clarinet 2
    Alto Sax 1
    Alto Sax 2
    Tenor Sax 1
    Tenor Sax 2
    Baritone Sax
    Trombone 1
    Trombone 2
    Trombone 3
    Trombone 4
    Trumpet 1
    Trumpet 2
    Trumpet 3
    Trumpet 4
    Guitar
    Keyboard
    Electric Bass
    Percussion 1 (Kit)
    Percussion 2 (Aux)
    I am creating the score in a separate file, and I am combining parts into 1 stave each by instrument like this:
    Flute 1 & 2
    Clarinet 1 & 2
    Alto Sax 1 & 2
    Tenor Sax 1 & 2
    Baritone Sax
    Trombone 1 - 4
    Trumpet 1 - 4
    Guitar
    Keyboard (2 staves)
    Bass
    Percussion
    Each instrument, with the exception of keyboard which has 2 staves, consists of one stave, making up systems of twelve staves each. By sizing down each score style to 2,
    I have managed to fit 2 systems onto each page, therefore significantly reducing the amount of paper needed.
    The problem comes when organising the layout of my score,
    in particular, the line breaks. Using layout:global format, I have limited the maximum number of bars per line to 8, both in the page edit and normal score mode.
    I am trying to divide up my score so that there are 8 bars per system. Using the white arrow tool, I am dragging bars up and down in order to achieve this.
    However, when I get 30 odd bars in, I discover a system with 12 bars crammed into it - and even printing it off, it is clear that the system could benefit with less bars; the notation is squashed up together and not very easy to read.
    THIS IS THE ACTUAL PROBLEM:
    So I tried using the white arrow to move the last 4 bars down onto the next system, and a bug occurs where I end up with about 20 bars on the system, oddly distorted, the first few bars of which are squashed up together at the beginning of the line, and the last bar of which is stretched far off the right hand side of the page out of view. Then the next 20 or so bars are no where to be seen (probably far off the right hand side of the page) before the system below.
    If you dont know what I am talking about, I could provide a screenshot if you request.
    I have tried everything to get 8 bars on that particular system; dragging the stretched bar downwards, dragging squashed bars downward, moving bars down 1 by 1, moving bars onto the system above, moving bars away from the system below (to make room for the 4 bars that I want to move from above), adding more bars and dragging them down, but none of these methods have worked. I am either stuck with 12 bars crammed onto one system and 4 bars on the next or an oddly distorted version of the system which cannot possibly be read. Even when I settle with the unsatistactory former, I encounter further problems on subsequent systems below, some systems of which are already distorted.
    All I want is to have 8 bars per system, it should not be too much to ask! The layout:global format:maximum-bars-per-line calculation seems to be redundant, even when I reset the default line breaks - it just does not automatically set 8 bars per line, which it should do. Is there not an option to determine bars individually by number onto their respective lines, without having to use the white arrow graphic layout tool?
    The problem is extremely frustrating, and it is preventing me from completing, presenting and handing in a score for my university music composition.
    I have no other score producing software, and starting it
    from scratch on paper is going to take me weeks, because it consists of 830 12/8 bars in 22 parts, and I need to get it ready by next term!
    Any help would be extremely helpful and much appreciated, especially a patch or a useful way round. It could be related to memory, or hard drive space, as I have experienced similar problems in the past, where my score has been stretched off the page during a time when I have had little disk space...and this is a very large piece of music which might stretch the score capabilities of Logic.
    If so, has anyone got any suggestions?
    Thanks!
    Rory
    eMac   Mac OS X (10.4.2)  
    eMac   Mac OS X (10.4.2)  

    nope just cutting should work.
    here are some things to try:
    1. try assigning a different score style. for the regions. duplicate and then adjust the default ones if necessary.
    2. try creating a new instrument set. in fact delete them and make a new one (use the key command: create instrument set from selected)
    3. it may be a formatting problem so check:
    in global layout constant spacing (try 8 or 9) and proportional spacing (try 45 or so). then try factory defaults.
    4. try copying and pasting the midi into a brand new region and looking at the score for that.
    5. try fiddling with the layout tool drqagging bars up or down.
    normally simply cutting the region of just one object is enough to force a redraw. maybe try it on all of the regions. what happens when you double click on a region?

  • Line number in JEditorPane

    I would like to know the line number of the current caret position in a JEditorPane. The getLineOfOffset(int offset) method in JTextArea offers exactly what I want. How come there's no method to find out about line number in JEditorPane?
    As a workaround, I copied the Swing code from the JTextArea.getLineOfOffset method and used it in my class which extends from JEditorPane. It seems to work fine, but it feels like a bad hack. Will the JTextArea code always work in JEditorPane? Any alternatives? I just think that it's tedious and inefficient to deal with StringTokenizer or manually searching for new line charactors on CaretEvent's.
        public int getLineOfOffset(int offset) throws BadLocationException {
            Document doc = getDocument();
            if (offset < 0) {
                throw new BadLocationException("Can't translate offset to line", -1);
            } else if (offset > doc.getLength()) {
                throw new BadLocationException("Can't translate offset to line", doc.getLength()+1);
            } else {
                Element map = getDocument().getDefaultRootElement();
                return map.getElementIndex(offset);
        }

    It's not a hack. Any document used with a Swing text component is supposed to have the same basic element structure, i.e., a default root element whose children represent logical lines. It's just that with some kinds of documents, like HTML, line numbers don't really mean anything. But JTextArea is hard-coded to use a PlainDocument, which means a logical line always represents a paragraph (or a line of code, or something meaningful), so it made sense for it to provide those convenience methods.

  • Can't make a soft line break in Photoshop CS3 anymore

    Hello,
    I posted this topic a while back with no answers.
    I used to be able to do a "soft" line break in photoshop by hitting "shift + enter." it's not working anymore-- it's only giving me a "hard return".
    are we no longer able to do soft breaks in photoshop anymore?
    thanks,
    -bf

    In what version of Photoshop could you do this? I don't recall it working in ages.

  • "Soft" Line Breaks in Photoshop CS3?

    Hello,
    I used to be able to do a "soft" line break in photoshop by hitting "shift + enter." it's not working anymore-- it's only giving me a "hard return".
    are we no longer able to do soft breaks in photoshop anymore?
    thanks,
    -bf

    In what version of Photoshop could you do this? I don't recall it working in ages.

  • How to line break in an SQL Report

    I have a simple SQL report with many columns that make the window very wide and the use has to scroll horizontally quite a lot.
    How can I make the line break after some column?
    Can someone give me a live example for that?

    Custom report template then is your answer.. Without seeing your initial report it would be hard to give you the code fully. However, if you open the standard report template for your theme, you could save it as a new template and edit it accordingly. You would find the column you wish to break on and create a new <tr> .. </tr> under the <td> definition..
    Thank you,
    Tony Miller
    Webster, TX

  • Add line break in pdf

    We have a form that users input
    biliography information (name of book, pages, date published, etc) into a text area. they can input multiple articles at once in the text area. is there a way to intoduce a line break on the pdf in between each article? meaning can we tell the users to input something like a % in between articles and have then some how introduce a line break on the pdf for every %?

    You can use the coldfusion replace function to replace any string with either an html break tag, or the appropriate chr functions, depending on how you are generating your line breaks.  That's the easy part.
    The first hard part is to get 100% of your users to do what you want 100% of the time.
    The second part is to figure out the difference between a  symbol, such as a percentage sign, that is supposed to indicate a line break as opposed to simply being part of the article.

  • Replace Mac line breaks with Windows linebreaks?

    Is there a simple AppleScript that could process a plain text file created on a Mac and replace the line breaks with Windows-compatible \r\n line breaks?
    I thought this would be a very simple task but have been searching for quite a while and can't find anything.
    Thanks.
    Paul

    There are several approaches to this. Here's one of them:
    set theFile to (choose file)
    set MacText to paragraphs of (read theFile)
    set {oldDelims, my text item delimiters} to {my text item delimiters, (return & linefeed)}
    set WindowsText to MacText as text
    set my text item delimiters to oldDelims
    set outputFile to (open for access theFile with write permission)
    set eof outputFile to 0
    write WindowsText to outputFile
    close access outputFile
    To explain, the first line asks you to choose the file in question - you could use any technique to identify the file, including hard-coding the path or using a drag-and-drop handler.
    The second line gets the current paragraphs and calls them 'MacText'
    The third line saves the current text item delimiters in oldDelims and sets the new text item delimiters to the CR+LF combination.
    The fourth line performs the magic of transforming the file. It does this by coercing the list of paragraphs (obtained in line 2) into a single text block, and it inserts the current text item delimiters between each text item, miraculously giving you CRLF-terminated paragraphs.
    The fifth line restores the text item delimiters to whatever they were before (you don't know what they were, but don't need to know what they were, as long as you restore the previous setting - it's unlikely you want CRLF moving forwards).
    The rest of the script (lines 6 through 9) reopen the file you originally selected, sets the EOF to 0 (effectively wiping the file contents), then writes the CRLF-terminated text to the file and finally closes the file.
    Note that some people might suggest using text item delimiters to break up the original text file on CRs but that would be wrong IMHO. The reason is that 'paragraphs of' can detect and handle both CR and CRLF-terminated paragraphs, leaving you with clean paragraphs into which you insert CRLFs.
    This means that if the file originally had CRLF-terminated paragraphs you'd end up with the same data, but at least there was no harm done.
    In contrast, if you simply searched for CRs and replaced them with CRLFs you could have the situation where you selected a CRLF-terminated file (maybe you didn't realize it was already in the Windows format) and your script would blindly replace each CR with CRLF, meaning you'd end up with CRLFLF combinations, which is very wrong.

  • PS CS4: Straight, hard lines instead of soft curves, history problems?

    Hi,
    sometimes Photoshop (Intuos 4, AMD Phenom2 X6 [email protected]) draws a hard line at full pressure instead of a soft, dynamic curve. It simply connects the starting and ending point. Painting ia 20000x14000@16GB Ram with PS using 12GB, painting size 6GB.
    I also experienced when going back history states with ctrl-alt-z the tool automatically switches to zoom, and sometimes history just jumps back to the latest state.
    Could this be a history lag? Any chance to fix this?
    Thanks!

    Before upgrading my machine and OS from Win7 to Win8 I had a similar problem, which was that the same thing happened, but there was part of that straight line missing. So there was a dot, break, and then the straight line. In between lies a new OS plus new hardware.
    So you suspect it's a Wacom bug?

  • Deleting extra forced line breaks with Find/Change

    Ladies and Gentlemen,
    I'm importing word .doc that are text-heavy and the formatting is such that there are lots of extra forced line breaks creating a blank line between paragraphs.
    To avoid manually deleting the extra forced line breaks to eliminate the blank line of space between paragraphs, what are the best steps to doing this an easier way?
    Any advice on clear steps to do it using the find/change option?
    Thanks in advance as always..
    JRH

    Are you talking about two hard returns [Enter] in a row, or a soft and hard return [Shift + Enter] and [Enter]? A forced line break is a soft return, but most Word users would just hit the return key for an empty paragraph to get an empty line.
    In either case, you can do a simple text find change, if GREP intimidates you. Use the special characters menu to enter either two "end of paragraph" or a "forced line break" and "end of paragraph" markers into the find field and a single "end of paragraph" marker into the change field.
    This is included as part of the "Find/change by list" sample script which adds some other common cleanup functions like converting two spaces to one. The advantage to using GREP is it will find any number of consecutive paragraph end markers and convert to one in a single pass, while a text search must be run multiple times to catch the heavy handed author.
    Peter

  • Clear or Override Forced Line Breaks?

    This is probably really simple, but I searched the help file and didn't find it.
    - How do you clear all forced line breaks in a paragraph?
    I'm editing text that we thought was fairly final, and I usually work in Preview mode as it's cleaner and easier to see what's going on. But I'm fearful of any forced line breaks that I may not know about that could mess up the paragraph flow after I make changes. The text is fully justified.
    I know I can work in Normal mode and turn on 'View Hidden Characters' to see them. But even with that, they can sometimes be small and hard to see depending on the complexity of the type and how zoomed-in I am.
    - Isn't there a simple key command to override forced line breaks?
    THANKS!

    OK. Thanks. I knew that would be an option, I just think I confused a couple other features with what I was hoping to do.
    I may have been confusing 'Clear Local Overrides' when updating a paragraph style, and the ability to have certain things highlighted (custom tracking/kerning, glyphs, etc.), with an ability to clear forced line breaks with a simple key-command or palette menu item.
    Thanks, though.

  • Line breaks not passing from flash to asp

    Hello,
    I've came up with a very anoying problem, and I need it fixed
    asap.
    The problem is as folows:
    I have a form in flash that contains a number of fields. One
    of those is a input field with the purpose of capturing the
    impressions of the user on a given subject. Needless to say that
    that impression may contain paragrafs, and line breaks. I'm using
    flash 7 publish settings and passing the values of the fields via
    LoadVars. The problem seems to be that no line breaks are passed to
    ASP. All the special characters are passed correctly, the HTML is
    coded as UTF-8 so that the portuguese characters are correctly
    decoded, but no line breaks are shown. I need a quick solution to
    solve this problem of the line breaks.
    Can someone give me a quick hand on this?
    Thx

    Thx kglad,
    Your solution is very simple... too bad I happened to create
    a solution on a much more complicated way... I ended up by escaping
    the string, detecting where the %0D was found, and replaced it with
    <br>. A much harder way to get to the same result... On
    future ocasions im gonna use your solution, which is way much
    simpler and doesn't require the number of coding lines that I had
    to create for the same purpose.
    Thx again m8

  • Line Breaks in JAR Manifest

    I'm currently using a maven plug-in to generate a manifest file using the java.util.jar API. When creating attributes in the manifest, the plug-in inserts line breaks in comma-separated lists automatically to make the Manifest easier to read. When the manifest is written using Manifest.write(OutputStream), line breaks are added every 72 characters despite the fact that the attribute value already contains line breaks.
    Should this be reported as a bug or is there another way to format the manifest so that the line breaks don't destroy the readability.
    From the generated manifest:
    Bundle-ClassPath: lib\spring-beans-2.0.7.jar,
    lib\commons-logging-1.
    1.jar,
    lib\log4j-1.2.14.jar,
    lib\spring-core-2.0.7.jar,
    lib\spr
    ing-context-2.0.7.jar,
    lib\spring-dao-2.0.7.jar,

    Manifest lines must not exceed 72 bytes; see
    http://java.sun.com/javase/6/docs/technotes/guides/jar/jar.html#JAR%20Manifest
    Presumably Manifest.write could try harder to break at commas. You could file an RFE if this is really important and there's not already a similar issue.
    Thanks,
    Dave

Maybe you are looking for

  • Mail not working in new mini mac

    i got new mini mac and mail not working. i get this message. You have Mail version 4.2 (1078/1084). It can't be used on Mac OS X Version 10.6.8 (Build 10K549). For more information, click the Help button. dont know what to do thanks

  • Urgent: BI reports

    hi experts, can anyone tell me what is the support activities with respect to query? its urgent. jeevs

  • AQ-Adapter (Interconnect) do not publish

    Hello, I want to use the AQ-Adapter to publish some events. I model the process in iStudio and configured the adapter. The adapter starts successfully and created a reader to my outbound_queue (which means the adapter knows my schema, could connect a

  • How to create internal links to a particular part of a page in iweb 08

    Hello, Can anyone help me create hyperlinks to a particular part of a page in iWeb 08? I've tried and tried and failed and failed! Many thanks and best, Rudy

  • Almost all iChat menu options greyed out; can't use iChat this way

    iChat was working just fine until a few days ago. Now it only shows the following menu items: iChat--> My Status, Accounts, Services, Hide iChat, Hide others, Quit iChat File--> Open, Recent items Edit--> Find, Spelling, Insert Smiley, Special Charac