Borrar filtros
Borrar filtros

Find number in uitable

1 visualización (últimos 30 días)
john
john el 8 de Mayo de 2012
Hi,
I have uitable, columns and rows are changing, there are not still the same. At first I can insert number only for the first column. If everything is OK, then I can insert number to the next column. If I insert number one or minus one into uitable, and after that if uitable consist more then one "1" or more then "-1", then I need write "Error with 1" or " Error with -1" or "Error with 1 and -1" into edittext, and also I want to set background color to red only for one cell in uitable for last bad inserted number.
Maybe therefore I will need, how to set background color only for one cell.
And maybe I should create any cycle, loop with "for" instruction to searching number "1" and number "-1". In case, if I find number more than one "1" or more than one "-1", I should stop this cycle.
So how can I stop this cycle?
Thank you for help

Respuesta aceptada

Jan
Jan el 8 de Mayo de 2012
You can set the foreground color using the semi-documented method of HTML markup as described in MathWorks solution 1-D782JW. But as soon as you edit the value, the HTML tags are very confusing.
The background color can be set by undocumented Java methods only, see: Undocumented: uitable-cell-colors.
I do not understand what you want to do with the 1's and -1's, but testing the values of a column can be done in the CellEditCallback. If you want a limited list of values only, a popup menu seems to be helpful.
  1 comentario
john
john el 10 de Mayo de 2012
Hi Jan,
is this command OK?
cr = ColoredFieldCellRenderer(java.awt.Color.white);
cr.setCellBgColor(1,1,java.awt.Color(1,1,0)); % yellow

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Programming en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by