swing - Java - get JTextArea's size after changing text -
is there way in java how preferred size of jtextarea after changing text besides multiplying rows , columns?
here's example:
jtextarea = new jtextarea("sooooooooooooooooooooooooooooooooooo long line"+ "\nfoo\nboo\nbar\nmoo\nso\nlong\ntext"); dimension p1 = a.getpreferredsize(); dimension s1 = a.getsize(); a.append("some\nmore\ntext"); //a.recomputesize(); need dimension p2 = a.getpreferredsize(); dimension s2 = a.getsize(); system.out.println(p1); //[width=302,height=128] system.out.println(s1); //[width=0,height=0] system.out.println(p2); //[width=302,height=128] system.out.println(s2); //[width=0,height=0]
java swing resize jtextarea
No comments:
Post a Comment