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.

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.

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.

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.

This article has been dead for over six months. Start a new discussion instead.