Determine row height uitable
25 次查看(过去 30 天)
显示 更早的评论
Is it possible to determine the height of a row in a uitable? I'd like to change the size of my table to accommodate the # of rows I am displaying. I'd prefer to do this without resorting to getting the java object ...
0 个评论
采纳的回答
Yair Altman
2011-12-20
height = jtable.getRowHeight();
or if you are using different heights for different rows, then:
heights = jtable.getRowHeights();
0 个评论
更多回答(2 个)
Marius Rusu
2017-10-6
编辑:Marius Rusu
2017-10-6
Hi,
I had some troubles achieving this but in the end I managed to make it work. Just to share with others (PS. you have to replace hObject with the handle to your object):
jScrollPane = findjobj(hObject);
jtable = jScrollPane.getViewport.getView;
height = jtable.getRowHeight()
jtable.setRowHeight(height*2)
Marius
0 个评论
Walter Roberson
2011-12-20
If you are talking about a sort of equivalent to Extent for a single cell or single row, then No, there is no (documented) MATLAB mechanism for determining that. There is an Extent for the uitable as a whole, and a Position for the uitable, but if the Extent is bigger than the Position then one or more rows is not visible (and there is a scroll-bar to access it.) I was not able to determine the number of visible rows.
Now, doing this in Java is probably a different matter. See undocumentedmatlab.com for all kinds of goodies.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Migrate GUIDE Apps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!