Results 1 to 2 of 2
- 03-23-2012, 10:05 PM #1
Member
- Join Date
- Mar 2012
- Posts
- 5
- Rep Power
- 0
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.
- 03-24-2012, 09:33 AM #2
Member
- Join Date
- Mar 2012
- Posts
- 5
- Rep Power
- 0
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
-
AES+RSA Wrapping
By hanseichel in forum Advanced JavaReplies: 0Last Post: 12-11-2011, 12:42 AM -
Tableviewer Wrapping
By Daniel38 in forum SWT / JFaceReplies: 0Last Post: 02-03-2011, 09:59 AM -
Line Wrapping
By Lil_Aziz1 in forum EclipseReplies: 9Last Post: 06-25-2010, 02:47 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks