java - Scrollable in JTextArea -
i have class extending jframe , jtextarea configuration below. reason scroll doesn not appear. can't figure out why.
jtextarea ta=new jtextarea(); ... ta.settext(out); jscrollpane scrollframe = new jscrollpane(ta); //ta.setautoscrolls(true); scrollframe.setverticalscrollbarpolicy(scrollpaneconstants.vertical_scrollbar_always); scrollframe.sethorizontalscrollbarpolicy(jscrollpane.horizontal_scrollbar_always); add(scrollframe); add(ta); setsize(300, 300); setresizable(false); setdefaultcloseoperation(windowconstants.hide_on_close); setvisible(true);
for example, adding scrollable jtextarea (java)
just add scrollframe , not jtextarea
add(scrollframe); // add(ta);
Comments
Post a Comment