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 ...

 채택된 답변

Yair Altman
Yair Altman 2011년 12월 20일

2 개 추천

Use findjobj to get the uitable's underlying Java JTable reference, and then simply do:
height = jtable.getRowHeight();
or if you are using different heights for different rows, then:
heights = jtable.getRowHeights();
More on stuff like this in my Matlab-Java programming book.

추가 답변 (2개)

Marius Rusu
Marius Rusu 2017년 10월 6일
편집: Marius Rusu 2017년 10월 6일

1 개 추천

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
Walter Roberson
Walter Roberson 2011년 12월 20일

0 개 추천

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.

카테고리

도움말 센터File Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

태그

질문:

2011년 12월 20일

편집:

2017년 10월 6일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by