Results 1 to 2 of 2
  1. #1
    Pluto is offline Member
    Join Date
    Mar 2012
    Posts
    6
    Rep Power
    0

    Default Turning on/off Word Wrapping in jEditorPane

    So I realize that jEditorPane is inherently built to wrap words, but I want to temporarily turn this off, so I can use .getText() to get the contents of what the user entered + what was already there. I've browsed the Internet for probably an hour without finding anything I could actually use, though there were definitely people talking about having done it. The closest I got was here (maybe someone can interpret it for me).

    I definitely need to use jEditorPane, as links need to be clickable within it. And I've worked with it so much that I can't just give up now at the end lol. I have full functionality with what I want to do with jEditorPane, excluding foreign characters being converted to html character codes, which should be no problem to solve. Other things I've gotten jEditorPane to do are let those clickable links function while it's editable, automatically add+parse <a href> tags to URL's, strip all other HTML code I don't need, let the user choose whether to copy <a href> tags, and add <br> code wherever a newline is. Unfortunately the word wrapping is getting in the way of that last thing. So it needs to be solved.

    I'd love to show you guys what I have at the end if you want to see, I already have a limited version functioning! It's basically a program that stores FAQ's+Answers, organized by (nested) categories the user's design. I have the interface split up for finding the right answer to an FAQ + copying that answer to the clipboard by pressing a button, and editing the contents of the FAQ's and saving them to file.

    I originally wrote this program for the console in C++, but the problems I encountered there don't exist with what I'm doing now, like platform independence, an easy GUI builder, and full international support. I started the Java rewrite of the project Sunday this week, which is when I started learning Swing. I plan to reimplement searching and downloading the latest version of the FAQs, so that the people using the program can share most of the same information. This program is being written for Guides/Moderators of a game I was involved in for years.

    So, any idea how to turn off word wrapping in jEditorPane lol? I have it inside a jScrollPane.

  2. #2
    Pluto is offline Member
    Join Date
    Mar 2012
    Posts
    6
    Rep Power
    0

    Default Re: Turning on/off Word Wrapping in jEditorPane

    I figured out something, and my problem is now solved. Each unwanted character was encapsulated in " \n ". Since someone won't likely enter a space, enter, then four spaces, I can just use this as a code to replace() with " ". Then parse the other \n characters!

Similar Threads

  1. AES+RSA Wrapping
    By hanseichel in forum Advanced Java
    Replies: 0
    Last Post: 12-11-2011, 01:42 AM
  2. Tableviewer Wrapping
    By Daniel38 in forum SWT / JFace
    Replies: 0
    Last Post: 02-03-2011, 10:59 AM
  3. Line Wrapping
    By Lil_Aziz1 in forum Eclipse
    Replies: 9
    Last Post: 06-25-2010, 03:47 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •