JEditorPane and word-wrapping
I'm using a JEditorPane and StyledDocument, which automatically wraps text to the window. I cannot have this, I need the window to allow horizontal scrolling of the text. I've been all over yahoo and google and cannot find an answer on how to disable word wrapping. And before anyone tells me to use JTextArea, I can't use that because I'm creating an IDE with syntax highlighting. Any help?
I've tried putting the editor in a JPanel with FlowLayout, but I didn't get the desired results.
Phaelax
Practically a Posting Shark
858 posts since Mar 2004
Reputation Points: 92
Solved Threads: 51
Good luck fixing that. The ONLY thing I can think of trying is using a scrollpane and then adding the editorpane to that. If that doesn't work then I believe you are out of luck.
server_crash
Postaholic
2,111 posts since Jun 2004
Reputation Points: 113
Solved Threads: 20
Already tried that too.
I've also run into another problem. Loading a new file into the editor seems to be very slow.
Is there another preferred way to load files into it?
File file = new File("c:/test/test.dba");
FileInputStream f = new FileInputStream(file);
editorPane.read(f, null);
A 4200 line file takes 5 or more seconds to load, even with no sytnax highlighting being done.
Phaelax
Practically a Posting Shark
858 posts since Mar 2004
Reputation Points: 92
Solved Threads: 51
Can you try reading the data into a document and then setting the document of the editorpane?
server_crash
Postaholic
2,111 posts since Jun 2004
Reputation Points: 113
Solved Threads: 20
Document.insertString(int offset, String str, AttributeSet a)
Not sure if doing it that way would be any faster though, cause I'm pretty sure thats what the editorPane calls anyway when reading in a file.
Phaelax
Practically a Posting Shark
858 posts since Mar 2004
Reputation Points: 92
Solved Threads: 51
server_crash
Postaholic
2,111 posts since Jun 2004
Reputation Points: 113
Solved Threads: 20