java - Scrolling inside a JTable cell in Swing -
i have table each cell contains image. if image size more row height, have added jscrollpane
. when run application, scroll visible in each cell i'm not able scroll it.
how can it?
below code i'm using add scroll pane.
any sample code appreciated.
private final jtable table = new jtable(model) { @override public component preparerenderer(tablecellrenderer tcr, int row, int column) { component c = super.preparerenderer(tcr, row, column); if(isrowselected(row)) { c.setforeground(getselectionforeground()); c.setbackground(getselectionbackground()); } else{ c.setforeground(getforeground()); c.setbackground((row%2==0)?evencolor:getbackground()); } jscrollpane _pane=new jscrollpane(c); table.setrowheight(100); return _pane; } };
- right click on jscrollpane
- properties
- horizontal scrollbarpolicy = always
- vertical scrollbarpolicy = always
to able scroll right click on jtable autocreatecolumnfrommodel =false(deactivaded)
Comments
Post a Comment