JtextPane with word wrapping chops up words and lines

Hi,
I have a JTextPane for use ina a chat type scenario, inside a JScrollPane. I use "insertString()" to put in user entered strings:
doc.insertString(doc.getLength(), s+"\n", doc.getStyle("regular"));
It works most of the time, but whena string is long it cuts up words and lines and I can't figure out why! I want the pane to wrap text like any normal text box, not chop up words and so on. Entering the string "i think some times the chat gets cut up funny and the words gets chopped" cuts up the word "funny" like so:
i think some times the chat gets cut up f
unny and the words gets chopped
Entering "i think some times the chat gets cut up funny and the words gets chopped up and it realllllllllllllllllllllllllllllllly sucks you know" produces:
i think some times the chat gets cut up f
unny and the words gets chopped up and it rea
lllllllllllllllllllllllllllllllly sucks you k
now
Here it has cut up "funny", "realllllllllllllllllllllllly" and also for some reason "know" (even though there is plenty of space for the word "know" on the last line).
Please help!
PS. Using a JtextArea instead is not an option available to me. I am insert plain text, not HTML or rtf.
Thanks NC

PS. Using a JtextArea instead is not an option available to me. I am insert plain text, not HTML or rtf.If you are using "plain text" then it is an option.
If you are using styled text then you need to use a JTextPane. Here is some code I've used in the past. I've never notice any problems unless the word is wider than the width of the text pane in which case it will use character level wrapping instead of word level wrapping:
http://forum.java.sun.com/thread.jspa?forumID=57&threadID=342068

Similar Messages

  • Pages and key note not compatible with word and powerpoint

    Dear members
    I have received valuable help here, but still pages does not open word documents, I am having problems because I am the only person in my organisation who uses Mac! All the documents are in word format. Yvan kindly helped me and told me to use some tests. I wonder what kind of tests are, I spoke with Apple care, they spent 40 min on the phone doing the following after explaining:
    I have a new Mac pro laptop which came as a replacement because the first one had a problem with bluetooh.
    The previous Mac pro could open word and powerpoint using pages and key note
    When I received the new mac pro I passed the information to the previous one to this one using time machine
    I noticed immediately that the new mac pro could not open word using pages
    After this I have received snow leopard , installed it , the problem remains
    I explained this to the technician on the phone
    Then:
    put caches on desktop
    updated the snow leopard to 10.6.1
    created a file and saved as a word file using pages, but pages still not open the same doc created by it
    The technician tried to contact a senior member and I was left waiting for 20 min to speak with a senior and never happened, I called again and they did the same
    Of course that there is something wrong with my system because the previous faulty mac could open word and powerpoint
    Any ideas?
    Best Regards
    Omar

    I love iWork, but honestly, if I were the only one in an organization to use a Mac, I would get NeoOffice or Open Office, which are intended to be directly compatible with their Microsoft equivalents. Or, you know, buy MS Office for the Mac.

  • How to send a 100 plus page MS Word Report with Word and pdf. attachments?

    Sir or Madam,
    I am not able to e-mail or have a 100 plus page report received and need your support. It contains a combination of MS Word and pdf files and attachments.
    I am using MS Outlook 2007 and Google Chrome.
    Please advise.
    Thank you in advance.
    Earleb
    Earle Rheaume

    Sir or Madam,
    I am not able to e-mail or have a 100 plus page report received and need your support. It contains a combination of MS Word and pdf files and attachments.
    I am using MS Outlook 2007 and Google Chrome.
    Please advise.
    Thank you in advance.
    Earleb
    Earle Rheaume
    If your mail service allows all of that to be sent as attachments or however you are attempting that then it's possible the email server or servers receiving the email do not allow attachments that large.
    You say you are sending "a combination of MS Word and pdf files and attachments". I've never sent anything like that. I have zipped various files into a zip file then attached that to an email for sending.
    Googles mail appears to allow a total of 25 megabytes of attachments in a single email.
    Yahoo mail appears to allow a total of 25 megabytes also.
    Microsofts mail appears to allow a total of 20 megabytes of attachments in a single email.
    Another option would be to upload everything to your onedrives public folder and provide a link for others to download all of it in the email you send out.
    A single users onedrive supposedly can have up to 10 gigabytes loaded onto it. I suppose all of that could be used by the public folder but maybe not.
    La vida loca

  • Missing words and lines in PDF

    Platform/tools:
    Windows XP Pro SP 2 or later
    FrameMaker 7.2
    Adobe Acrobat 8 Professional (part of CS3)
    Adobe PDF print driver setting: High Quality Print, black and white (rather than color)
    When I create a PDF from FrameMaker, my process is to print to a PS file, then distill separately to create the PDF. This all used to work fine, but recently, I have the following consistent problem:
    Words and whole lines are missing. It seems as though they are near where I use an italic character format (which is an actual format I've created in FrameMaker, not the kind applied with Ctrl-i). However, that same character format never was a problem before, nor did I have missing text.
    If I take the same files over to my older computer, with FrameMaker 7.1 and Acrobat 7, and print to a PS file and then distill, the PDF file is perfectly fine.
    Perhaps somehow the Adobe PDF driver (and possibly other printer drivers) got corrupted? If so, how can I fix that? I dread thinking that I will have to uninstall and reinstall CS3, since, for some reason, the process of uninstalling takes many hours.
    Or, is there another thing that causes this kind of problem?
    Any help would be so appreciated!

    Marina,
    Take a look at the following from Microsoft:
    This may cure your problem.
    Mike

  • Printing issues with Word and embedded excel

    we are using word 2003 with embedded excel blocks.  The issue is we have a 9040n printer in one office where the document is created, but when we come to another office and try printing the word document on a 9050 printer, the document looks different.  I've tryed using current pcl 6 drivers on both printers with no luck, and now if have ther 9040 PCL 6 driver on both printers with the same issues happening?  Any Ideas, please help!!
    Brad

    I came across your question and wondered if you could help me. I just bought a macpro with leopard and am having a heck of a time getting it to work with my design jet 800ps which is connected by usb cable. I installed the driver for the printer from the leopard cd but to no avail. The printer shows up in the printer list but when I send a file nothing happens. I have been on the phone with HP but nothing seems to make a difference.
    Thanks much

  • Clipboard issue with Word and Flash CS4 in Snow Leopard

    I use Flash CS4/word 2008 on a regular basis and copy text from word into flash. Since I upgraded to SL, I no longer can paste text into Flash. This is a major productivity killer for me. Are there any global clipboard settings?

    That indicates corruption or a conflict within the old account, usually with preference (plist) files. Make a list of the preference files inside the /new user/Library/Preferences/ folder, log back into the old account, move the ones on your list to a folder on the desktop, log out and back in, and see if the behavior is fixed. If so, create another folder on the Desktop, copy the new ones to that folder, and slowly replace a few new ones in /old user/Library/Preferences/ with the same ones first moved, until you find which ones were causing the problem. Delete those and replace with their copies. The process is slow, but required.
    Alternatively, you could log into the new one, delete the old one, *electing to save its data (creates a disk image in /Users/Deleted Users/)*, recreate the account, using the same username/password combo, log into it, mount the saved data image, and slowly transfer plist files from it to the recreated one, frequently logging out and back in until you find the bad files.
    Good luck.

  • HT4356 printing page from facebook using picture and airprint page in upper left quadrant with words and margin cut off

    I have a ipad 4 with 6700 hp printer. I was told by support that the way to print a page from facebook was to take a picture of the page and then print the picture. When I do this the picture is printed in the upper left hand quadrant with part of the wording cut off. Is the only or best way to print from facebook and how can I fix the location of the print. Seems Hoaky to me
    Luther288

    Well after weeks of anguish, trips to the apple store (not very professional ), calls to Apple support (no help), calls to HP support, they transfered me to airprint support who actually told me how to fix my problem. For an HP printer download from the app store HPAIO remote print. You have to search on AIO remote print. Installed this app and now I can make the print work like I would like. Good luck

  • 10.4.11 issues with Word, and CS3

    Ok, so I guess it's become standard to experience more or less minor problems with osx updates.
    I updated via software update which seemed to be alright. But now I am experiencing slightly longer boot times (30+ seconds more), MS Word 2004 and Powerpoint won't open, and Adobe CS3 is also acting up: Photoshop seems slow to start up, but the biggest problem is Flash 9. It takes around 30 seconds to open a file, but once it's open, it will perform reasonably. If I then switch to another random application and go back to Flash it will go through another 30 sec of spinning wheel.... very annoying and time consuming.
    Everything is updated, and I tried installing 10.4.11 intel combo, but the result is the same. Other than that I've had no problems with Safari or osx in general.
    Has anyone else experienced the same?

    Try downloading the 10.4.11 combo updater and run that. Repair permissions before and after the update.

  • E-mail merge with Word and Outlook problem

    I'm trying to do an e-mail merge with Office 2011: Word, Excel, and Outlook.
    Before you start typing, I've already searched the web, searched the Apple forums, and posted to the Microsoft forum, with no success.
    Anyway: I have outlook configured to send and receive mail from a single Gmail account.
    Outlook works otherwise to send and receive mail.
    Outlook is set, in both Mail and Outlook, to be the default e-mail program.
    Everything seems to work fine until the final step, clicking the generate e-mail merge button that should send the mail merge to Outlook. The mail merge emails are supposed to appear in Outlook, but they don't.
    If you have figured out how to do this, please let me know.
    I would prefer to do this with Mail and Numbers, or Excel and Mail, but that functionality does not exist. I'm sure it would probably work if it did.
    I have a standalone mail merge app (MaxBulk Mailer) but I'd prefer to use the database I already have, which is in Excel, rather than have to create two databases, one in Excel, and another in MaxBulk. MaxBulk has some other problems as well and is not a great solution. 
    Thanks.

    Not sure if this is entirely the same issue but.... we just saw a very similar issue resolved here by my recommending that one of our mail merge-using faculty run the Outlook 2011 database rebuild utility (holding down option while starting Outlook 2011 for OSX).  Mail Merging from Excel 2011 mailing lists to Outlook 2011 starting working like a charm after that.
    The differences with our setup were that we were sending a mail merge via an Exchange Server, not GMail, and that this issue started after upgrading from 10.6 to 10.9 via the App Store.  Mail Merging had been working fine in 10.6.
    Worth a try?  Guard your backups and good luck!

  • With 1.1.1 update on Sep 2, excel opens and then closes immediately.  same with word and powerpoint

    with the 1.1.1 update of MS Word, Excel and Powerpoint for the iPad on Sep 2, all of the three open when selected and then close immediately.  Using iPad Air

    Try this  - 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 - let go of the buttons. (This is equivalent to rebooting your computer.) No data/files will be erased. http://support.apple.com/kb/ht1430
    iOS 7: Help with how to fix a crashing app on iPhone, iPad (Mini), and iPod Touch
    http://teachmeios.com/help-with-how-to-fix-a-crashing-app-on-iphone-ipad-mini-an d-ipod-touch/
    Troubleshooting apps purchased from the App Store
    http://support.apple.com/kb/TS1702
    Delete the app and redownload.
    Downloading Past Purchases from the iTunes Store, App Store and iBooks Store
    http://support.apple.com/kb/ht2519
     Cheers, Tom 

  • HP4630 problems with Word and Adobe reader

    Hi,
           I have recently setup a new computer at Home, Win 7 64Bit, and I cannot get the HP4360 Printer to work correctly.
    Tests completed
    Print from Computer 1, via USB  win 7 64Bit all OK, and has been for months
    Print From computer 2 Via wireless Win 7 32 Bit all OK, and has been for months
    Print from Newly setup Computer  (Computer 3)  win 7 64 Bit via wireless, the following occurs
    Print from Notepad Works Ok
    Print from Word, Adode Reader nothing Prints.
    Turn Printer offline
    Print from Notepad - Document sits in the Print Queue, Turn printer online and it prints
    Print from Word - Nothing appears in the Print Queue ever.
    Connected Old cannon printer to New Computer via USB and can print from Word, Adobe, Notepad all OK.
    Unistalled Drivers and Reinstalled Latest from Web, no change to the above problems.
    Download and run HP Print and Scan Doctor, Passes all tests.
    After 3 days of trying Gave up and connected Old Cannon Printer,  Wife now Happy, but it is just annoying as I want to use the new printer, as that is why i brought it, so I could get rid of the old cannon, Which Luckly I hadn't tossed yet
    Any other suggestions welcome
    Kelvin

    Hello Kelvinlow39,
    Welcome to the HP Forums.
    I see that you are having an issue when attempting to connect the printer over a wireless network.
    I am going to give you a document to run through just in case you missed a step along the way. Please click on the following link for Setting Up the Printer for a Wired or Wireless Network for HP Printers.
    If the troubleshooting does not help resolve your issue, I would then suggest calling HP's Technical Support to see about further options for you. If you are calling within North America, the number is 1-800-474-6836 and for all other regions, click here: click here.
    Thanks for your time.
    Click the “Kudos Thumbs Up" at the bottom of this post to say “Thanks” for helping!
    Please click “Accept as Solution ” if you feel my post solved your issue, it will help others find the solution.
    W a t e r b o y 71
    I work on behalf of HP

  • EXC_BAD_ACCESS (SIGBUS) error ONLY with Word and Excel

    Whenever I try to launch Microsoft Word or Excel either from the Dock or from the applications folder, the programs fail to launch and I get this in the report: EXCBADACCESS (SIGBUS).
    What's odd is that both programs will start if I double click an existing Word or Excel document.
    I just cannot start the programs manually from the Dock or the App folder.
    This problem started after I installed a Quicktime package called Perian, and the problem persists even after removing the package.
    I'd appreciate any help in solving this problem.

    Did you find out anything regarding the EXCBADACCESS? I'm running into the same problem. I cannot restart any of my Word apps. I can open existing Word & Excel documents. Please let me know. I'm desperate. I've also reinstalled my Word application. Thanks.

  • Making a Pages document compatible with Word and Full-screen view

    Hi there! I would like to know if it is necessary to have Microsoft Office installed on my computer in order to be able to save a Pages document as "Microsoft Word" compatible. As of now, when I select the "Save As" option, I'm only able to save my document as a iWork 06 and 05 file. Also, I've noticed that on the video tutorials online, there is a "full-screen" mode and I was wondering if it was available on iWork 08, or if it is only for iWork 09. Thank, and sorry if these questions have been answered before!

    Welcome to Apple Discussions
    No, you don't need Office installed. That's the whole idea. Go to File > Export & choose Word (or text, rtf or pdf). The option to "save as" Word has been added in Pages 4/iWork '09 as well as in export.

  • Problems with Word Doc line spacing

    I have multiple word docs to bring in and each time, all though the word doc is formatted like I need (italic headers, diff font sizes etc…) Indesign brings it in double spaced although it is not that way in the word doc. At this point I am having to go to the end of each line, delete to bring the next line to the end of that one, then shift+enter to drop it down 1 line. I have 11 documents that are 5-10 pages each…. Is there a way to avoid having to do all of that??? I have tried tweaking the leading via the justification panel as I saw on another site, but it has no effect. Brought in a different document, formatted exactly the same as above. This time it kept the space right, but when I narrowed the text box to fit where I needed it, instead of lines just dropping down as they should, they are actually laying on top of each other. I am at a complete loss.... ANY help would be greatly appreciated!

    Don't use Word styles in InDesign. Set up InDesign styles which will replace word styles when text is imported into InDesign. Word styles have different parameters as InDesign styles have. You can't compare them, every imported Word style will make a mess in InDesign. You can set up once the style in InDesign and create a template upon file import how Word Styles are translated into the InDesign styles.

  • Clipboard problems in conjunction with Word 2004 and Acrobat 7

    Does anyone else out there have problems with Word and Acrobat crashing when you are doing a cut and paste? I sometimes get problems with cutting and pasting in word, and sometimes I get it trying to paste text from acrobat to word. Could be word related, but it feels more like the clipboard is getting too full, and dragging the clipped application down with it. There are no warnings. Any ideas?
    iBook G4   Mac OS X (10.3.9)  

    Hello TL49,
    Welcome to the HP Forums.
    I understand that you're having an issue printing envelopes in Word 2011 on your Mac 10.9 with the Officejet 100 mobile. I will do my best to assist you with this.
    Please make sure you have downloaded the full feature software for your printer from hp.com.
    Remove and re-add your printer.
    Choose Apple menu > System Preferences Then choose View > Print & Scan
    Highlight the printer and click the (-) to delete it.
    Click the (+) to setup printer. Choose add other printer/scanner.
    Make sure the "Use" is set to the HP mobile 100 and not Airprint.
    Close out of Word and restart the Mac after adding in your printer.
    Try printing envelopes in Word 2011 to test.
    Please let me know how you make out, and thank you for posting on the HP Forums.
    I worked on behalf of HP.

Maybe you are looking for

  • Unable to load drivers on Windows 7 64 bit - HP OfficeJet Pro L7590

    Unable to load drivers on my PC, once worked after cleaning up my PC reloaded latest software from HP download.  Fails everytime via USB tried also direct network connect same result.  Tried uninstall and reinstall including trying to stop windows up

  • Double buffering && repaint

    Hi there, I have a frame F that contains two panels P1 and P2. P1 uses double buffering for drawing circles and lines. P2 has buttons and a JList. When i click on a JList to have popup menu or when i move the frame F on the screen the panel P2 lost s

  • Installment Loans - Over Payment

    Hello all, The requirement from the business id as follows: If a customer makes an over payment on an installment loan (tcode EK25), then the payment should be applied only to the principal amount. It should not be applied to the interest document. T

  • LV 5.0 and Set Operations

    Hello all, I am a student at the University of Texas @ Austin and I have been looking through the LV 5.0 documentation for any documentation about Sets and/or Operations on Sets but cannot find anything usefull. Does anyone know if LV supports Sets a

  • BEx keep reloading in IFRAME

    Hi, We need to embed BEx template and query in a HTML iFrame, the putting it in a simple html page like this. i-frame http://ep.negc.com.cn:50000/irj/servlet/prt/portal/prtroot/pcd!3aportal_content!2fcom.sap.pct!2fplatform_add_ons!2fcom.sap.ip.bi!2fi