This content has been marked as final. Show 63 replies
Thanks to both of you I really appricaite it, I wish I could split points here :)
Guess I could hehe, thanks again guys :)
You're welcome. Thanks for the dukes.
Got a problem.
Why is it that the line is not wrapped ? I tried doing this :
It does not work in JTextPane ? what do we need to do regarding this ?
I also tried casting but the compiler does not allow it :
Where text4 is JTextPane, thanks for all the help.
Which code are you using? Normally, JTextPanes wrap lines by default.
Yes I'm using JTextPane but I tried adding a bunch of text on the editor and the line was to long so instead of getting a new line number from the gutter so that it can adjust I receive a blank one ?
You mean the line wraps, but you don't see another line number? That's how it's supposed to work.
Well in a normal IDE you should still see a line number, how can I ffo that thanks ?
Use the code that Stas linked to in reply #22. But for a source-code editor, that approach makes no sense. If the line numbers don't match the line numbers given in compiler error messages, what use are they?
I agree with uncle_alice. Most IDE don't wrap lines at all. How do you want to make use of a line number in case of an exception if the line numbering depends on the current editor's size?
The_Developer, where were you when we were discussing "logical lines vs. visible lines"?
weebib, I was actually busy implementing the codes. I actually got the keyword coloring, line highlight and line number to work in my JTextPane.
uncle_alice, maybe thats what I need, to not to wrap the lines :) I was actually a bit confused of wrapping and not wrapping. What you've done is almost perfect however this is the problem.
For example the codes is way behind the current view of the JTextPane. The line number skips one line like this :
How can we do it like this :
I really appriciate the help . . .
If you see a space on the links that I gave your from the last digit kindly remove it since it will give an error.
Yep, long urls sometimes behave weirdly on these forums.
I don't know if it is what you're looking for but you can easily turn off line wrapping in a JTextPane by inserting it at the CENTER position of a JPanel(new BorderLayout()). You then add the JPanel to the JScrollPane. That will force the horizontal scroll bar to appear (as in any IDE I know).
Actually what I do is to add the JTextPane to a JScrollPane and add it to the JTabbedPane. How would I do what you want ?
I see what you mean but the scroll of my mouse moves slow, is there any way we can fix this or is there any other solution ?