Domanda

I have a uitable with 6 row and 6 column and i want to show it in full screen mode for doing this i can change column width but i can't change row height.
Extent is Size of uitable rectangle, but it is read only properties.

È stato utile?

Soluzione

With conventional approaches the only possibility to change the row height is by adjusting the 'FontSize' property.

The following function will give you a full-screen table. You can set up 'ColumnWidth' and 'FontSize' until it fills your screen entirely.

function fancyTable 

columnwidth = { 1920/2 1920/2 };
FontSize = 135;

h = figure('units','normalized','Position',[0 0 1 1],...
           'numbertitle','off','MenuBar','none');
defaultData = rand(5,2);
uitable(h,'Units','normalized','Position',[0 0 1 1],...
              'Data', defaultData,... 
              'ColumnName', [],'RowName',[],...
              'ColumnWidth', columnwidth,...
              'FontSize', FontSize,...
              'ColumnEditable', [false false],...
              'ColumnFormat', {'numeric' , 'numeric'});
end

enter image description here


I don't see a simple solution to change the row-height independently from the font size.

But there are some ideas at undocumented Matlab.

" 7. JIDE customizations ... Similarly, this section explains how we can use JIDE to merge together adjacent cells: "

enter image description here

Could be a fiddly workaround, and there are no code-examples.

Altri suggerimenti

You can e.g. use the findjobj utility from the file exchange. It will get you to the underlying java object of the table, somewhere along the lines of:

t = uitable(...);
scrollPane = findjobj(t);
% not 100% sure about this, but there'll be a `UITablePeer` object somewhere within that scrollPane
jTable = scrollPane.getComponent(0); 

This jTable will have a setRowHeight method inherited from http://docs.oracle.com/javase/7/docs/api/javax/swing/JTable.html

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top