JTextArea will not display string with carriage return

Hello,
I am trying to display an XML file which i have converted into a string in a JTextArea to no avail. Any ideas how i can display the string in the JTextArea including the carriage return such that it still displays in the correct format?
Your pointers and suggestions will be much appreciated.

Antananarivo wrote:
Hello,
I am trying to display an XML file which i have converted into a string in a JTextArea to no avail. Any ideas how i can display the string in the JTextArea including the carriage return such that it still displays in the correct format?
Your pointers and suggestions will be much appreciated.You haven't done the conversion properly.
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.WindowConstants;
public class XMLTextArea {
    public static void main(String[] args) throws IOException {
        File f = new File("someFile.xml");
        BufferedReader br = new BufferedReader(new FileReader(f));
        StringBuilder sb = new StringBuilder();
        String nextLine = "";
        while((nextLine = br.readLine()) != null) {
            sb.append(nextLine).append("\n");
        JFrame frame = new JFrame();
        frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        frame.add(new JScrollPane(new JTextArea(sb.toString())));
        frame.setSize(400,300);
        frame.setVisible(true);
}

Similar Messages

  • Mail will not display images with .jpeg extension. .jpg works fine. (displays in place when opening the email. What plug-in would correct this?

    Mail will not display images with .jpeg extension. .jpg works fine. (displays in place when opening the email. What plug-in would correct this?

    If you think you're insane now, try maintaining those pop up menus.
    As far as I know, these menus have not been updated since FW 8, so 
    they are at least two versions old.
    Save yourself a lot of grief by avoiding those menus. There are many 
    other products on the market which do a much better job of creating 
    and maintaining this type of navigation structure.
    Read this link before you climb any higher on this slippery slope:
    http://apptools.com/rants/jsmenu.php
    There was another blog post by the fellow who originally wrote the pop 
    up menu feature, but I can't seem to locate it. Even he says stay away 
    from them.
    Not the answer you probably want, but I hope it helps, nonetheless.
    Jim Babbage

  • Page will not display properly with inline Frames

    I have a html page that will not display properly in Dreamweaver. I have a basic understanding of html and want to be able to edit a website in Dreamweaver that was given to me. It looks fine in a browser, but in Dreamweaver some of the content is missing and displays the following message, "Your browser does not support inline frames or is currently configured not to display inline Frames". I was able to open it without any problems using Microsoft Front Page, so is it possible to view and edit it in Dreamweaver?

    Without seeing your page, I'm guessing that your page contains server-side includes, iframes and  scripts to other files on the server that populate page with content on the server's end.  You can't see it in DW because you don't have all the files in your DW local site folder.  You said this views fine in FP.  Was your page created in FP with FP proprietary tools?
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists
    www.alt-web.com/
    www.twitter.com/altweb

  • Mail will not display, screen returns to home screen when I try.

    MMail will not display or load up.  When I enter the mail icon it instantly returns to the home screen.  Therefor mail will not display or show.

    The Mail App is crashing on you. You might have a corrupt email, a spam email or an email with a very large attachment that is causing the crash. It could also be a corrupt setting. It's difficult to know that it could be. If you have a computer, log into your email account in a web browser and look for any problematic emails and try deleting them there.
    Try closing the mail app completely on the iPad, reset the device and then try mail again.
    In order to close apps, you have to drag the app up from the multitasking display. Double tap the home button and you will see apps lined up going left to right across the screen. Swipe to get to the app that you want to close and then swipe "up" on the app preview thumbnail to close it.
    Next, reset the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider if it appears on the screen - let go of the buttons. Let the iPad start up.

  • My edited photos will not display when clicked on, a large triangle with exclmation comes up

    my edited photos will not display when clicked on, instead a large grey area comes up wiht a triangle /exclamation sign. 

    Try these in order - from best option on down...
    1. Do you have an up-to-date back up? If so, try copy the library6.iphoto file from the back up to the iPhoto Library (Right Click -> Show Package Contents) allowing it to overwrite the damaged file.
    2. Download <a href="http://www.fatcatsoftware.com/iplm/"><b><u>iPhoto Library Manager</b></u></a> and use its rebuild function. This will create a new library based on data in the albumdata.xml file. Not everything will be brought over - no slideshows, books or calendars, for instance - but it should get all your albums and keywords back.
    Because this process creates an entirely new library and leaves your old one untouched, it is non-destructive, and if you're not happy with the results you can simply return to your old one.
    3. If neither of these work then you'll need to create and populate a new library.
    To create and populate a new *iPhoto 08* library:
    Note this will give you a working library with the same Events and pictures as before, however, you will lose your albums, keywords, modified versions, books, calendars etc.
    In the iPhoto Preferences -> Events Uncheck the box at 'Imported Items from the Finder'
    Move the iPhoto Library to the desktop
    Launch iPhoto. It will ask if you wish to create a new Library. Say Yes.
    Go into the iPhoto Library (Right Click -> Show Package Contents) on your desktop and find the Originals folder. From the Originals folder drag the individual Event Folders to the iPhoto Window and it will recreate them in the new library.
    When you're sure all is well you can delete the iPhoto Library on your desktop.
    In the future, in addition to your usual back up routine, you might like to make a copy of the library6.iPhoto file whenever you have made changes to the library as protection against database corruption. 

  • Firefox will not display on the screen even though with Process Explorer I see Firefox.exe active but no CPU usage

    I use Firefox v10.0.2 as default browser on Dell XPS8300 e/w Intel Core i5 & Windows 7 Ultimate and Compaq Presario CQ57 e/w Intel Core i3 & Windows 7 Home. More frequently on the (about 90% of attempts) than the Dell (50% of attempts) Firefox will not display to the screen when I click on icon. When it happens I cannot display other programs. I specifically say display because I believe Firefox has started. To circumvent the problem I installed Process Explorer on both machines and start this program first then click on Firefox icon. When problem occurs I can see Firefox.exe process in Process list; some CPU consumed but, then, no CPU activity. If I click on Firefox icon again another process opens in Process list but with same response - some CPU consumed and then no CPU activity. If I have 2 processes running and kill the 1st process, the 2nd will display and everything from then on is normal. If I do not open a 2nd process but kill the 1st process then click on Firefox icon Firefox is displayed and everything from then on is normal. This problem has occurred since original installation on both new machines. I've updated video drivers in both machines.

    Ok, let's see if we can fix this and get it working for you!
    First, if you start Firefox in [[safe mode|safe mode]] (restart your computer first, then when you open Firefox, hold down the shift key) does it start up more reliably? This is usually caused by a faulty add-on. If it does help, then restart Firefox, go into the Firefox button, then add-ons, and disable your extensions one by one until you find the trouble maker.
    Also, try updating to Firefox 11, it has several bug fixes that might make life easier here.
    Just as a few basic troubleshooting steps to make sure we have all the bases covered,
    Run all Windows Updates, install all needed service packs, etc.
    Update all your plugins (Flash, Java, etc.): [http://www.mozilla.org/plugincheck/ http://www.mozilla.org/plugincheck/].
    Download and Install MalwareBytes Anti-Malware, run a full Scan. [http://www.malwarebytes.org/ http://www.malwarebytes.org/]. This helps check that there are no viruses on your computer causing issues. you can uninstall this program after you clean off any infections.

  • Emoticons Will not display with new version

    Downloaded the new version, and now the (finger) and (wtf) emoticons will not display. Every single other one does display. Why is this happening? I have tried restarting my computer,  and redownloading Skype itself. Is there any way to fix this? I know I have the emoticons display on because every one BUT those ones work. 
    Attachments:
    Capture1.JPG ‏16 KB

    These hidden emoticons indeed got removed with 6.14 because of them or their shortcodes having the potential to offend some users. Here's some feedback from users wanting it back, so feel free to show your support there if you are passioante about them: http://community.skype.com/t5/Windows-desktop-clie​nt-Ideas/Restore-6-13-set-of-emotes/idi-p/2958795
    Follow the latest Skype Community News
    ↓ Did my reply answer your question? Accept it as a solution to help others, Thanks. ↓

  • Adobe Premiere Elements 13, will not display video picture, audio only. My video format is listed as compatible with Adobe.

    Adobe Premiere Elements 13, will not display video picture, audio only. My videois listed as compatible with Adobe.

    douglass
    On what computer operating system is your Premiere Elements 13 running? Have you updated 13 to 13.1 yet using an opened project's Help Menu/Updates?
    If not, please do so.
    You have not given us enough information with which to help you.
    What are the properties of your source file that is presenting in the project with audio but no video?
    Quickest way to gain that information is from brand/model/settings of the camera that recorded the video.
    I am looking for
    video compression
    audio compression
    frame size
    frame rate
    interlaced or progressive
    file extension
    pixel aspect ratio
    What does the file's thumbnail look like in Project Assets after it is imported....thumbnail with no image (gray), thumbnail with only an audio icon
    within it, or other? On the Timeline, what do you see represented in Video 1....nothing as opposed to Audio 1 where you see the audio portion of
    the file?
    Do you have the latest version of QuickTime installed on your computer along with Premiere Elements 13/13.1? Are you running the programs as
    administrator?
    Is your video card/graphics card driver version up to date according to the web site of the manufacturer of the card?
    Let us start here. Based on your reply details, we will customize troubleshooting strategy for you.
    Thanks.
    ATR

  • Imac 27" Intel Core 7 CPU. Screen goes black and will not respond except with a push of power button. Second monitor connected via displayport continues to display fine. Apply Store did full hardware scan and all is fine. Did clean wipe from Mavrick back

    Imac 27" Intel Core7  CPU 16 Gig RAM. Screen goes black and will not respond except with a push of power button. Second monitor connected via displayport continues to display fine. Apply Store did full hardware diagnostic and all is fine. Did clean wipe from Mavrick back to Mountain Lion but problem remains. Apple Store can do no more.

    I did some more digging, it appears to be a backlight problem only. I can see the screen very dimly if I use a bright flashlight in a very dark room. It also seems to run ok if the brightness is turned down a LOT.
    So I'm thinking this is a LED driver board issue or the display itself. I'll open it up and check the connection between the two and see if I can get any more clues. At least I can use it somewhat now by dimming the display significantly...

  • HT1430 my iphone 4 has suddenly ceased to work with a full battery and switch will not display slider.  How can I reactivate it?

    My iphone 4 has suddenly ceased to operate with a full battery and switch will not display slider.  How can I reactivate it? Is the memory gone? Will T Mobile replace the memory or the phone if necessary?

    Hello,
    If you're in a country where there's an apple shop (unfortunately not mine), go check it and ask the employee about it: he's gonna check your Iphone on a "device"
    I've got an iphone 5 and it's working very well with me but I have to admit that its battery lasts (slower) than my Ipad 2.
    Still i can help with some tips that may improve your iohone's battery by an hour in addition (hopefully):
    - close all apps by multitasking....
    - do NOT keep the brightness to the max
    Believe me you're gonna regret changing your phone to a samsung
    Hope i've helped and sorry for my bad english (has english as 3rd language)

  • JPG files copied to Philips Picopix 3410 are currupted with a prefix of ._ and will not display on the PicoPix

    JPG files copied to Philips Picopix 3410 are currupted with a prefix of ._ and will not display on the PicoPix. Help please?

    There are a couple of ways to remove these items from the drive.
    One is with the $15 shareware app, BlueHarvest. It will remove the AppleDouble files from the drives you want the ._ files removed from, and has an option to prevent them from being written to non Apple formatted drives in the first place.
    But the free and pretty easy way to do it is to use Terminal. From what I can see in the manual for your projector, you can only get images to it on either an SD card or a USB flash drive. So I'm going to assume a USB drive for the following.
    Plug in your MS-DOS formatted drive so it appears on the Mac desktop. Open Terminal and enter:
    dot_clean -m
    Enter a space after the -m . Then drag and drop the icon of your flash drive into the Terminal window. It will fill in the path of the drive. Press Enter. All ._ files will be removed from that volume.
    Actually, I think it removes all files that start with a period. None of which are of any great importance on a DOS formatted drive. Such as the hidden trash for that drive. The next time you plug the drive in, OS X will simply recreate it.

  • Receiver File channel for XML files: with carriage return

    Hi all,
    we are using a receiver FILE channel to generate an XML file that is sent to an external partner.
    The XML file looks good in a parser (IExplorer). But in fact there are not carriage return / line feeds between the XML tags
    of the XML payload in the file.
    Our partner now requires the XML file in a more vertical structure which means: for every tag a separate line (like it is displayed in a parser)
    Does anybody know a more general way to convert to a vertical XML structure (so with carriage return line feed).
    There is one entry in the SDN dealing with this topic but suggesting using an UDF. I think this is a very specific way.
    I don't think it is a good way to change/enhance the message mapping just because of a general formating change.
    Is it better to use an XSLT mapping as a second step in the interface mapping or a JAVA adapter module to convert ?
    any experiences? suggestions? examples?
    Thank you very much
    best regards
    Hans
    examples:
    original by XI receiver FILE adapter
    <?xml version="1.0" encoding="UTF-8"?>
    <MT_batchStatus><type>BS</type><header><message><messageSender>SENDER</messageSender><messageDate>20090723143720</messageDate> ... and so on
    required:
    <?xml version="1.0" encoding="UTF-8"?>
    <MT_batchStatus>
    <type>BS</type>
    <header>
    <message>
    <messageSender>SENDER</messageSender>
    <messageDate>20090723143720</messageDate>
    ... and so on

    >
    Hans Georg Walter wrote:
    > Is it better to use an XSLT mapping as a second step in the interface mapping or a JAVA adapter module to convert ?
    > any experiences? suggestions? examples?
    In such a case, the best is to write an generic XSLT or Java mapping that will attempt to do the pretty printing/formatting of the xml.
    The advantage of a generic one is that you can reuse the same class/jar for many other scenarios.
    so the flow will be as below in your interface mapping;
    1. your specific source to target mapping
    2. the generic formatting class

  • Schema with carriage return

    I would get the batch file with details of individual jobs as the output schema. The xml file looks alright. However when opened in notepad does not come with carriage return included.
    I know that we can include child delimiter if it's an input flat file converted to xml schema, but no idea on output files.
    Is there anyway we can include the Carriage return line feed in the schema so that when opened in notepad it's readable.

    Assuming you're talking about the output XML rather than the schema; if you open the XML in Visual Studio press the following keys
    <crtl>KD and the XML will be formatted with indentation (hold the
    <crtl> key down while pressing both the K and
    D keys).
    If you want a simple command line utility to format XML for you, the following should do the trick (pass in the name of the XML file):
    static void Main(string[] args)
    XmlDocument document = new XmlDocument();
    document.Load(args[0]);
    XmlTextWriter writer = new XmlTextWriter(args[0], Encoding.UTF8);
    writer.Formatting = Formatting.Indented;
    document.Save(writer);
    writer.Flush();
    writer.Close();
    NOTE: this key sequence also formats source code.
    David Downing... If this answers your question, please Mark as the Answer. If this post is helpful, please vote as helpful.

  • Safari will not display pdf files since installing OS 10.8.2

    Safari will not display pdf files uner Lion 10.8.2

    Back up all data.
    Triple-click the line of text below to select it, the copy the selected text to the Clipboard (command-C):
    /Library/Internet Plug-ins
    In the Finder, select
    Go ▹ Go to Folder
    from the menu bar, or press the key combination shift-command-G. Paste into the text box that opens (command-V), then press return.
    From the folder that opens, remove any items that have the letters “PDF” in the name. You may be prompted for your login password. Then quit and relaunch Safari, and test.
    The "Silverlight" web plugin distributed by Microsoft can also interfere with PDF display in Safari, so you may need to remove it as well, if it's present.
    If you still have the issue, repeat with this line:
    ~/Library/Internet Plug-ins
    If you don’t like the results of this procedure, restore the items from the backup you made before you started. Relaunch Safari again.

  • Adobe Reader Will Not Display Large PDFs

    When using the Adobe Reader app on PlayBook it will not display some PDFs. It seems that it will not display PDFs that are too large.
    Some files that might be too large do not display while smaller files do display in the app. The too large range could be in the 12 MB region where the good range could be 6 MB or less.
    I tried to submit feedback to BlackBerry on this issue but it returned my email saying it could not process my request. I am hoping that they read it here.
    Here is a link to a page with both readable and unreadable files:
    http://www.bossus.com/backstage/product_manuals/?g​roup=2
    A readable PDF is the owner's manual for the RV-3. A unreadable PDF is the owner's manual for the RC-3.

    That looks like a perfectly good PDF, but since it's trying to open in Microsoft Word, that means your file association for .pdf files is incorrect.  You should change it to point to Adobe Reader instead of Word.
    If you are on Windows, see http://windows.microsoft.com/en-us/windows/change-file-open-program#1TC=windows-7

Maybe you are looking for