JTextPane limited lines.
Dear sir;
How will i restrict the line number of JtextPane?
but i got line count of JtextPane.
the code is avaible here.
public static int getWrappedLines(JTextPane component)
{
int lines = 0;
View view = component.getUI().getRootView(component).getView(0);
int paragraphs = view.getViewCount();
for (int i = 0; i < paragraphs; i++)
{
lines += view.getView(i).getViewCount();
}
return lines;
in my case After three lines JTextpane wont allow to edit charactor.
But it should allow to delete whatever i typed it up to three lines.
please give the solution for the same
Dear friend
public static int getWrappedLines(JTextPane component)
{
int lines = 0;
View view = component.getUI().getRootView(component).getView(0);
int paragraphs = view.getViewCount();
for (int i = 0; i < paragraphs; i++)
{
lines += view.getView(i).getViewCount();
}
Code is avaiable here.
if u want any thing please ask me
Did you use the "Preview" button to look at your code? You have to post your original code so it retains the formatting. Make an effort to learn how to use the forum correctly.
If I understand the question then this posting should have a solution:
http://forum.java.sun.com/thread.jspa?forumID=57&threadID=689486
Actually, I doubt the above is what you need so check out my answer in this posting instead for a different idea:
http://forum.java.sun.com/thread.jspa?messageID=4464970
> Did you use the "Preview" button to look at your
> code? You have to post your original code so it
> retains the formatting. Make an effort to learn how
> to use the forum correctly.
>
> If I understand the question then this posting should
> have a solution:
>
> http://forum.java.sun.com/thread.jspa?forumID=57&threa
> dID=689486
>
> Actually, I doubt the above is what you need so check
> out my answer in this posting instead for a different
> idea:
>
> http://forum.java.sun.com/thread.jspa?messageID=446497
I am using JTextPane.But it is for JtextArea