Writing html file in a jeditorpane

I have read one of your threads titled as "How to insert a string in a JEditorPane (Urgent)". according to this thread I am using insertString() method to write in an jeditorpane. what I am writing is an html file. when I used insertString() method it doesn't show the html content in my jeditotpane. it displays the source code of my html file. I have setContentType("text/html"); moreover I used setText() and it shows the html file correctly but it over writes the previous content of jeditorpane. please help me to be able to
write to a jeditorpane without overwriting and displaying html file properly not its source code.
following is my code:
         fr = new FileReader("myfile.html");
     BufferedReader br = new BufferedReader(fr);
     while ((lineread = br.readLine()) != null)
          find.append(lineread);
                   do{
                         last = find.lastIndexOf("str");
                      Integer index = myJEditorPane.getSelectionEnd();
               String temp = index.toString();     
               start=find.indexOf(temp, end);
               end=find.indexOf("str", start);
                        Document doc = mynewContentPane.getDocument();
               try{
                    doc.insertString(doc.getLength(),find.substring(start, end),null);
               catch(BadLocationException exc){
                    exc.printStackTrace();
               }Edited by: nasi on May 7, 2010 8:59 PM
Edited by: nasi on May 8, 2010 12:09 AM
Edited by: nasi on May 8, 2010 1:37 AM

Welcome to the Sun forums.
Subject: writing html file in a jeditorpane
If you mean a JEditorPane then please use the correct case, so we can be confident you refer to the J2SE class, as opposed to a 3rd party jeditorpane that we neither know, nor support.
nasi wrote:
I have read one of your threads titled as "How to insert a string in a JEditorPane (Urgent)". ..I guess you mean [How to insert a string in a JEditorPane (Urgent)|http://forums.sun.com/thread.jspa?threadID=282569] from 2002. A lot has changed since 2002, but I suspect the basic way of appending text to a Document has not.
BTW - Good to see you arrive with some Google-foo. ;-)
..according to this thread I am using insertString() method to write in an jeditorpane. what I am writing is an html file. when I used insertString() method it doesn't show the html content in my jeditotpane. it displays the source code of my html file. I have setContentType("text/html"); moreover I used setText() and it shows the html file correctly but it over writes the previous content of jeditorpane. I've not played much with changing existing documents, but try this source (adapted from code nabbed from the thread you mentioned).
import javax.swing.text.*;
import javax.swing.*;
public class InsertStringTest {
    public static void main(String[] args){
        Runnable r = new Runnable() {
            public void run() {
                //set GUI
                JFrame f = new JFrame();
                f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                JEditorPane editorPane = new JEditorPane();
                editorPane.setContentType("text/html");
                editorPane.setText("<html><body><h1>Test!</h1><p>");
                f.getContentPane().add(new JScrollPane(editorPane));
                String testStr = "This is a test string. " +
                    "This is a test string. This is a test string. \n";
                f.pack();
                f.setSize(400,300);
                f.setVisible(true);
                //test with insertString()
                long diff;
                long startTime = System.currentTimeMillis();
                Document doc = editorPane.getDocument();
                for(int i=0; i < 500; i++){
                    try{
                        doc.insertString(doc.getLength(),testStr,null);
                    catch(BadLocationException exc){
                        exc.printStackTrace();
                diff = System.currentTimeMillis() - startTime;
                System.out.println("Time spent with doc.insertString() : " + diff);
                editorPane.setCaretPosition(0);
        SwingUtilities.invokeLater(r);
}

Similar Messages

  • Html files, images and JEditorPane

    Hello all,
    I've got some HTML file that need be displayed in a JEditorPane. Those HTMLs contain image references and I'm using relative paths to those jpegs, for example:
    <img src="image.GIF">
    ...where image.gif is in the same folder as the HTML file that contains the reference. Now I'm displaying this HTML file inside a JEditorPane and I get only a placeholder instead of the image; only text gets displayed properly.
    Here's how I'm constructing the JEditorPane instance:
              pane = new JEditorPane();
              pane.setEditable(false);
              pane.setContentType("text/html");
              HTMLEditorKit kit = new HTMLEditorKit();
              kit.createDefaultDocument();
              pane.setEditorKit(kit);and later...
          try {
              URL u = new URL("file", "localhost", ivHelpPath);
              pane.setPage(u);
            } catch (IOException iox) {
            }I saw on some other thread that I should be setting the document's base URL for the reference I get from getDocument(), but that does not seem to work when I use "http://localhost/" to make my URL object.
    So... help! :)
    Thanks much.

    Not sure what you're trying to do with new URL( "file" "localhost", ...
    Try this code and see if it helps you - display a page that already exists though - perhaps that's the diff?
        JTextPane() jtp = new JTextPane(); //JEditorPane();
        jtp.setEditable( false );
        JScrollPane jsp = new JScrollPane( jtp,
                                     JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                                     JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED );
        ( ( HTMLEditorKit ) ( jtp.getEditorKit() ) ).setLinkCursor( new Cursor( Cursor.HAND_CURSOR ) );
        jtp.addHyperlinkListener( new HyperlinkListener() {
          public void hyperlinkUpdate( HyperlinkEvent hle ) {
            try {
              if ( hle.getEventType() == HyperlinkEvent.EventType.ACTIVATED )
                jtp.setPage( hle.getURL() );
            } catch( Exception e ) {
              // do something;
        });... There's also code here that will activate hyperlinks which you may or may not want. But this will display embedded .gif files.

  • Viewing PDF or CHM (compiled HTML) files in a JEditorPane (Editorkit av.?)

    I want to view PDF or CHM files in a JEditorPane, for example for use in JavaHelp. Does anybody know if there is a free EditorKit available for viewing at least one of these two kinds of files (especially for PDF), or if it is possible to "plug" the Adobe Acrobat reader into a JEditorPane???

    a usuful url, but I'am afraid this is not the answer for the question :)
    as far as I know, either Sun or other third vendor does not provide the toolkit for PDF
    or CHM viewing in JEditorPane.

  • Help writing HTML formatted data to JEditorPane multiple times

    I have problems writing data to a JEditorPane more than once. The first time, it works, but the 2nd, 3rd, and so on, the data that is displayed is corrupt. This is where I print the data:
                   ResultsDisplay.getEditorKit().createDefaultDocument();
                   ResultsDisplay.setText(inputStore.toString());There seems to be something wrong with the way I display the data. What do I have to do to change HTML formated data that is printed to an JEditorPane?
    This is how I set up the JEditorPane:
         javax.swing.JEditorPane ResultsDisplay = new javax.swing.JEditorPane();
         JScrollPane ResultsDisplayScrollPlane = new JScrollPane(ResultsDisplay);
         HTMLEditorKit htmlEdKit = new HTMLEditorKit();and
              ResultsDisplay.setEditable(false);
              ResultsDisplay.setEditorKit(htmlEdKit);
              ResultsDisplay.setContentType("text/html");
              ResultsDisplay.setEditorKitForContentType("text/html", htmlEdKit);
              getContentPane().add(ResultsDisplayScrollPlane);
              ResultsDisplayScrollPlane.setBounds(50,50,700,450);Am I doing anything wrong here? Why can I only write the data once during the Applet's run life?

    Hi again,
    Does anyone have experience writing to a JEditorPane multiple times during the run-life of a Applet? When I first send the data, it is displayed correctly. But everytime after that, the data is corrupted. My data is written in tables (in HTML format). The second time I write to the JEditorPane, it only displays the first of my tables, and only displays the collumn names and in the last column it displays the first row of data squeezed into the last column name's cell. If I run a third time, it takes this old table and adds a new table from the third run. With the fourth run I end up with 3 tables each containing only one row with the column names and the 1st row of data squeezed into the last collumn name cell.
    Can anyone help? I've already tried creating a new document as described in the JEditorPane's API.

  • HTML file is not being shown properly in the JEditorPane

    Hi,
    I am using JEditorPane to display an HTML file from the local disk. This HTML file contains the html tables. Now when this file is getting displayed in the JEditorPane, one top row grid is not being displayed in the editor pane. content of the row is there...but the column grid is missing. All other rows and columns are being shown but the first row-column grid which contains the heading for column.
    Also when I m printing the content of this JEditorPane using Java Print API then no grid is being printed on the paper. content is coming properly but no table grids. when i have taken the print out of the original html file from the browser then table grids are being printed out properly.
    Please do help me out in showing the HTML file in the JEditorPane properly and printing the same.
    Many Thanks,
    gshankar

    Hi,
    JEditorPane renders HTML with many limitations.
    You can use JDIC for the same. refer: jdic.dev.java.net
    But JDIC does not work on windows 98.
    Anand

  • How to put an HTML file into JEditorPane

    Hi
    I am doing an aplication on swing.But I don't know how to add a html file to the JeditorPane keeping the html file on the source code. i.e my html file is in my source code.Then how to add this source code to Jeditor pane.
    Thanks
    Srikant

    hi srikkant,
    ur html code is inside the source code..? are you working on applets..? if ur html file can be read as a file and the file stream can converted to a string and put into a Jeditor pane using the setText() method. for editing HTML text a editor called javax.swing.text.html.HTMLEditorKit can be used.
    Refer to JAVA API for further clarifiactions and examples.

  • How to add a html file into JEditorPane

    Hi
    I am doing an aplication on swing.But I don't know how to add a html file to the JeditorPane keeping the html file on the source code. i.e my html file is in my source code.Then how to add this html file to Jeditor pane.
    Thanks
    Srikant

    QuickTime requires player and plugins that most people don't have.  You'll reach a much wider audience if you use HTML5 <video> with mp4, webm and ogg files.
    <!doctype html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>HTML5 with Video</title>
    <!--help for older IE browsers-->
    <!--[if lt IE 9]>
    <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    </head>
    <style>
    video {
        max-width:100%;
        display:block;
        margin:0 auto;
    </style>
    <body>
    <h2>Use 3 File Types to support all browsers &amp; mobile devices:  MP4, WEBM and OGV.</h2>
    <h3>Online Video Converter
    http://video.online-convert.com/</h3>
    <!--begin video-->
    <video controls poster="Your_poster_image.jpg">
    <!--these are 6 sec sample videos for testing purposes. Replace sample-videos with your own files-->
    <source src="http://techslides.com/demos/sample-videos/small.webm" type="video/webm">
    <source src="http://techslides.com/demos/sample-videos/small.ogv" type="video/ogg">
    <source src="http://techslides.com/demos/sample-videos/small.mp4" type="video/mp4">
    If you're seeing this, you're using an
    outdated browser that doesn't support
    the video tag. </video>
    <!--end video-->
    </body>
    </html>
    Nancy O.

  • JEditorPane.... HTML file

    Please Help...
    I have been trying to add an HTML file to my JEditorPane
    using the setPage(URL/String) methods, I have had no luck,
    it throws some "unknown protocol: c" i understand that it
    is expecting a protocol like http:, the likes, but how do
    I bypass this as I want it do display an html file which
    is on my local drive... I do not want to use setText(String)
    setting my HTML tags in string...
    Thanks in advance
    Kaneval

    Create a file object for you local html file. Convert
    this file to a URL object.
    File htmlFile=new File(fileName);
    URL myhtmlUrl=htmlFile.toURL();
    Then you can use this URL object to display the html
    page.
    Thanks a lot
    Kaneval

  • Xml to JTree, and JTree node to html file.

    I have been trying to figure out a way to do this and I think I have a solution, but I am not sure how to structure the application and methods.
    working with BorderLayout Panel p, JSplitPane split, JTree tree, and JEditorPane rpane
    1st. My JSplitpane is divided with the tree, and rpane. The tree is on the left, and the rpane is on the right. both of these are then added to the Panel p
    2. I will create a method that will read through a modules.xml file, and create a JTree - tree. When you click on the node element it's information is displayed in the right pane - rpane.
    The Problem. I think it would take to long to create the html file on the fly each when I click on each individual node.
    So my idea is to create the html files from many xml files when I run the program. I can then just load the html file when I click on each individual node.
    This means alot of heavy processing in the front end, and everything will be static, but it will be faster when the user is in the program.
    Problem. How do I associate each node element with the correct html file?
    The Tree elements are always the same, but I can have 1 or many modules.
    Here is an example:
    <device>  // - root
       <module1>
          <Status>
             <Network></Network>
             <Device></Device>
             <Chassis></Chassis>
             <Resources></Resources>
          </Status>
          <ProjMngt></ProjMngt>
          <ProjEdit></ProjEdit>
          <Admin>
             <admNetwork></admNetwork>
             <admUsers></admUsers>
          </Admin>
          <Logging></Logging>
       </Module1>
       ...  Now I can have 1 or many Modules depending on what the xml file  has in it.
       <Module*n>
    </device>Other problems. Some of the information I want to store as a sortable Table, but I cannot seem to get any of the sort methods to work. They work if I just open a browser, and run the html file, but if I stick the html file into the JEditorPane it does not work? - any suggestions?
    Also, can I pass a JTabbebPane to the JEditorPane, or can I create a tabbed pane in html that will do the same thing.
    I am working with a very small device. It does not have a web application container like Tomcat on it. Just Apache, and Java. That is why I am using Swing.

    Using 'productAttribute/text()' gets you all three productAttribute nodes and then grabs all the text under that node. It simply concatenates together all the text under the desired node, hence the results you are seeing. If you want to get the text for each child node separately, then you need to do something like (assumes 10.2.x.x or greater)
    WITH your_table AS (SELECT
    '<root><productAttribute>
    <name>Baiying_attr_03</name>
    <required>false</required>
    </productAttribute>
    <productAttribute>
    <name>Baiying_attr_04</name>
    <required>false</required>
    </productAttribute>
    <productAttribute>
    <name>Baiying_attr_05</name>
    <required>false</required>
    </productAttribute></root>' xmldata
    FROM DUAL)
    -- Above simulates your DB table as I don't have it
    -- You only care about the following
    SELECT xt.*
      FROM your_table yt,
           XMLTable('/root/productAttribute'
                    PASSING XMLTYPE(yt.xmldata)
                    COLUMNS
                    prd_nm   VARCHAR2(30)  PATH 'name',
                    prod_rqd VARCHAR2(5)   PATH 'required') xt;Note: I added a <root> node as you had just provided a XML fragment. You will need to adjust accordingly.
    The above produces
    PRD_NM                         PROD_RQD
    Baiying_attr_03                false
    Baiying_attr_04                false
    Baiying_attr_05                false

  • Regarding displaying html page in a JEditorPane

    i want to display a html page in a JEditorPane but the problem is it is displying the page but the script part of html page is printed as it is in the pane . please tell the solution for it . i will be highly thankful to u.

    What you are doing exactly? you are displaying the html file into a JEditorPane or After displaying you are tring to Print it out in the Paper or what.
    If this the First Sinario then this code will help you.
    import javax.swing.*;
    import java.awt.*;
    import java.net.URL;
    import java.net.MalformedURLException;
    import java.io.*;
    import javax.swing.text.*;
    import javax.swing.event.*;
    public class Htmlexample extends JInternalFrame {
         //Constructor of Class.
         public Htmlexample () {
              //super(Title, Resizable, Closable, Maximizable, Iconifiable)
              super (title, true, true, true, true);
              setSize (500, 350);
              HtmlPane html = new HtmlPane ("Help/Keys.htm");     
              setContentPane (html);                    
              setVisible (true);
    //Following Class Show HTML Help inside an EditorPane.
    class HtmlPane extends JScrollPane implements HyperlinkListener {
         JEditorPane html;
         public HtmlPane (String filename) {
              try {
                   File f = new File (filename);          
                   String s = f.getAbsolutePath();          
                   s = "file:" + s;
                   URL url = new URL (s);               
                   html = new JEditorPane (s);          
                   html.setEditable (false);          
                   html.addHyperlinkListener (this);
                   JViewport vp = getViewport();     
                   vp.add (html);                    
              catch (MalformedURLException e) { }
              catch (IOException e) {     }
         //Function Perform By the HyperLinks of HTML Help File.
         public void hyperlinkUpdate (HyperlinkEvent e) {
              if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
                   linkActivated (e.getURL());
         //Function for Loading other HTML Pages in Your HTML Help.
         protected void linkActivated (URL u) {
              Cursor c = html.getCursor();
              Cursor waitCursor = Cursor.getPredefinedCursor (Cursor.WAIT_CURSOR);
              html.setCursor (waitCursor);
              SwingUtilities.invokeLater (new PageLoader (u, c));
         //Following Class Load Other Pages Included in Our HTML Help File.
         class PageLoader implements Runnable {
              //Constructor of Class.
              PageLoader (URL u, Cursor c) {
                   url = u;
                   cursor = c;
              public void run () {
                   if (url == null) {
                        html.setCursor (cursor);
                        Container parent = html.getParent();
                        parent.repaint();
                   else {
                        Document doc = html.getDocument();
                        try {
                             html.setPage (url);
                        catch (IOException ioe) {
                             html.setDocument (doc);
                             getToolkit().beep();
                        finally {
                             url = null;
                             SwingUtilities.invokeLater (this);
              URL url;
              Cursor cursor;
    }if there is any other issue Let me Know
    Thank you
    Jofin

  • Print HTML file inside JEditorPane

    Hi Guys,
    I'm trying to print the contents of a JEditorPane - actually, a html file that I read and display in that component from the underlying file system. I've had the class that manages the JEditorPane implement Printable - the following is my print() implementation:
    public int print(Graphics graphics, PageFormat pageFormat, int pageIndex)
              throws PrinterException {
              if (pageIndex > 0) {
                   return (NO_SUCH_PAGE);
              } else {
                   Graphics2D g2d = (Graphics2D) graphics;
                   g2d.translate(
                        pageFormat.getImageableX(),
                        pageFormat.getImageableY());
                   ivTextArea.paint(g2d);
                   return (PAGE_EXISTS);
    }I've got another method that gets called when a print button is clicked:
    class .... {
      PrintJob pj;
      PageFormat pf;
    private void printMe() {
               if (pj == null) {
                   pj = PrinterJob.getPrinterJob();
                   pf = pj.defaultPage();
                   pf.setOrientation(PageFormat.PORTRAIT);
              pf = pj.pageDialog(pf);
              pj.setPrintable(this, pf);
              try {
                   pj.print();
              } catch (PrinterException e) {
                   throw new RuntimeException(e);
    }Clearly I'm doing smth wrong, since only a single page gets printed and moreover the formatting is awful [text gets cut instead of moving on the next line]. Can someone help?
    Thanks much!

              if (pageIndex > 0) {
                   return (NO_SUCH_PAGE);This is why you only get a single page.
    page gets printed and moreover the formatting is
    awful [text gets cut instead of moving on the next
    line]. Can someone help?Yeah. Your best bet is either to put the editorpane in a scrollpane and just print what's visible, OR, you can take the print graphics object, convert it into a graphics2D object, and call scale on that by comparing component.getWidth/height to PageFormat.getImageableWidth/Height
    I'm attaching my StandardPrint class. It uses the pageable interface to carry the number of pages + page format as well. I'm not sure if I did the scaling here or not, but I've done it before so I know it works :-) Also, I've got methods for previewing the print, which can save a lot of paper.
    Please feel free to have and use this class, but please do not change the package or portray this as your own work
    =============================
    package tjacobs.print;
    import java.awt.*;
    import java.awt.image.BufferedImage;
    import java.awt.print.*;
    import javax.print.PrintException;
    public class StandardPrint implements Printable, Pageable {
        Component c;
        SpecialPrint sp;
        PageFormat mFormat;
        public StandardPrint(Component c) {
            this.c = c;
            if (c instanceof SpecialPrint) {
                sp = (SpecialPrint)c;
        public StandardPrint(SpecialPrint sp) {
            this.sp = sp;
        public void start() throws PrinterException {
            PrinterJob job = PrinterJob.getPrinterJob();
            if (mFormat == null) {
                mFormat = job.defaultPage();
            job.setPageable(this);
            if (job.printDialog()) {
                job.print();
        public void setPageFormat (PageFormat pf) {
            mFormat = pf;
        public void printStandardComponent (Pageable p) throws PrinterException {
            PrinterJob job = PrinterJob.getPrinterJob();
            job.setPageable(p);
            job.print();
        private Dimension getJobSize() {
            if (sp != null) {
                return sp.getPrintSize();
            else {
                return c.getSize();
        public static Image preview (int width, int height, Printable sp, PageFormat pf, int pageNo) {
            BufferedImage im = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
            return preview (im, sp, pf, pageNo);
        public static Image preview (Image im, Printable sp, PageFormat pf, int pageNo) {
            Graphics2D g = (Graphics2D) im.getGraphics();
    //        PageFormat pf = sp.getPageFormat(pageNo);
    //        int width = im.getWidth(null);
    //        int height = im.getHeight(null);
    //        g.setColor(Color.WHITE);
    //        g.fillRect(0, 0, width, height);
    //        double hratio = height / pf.getHeight();
    //        double wratio = width / pf.getWidth();
    //        g.scale(hratio, wratio);
            try {
                   sp.print(g, pf, pageNo);
              catch(PrinterException pe) {
                   pe.printStackTrace();
            g.dispose();
            return im;
        public int print(Graphics gr, PageFormat format, int pageNo) {
            mFormat = format;
            Graphics2D g = (Graphics2D) gr;
            g.translate((int)format.getImageableX(), (int)format.getImageableY());
            Dimension size = getJobSize();
            if (pageNo > getNumberOfPages()) {
                return Printable.NO_SUCH_PAGE;
            int horizontal = getNumHorizontalPages();
            int vertical = getNumVerticalPages();
            int horizontalOffset = (int) ((pageNo % horizontal) * format.getImageableWidth());
            int verticalOffset = (int) ((pageNo / vertical) * format.getImageableHeight());
            double ratio = getScreenRatio();
            g.scale(1 / ratio, 1 / ratio);
            g.translate(-horizontal, -vertical);
            if (sp != null) {
                sp.printerPaint(g);
            else {
                c.paint(g);
            g.translate(horizontal, vertical);
            g.scale(ratio, ratio);
            g.translate((int)-format.getImageableX(), (int)-format.getImageableY());
            return Printable.PAGE_EXISTS;
        public int getNumHorizontalPages() {
            Dimension size = getJobSize();
            int imWidth = (int)mFormat.getImageableWidth();
            int pWidth = 1 + (int)(size.width / getScreenRatio() / imWidth) - (imWidth == size.width ? 1 : 0);
            return pWidth;
        private double getScreenRatio () {
            double res = Toolkit.getDefaultToolkit().getScreenResolution();
            double ratio = res / 72.0;
            return ratio;
        public int getNumVerticalPages() {
            Dimension size = getJobSize();
            int imHeight = (int)mFormat.getImageableHeight();
            int pHeight = (int) (1 + (size.height / getScreenRatio() / imHeight)) - (imHeight == size.height ? 1 : 0);
            return pHeight;
        public int getNumberOfPages() {
            return getNumHorizontalPages() * getNumVerticalPages();
        public Printable getPrintable(int i) {
            return this;
        public PageFormat getPageFormat(int page) {
            if (mFormat == null) {
                PrinterJob job = PrinterJob.getPrinterJob();
                mFormat = job.defaultPage();
            return mFormat;
    }>
    Thanks much!

  • Reading in HTML file then writing to file - losing formatting.

    I am reading in a HTML file using a Buffered Reader then writing it to a file. However when i write it to a file using
    out = new PrintWriter(new BufferedWriter(new FileWriter(path, true)));
    out.write(content);
    out.flush();
    i seem to lose all carriage returns and find that the whole html is on one single line with the only noticable formatting being the spaces between the html tags.
    How can i stop it losing carriage returns?

    You only showed the part where you are writing it out.
    Does your reader code look like this:
      BufferedReader r = ...
      String content = "";
      while (true) {
        String line = r.readLine();
        if (line == null) break;
        content += line;
      }If it does, the problem lies here, as doing a readLine removes the line terminator. Soooo....
        content += line + "\n";Of course, to be most efficient and good, don't use String concatenation, use a StringBuffer (though it should be noted that when I decompiled this test code, suns compiler did indeed use a StringBuffer).
    When you print, use the PrintWriter methods print and priintln as they don't throw exceptions.

  • Writing HTML data in TEXT File

    I am writing HTML content in TEXT file ...I read it in a string and then write using PrintStream...
    But it writes all content on one line ..I want to write it as it was in source HTML file...

    Perchance, the OP is referring to the lack of carriage returns in his outputted data, and querying where they have absconded to? An analysis of his posts to date reveals that he has read the contents of a File into a String variable, and wants to write the (presumably modified) String back to a file (uncertain as to whether this is the same file or a different one) In the process of outputting to said file, carriage returns previously contained in the original input file are not present in the output. I would hazard a guess that the OP does not want said carriage returns in the String to disappear.
    Is my analysis of the situation correct?
    An example of the code that you have written to date would be of extreme usefulness to us in aiding you in your noble quest.
    Without such a resource, I must rely on my intuition instead.
    Possible places that the carriage returns are being "dropped"
    1 - On reading in. Are you discarding carriage returns while building up your variable?
    2 - On manipulating. Are you processing this line by line, or reading it all into one large variable?
    3 - On output - are you using "print" or "println" in the output?
    I look forward to further correspondence with you sir
    kind regards,
    evnafets

  • In JEditorPane the links in HTML file are not working

    hi,
    I am using JEditorPane to dispaly HTML file.
    In the html files there are some links to some other pages.
    The JEditorPane is showing the links but it didn't work when i click.
    Is there any Events which i have to add?

    Try posting in the Mac Number forum.
    https://discussions.apple.com/community/iwork/numbers
    Also, specify the version of Numbers you are using.

  • JEditorPane - How to display XML Linked HTML File in JEditorPane ?

    Dear Friends,
    I have a HTML File consisting of stylesheet, xml linked (for data) and with headers, footers...
    When i called a ordinary html file using setpage property of JEditorpane..it's working no problem...but when i call the html file having xml linked or buttons...it's not properly displayed....
    If anybody hits this problem....pls...help me....
    Regards,
    V.Prasanna

    If you only need to display it, consider your HttpServletRequest just as byte stream. :) Just read from ServletInputStream and write it back into ServletOutputStream of HttpServletResponse.
    If you want to process incoming XML, please give some details first, what exactly you want to do. :)

Maybe you are looking for

  • Timing of text box will not appear.  My text boxes stop working on slide 5 and they will not work for the remainder of the slide show.

    Timing of text box not working.  I get the first few slides to work and then on slide 5 my text boxes will not appear.  And they do not appear for the rest of the slide show.   Help anyone.

  • Error in DMS server

    Dear all   Hi i am using  DMS server   When i am trying to upload a photo whr i am getting this error   ERROR: A2 REPOSITRY IS NOT CONNECTING TO HTTP SERVER.                   Can any one tell me the basic configuration which i need to do in server.

  • LR not showing all images on card during Import

    I have the latest version of LR.  iMac and Canon 7D.  With my camera tethered directly to my computer, I start the Import Photos process.  When the thumbnails begin to load, it seems like if I have a large amount of photos to import (from 8GB card),

  • Does BAM works with only Oracle database at the backend.

    Hi, I was wondering if Oracle Bussiness Activity Monitor(BAM) implemented within ADF application works with Oracle database as Oracle database is one of the very few databases supporting Database Change Notification? Or can it be implemented using My

  • 10.4.4 crash and FileVault - Help!

    Hi there, really hope someone can help with this, I'm desperate! My iBook G4 went down, like many, after the 10.4.4 update. I get stuck on the grey apple booting screen. However I discovered i can still FTP in or SSH into a Darwin prompt from my PC o