java - When i scroll down in jtable my data get disappeared, can anyone suggest? -
i have taken jtable, , added model it, , added text area rendere , editor it.
table.setmodel( jutablebindingfactory.createattributelistbinding( binding, table name, view name, null, null, attributes)); table.getcolumnmodel() .getcolumn(i) .setcelleditor( new textareaeditor( true, true, jscrollpane.vertical_scrollbar_as_needed, jscrollpane.horizontal_scrollbar_never)); table.getcolumnmodel() .getcolumn(i) .setcellrenderer( new textareacellrenderer( true, true, jscrollpane.vertical_scrollbar_as_needed, jscrollpane.horizontal_scrollbar_never)); _table.setrowheight(100);
also have set table row hieght.
text area renderer class
public class textareacellrenderer extends jtextarea implements tablecellrenderer { private jscrollpane pane; private boolean _iseditable = false; private boolean _isenabled = false; private int _verticalbarproperyvalue = jscrollpane.vertical_scrollbar_as_needed; private int _horizontalbarproperyvalue = jscrollpane.horizontal_scrollbar_as_needed; public textareacellrenderer() { super(); init(); } public textareacellrenderer(boolean isenabled, boolean iseditable, int verticalbarproperyvalue, int horizontalbarproperyvalue) { super(); _iseditable = iseditable; _isenabled = isenabled; _verticalbarproperyvalue = verticalbarproperyvalue; _horizontalbarproperyvalue = horizontalbarproperyvalue; init(); } private void init() { pane = new jscrollpane(this, _verticalbarproperyvalue, _horizontalbarproperyvalue); setlinewrap(true); setwrapstyleword(true); seteditable(_iseditable); setenabled(_isenabled); } /** * returns cell renderer component. */ public component gettablecellrenderercomponent(jtable table, object value, boolean isselected, boolean hasfocus, int row, int column) { setlinewrap(true); setwrapstyleword(true); settext(value != null ? value.tostring() : ""); setbackground((isselected) ? nwstheme.blue_dark : nwstheme.white); setforeground((isselected) ? nwstheme.white : nwstheme.black); pane.setenabled(true); return pane; } }
the editor class quite similar, problem doesn't seem relating this, else should try?
try moving horizontal scroll more don't , given impression of experienced. try atleast
Comments
Post a Comment