Redian新闻
>
How to wrap line at specific position?
avatar
How to wrap line at specific position?# Java - 爪哇娇娃
h*b
1
I want to wrap text in an editor area at a specific position, I have a
configure dialog to ask user specify line wrap at, say, 60 characters or 90
characters. Then I want the text to be displayed like that.
I can use JTextArea/JTextPane/JEditorPane, but no luck. setColumn() method
won't do it because it actually changed the size of the component, which I
don't want. I also tried to use styleddocument and override insert() method,
but in that way I have to insert new line characters which is not
avatar
g*g
2
did you setLineWrap(true)?

【在 h******b 的大作中提到】
: I want to wrap text in an editor area at a specific position, I have a
: configure dialog to ask user specify line wrap at, say, 60 characters or 90
: characters. Then I want the text to be displayed like that.
: I can use JTextArea/JTextPane/JEditorPane, but no luck. setColumn() method
: won't do it because it actually changed the size of the component, which I
: don't want. I also tried to use styleddocument and override insert() method,
: but in that way I have to insert new line characters which is not

avatar
h*b
3
yes, I did setLineWrap(true); but I want also it wrap at a specified position,
like this:
_______________________________________________________________
|heheheheheheheheheheheeeeeeeeeeeeeeeeeeeeee |
|heheheheheheheheheheheeeeeeeeeeeeeeeeeeeeee |
|heheheheheheheheheheheeeeeeeeeeeeeeeeeeeeee |
|heheheheheheheheheheheeeeeeeeeeeeeeeeeeeeee |
|heheheheheheheheheheheeeeeeeeeeeeeeeeeeeeee

【在 g*****g 的大作中提到】
: did you setLineWrap(true)?
avatar
h*b
4
再问一遍!
//papaya

position,
this:
method
I

【在 h******b 的大作中提到】
: yes, I did setLineWrap(true); but I want also it wrap at a specified position,
: like this:
: _______________________________________________________________
: |heheheheheheheheheheheeeeeeeeeeeeeeeeeeeeee |
: |heheheheheheheheheheheeeeeeeeeeeeeeeeeeeeee |
: |heheheheheheheheheheheeeeeeeeeeeeeeeeeeeeee |
: |heheheheheheheheheheheeeeeeeeeeeeeeeeeeeeee |
: |heheheheheheheheheheheeeeeeeeeeeeeeeeeeeeee

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。