java - Jtextarea height increase dynamically -


i coding in netbeans, question whenever add text in jtextarea dynamically textarea should increase height according content full content shown , don't want scrollbar jtextarea. have made both scrollbar off.

       int i=0;       jtextarea.settext("hello");       while(i<20){          jtextarea.settext(jtextarea.gettext()+"\nhello");           i++;       } 

the behaviour depends on layout manager using. example jframe uses borderlayout default. can like:

jtextarea textarea = new jtextarea(); frame.add(textarea. borderlayout.north); 

now text area width of frame , grow type until there no more space on frame.

i have made both scrollbar off

if don't want use scrollpane don't create scrollpane. add text area directly frame.


Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -