etgaroy
asked on
Limit JTextPane size
Hi,
I want to use a JTextPena for writing but I want to limit the size of the writable area.
Lets say I want to allow writing only in 3 rows. Anything over 3 rows will beep and not be written.
Do I have to use DefaultStyledDocument? and if so how?
thanks,
Edgar
I want to use a JTextPena for writing but I want to limit the size of the writable area.
Lets say I want to allow writing only in 3 rows. Anything over 3 rows will beep and not be written.
Do I have to use DefaultStyledDocument? and if so how?
thanks,
Edgar
ASKER
Hi glottis,
To limit the number of characters is easy as you said and I can do it using DocumentFilter class.
The problem is that I want to limit the JTextPane to a set number of lines (not necesarily lines seperated by pressing enter). Another problem is that I am using different types of font and font size.
Thanks,
Edgar
To limit the number of characters is easy as you said and I can do it using DocumentFilter class.
The problem is that I want to limit the JTextPane to a set number of lines (not necesarily lines seperated by pressing enter). Another problem is that I am using different types of font and font size.
Thanks,
Edgar
u have to look deeply in the textpane class and see how Java inserts string on new lines. maybe that way u can limit.
ill see into this and post if any thing comes up.
interesting challenge here :P
ill see into this and post if any thing comes up.
interesting challenge here :P
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
hmmm...
thats is a good solution...
give the points for your own self
thats is a good solution...
give the points for your own self
etgaroy:
This old question needs to be finalized -- accept an answer, split points, or get a refund. For information on your options, please click here-> http:/help/closing.jsp#1
EXPERTS:
Post your closing recommendations! No comment means you don't care.
This old question needs to be finalized -- accept an answer, split points, or get a refund. For information on your options, please click here-> http:/help/closing.jsp#1
EXPERTS:
Post your closing recommendations! No comment means you don't care.
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
PAQ - refund points
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
jimmack
EE Cleanup Volunteer
I will leave a recommendation in the Cleanup topic area that this question is:
PAQ - refund points
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
jimmack
EE Cleanup Volunteer
implementing limitation of how many characters the user can type would be easy :P