Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
mlwidgets -> Array -> ValuePanel

Subject: mlwidgets -> Array -> ValuePanel

From: Jens

Date: 13 Mar, 2012 12:13:13

Message: 1 of 3

Hi,

i am going to use matlabs mlwidget package to display data in an array editor:

com.mathworks.mlwidgets.array.ValuePanel(...).

It seems, that the background color of the cells is always set to grey like the grid color.

Is there any way to change the color, e.g. 'white'.

And furthermore is there any way to change the column and row count?

Thanks

Subject: mlwidgets -> Array -> ValuePanel

From: Yair Altman

Date: 13 Mar, 2012 18:26:14

Message: 2 of 3

"Jens" <alpha60@freenet.de> wrote in message <jjndkp$b4s$1@newscl01ah.mathworks.com>...
> Hi,
>
> i am going to use matlabs mlwidget package to display data in an array editor:
>
> com.mathworks.mlwidgets.array.ValuePanel(...).
>
> It seems, that the background color of the cells is always set to grey like the grid color.
>
> Is there any way to change the color, e.g. 'white'.
>
> And furthermore is there any way to change the column and row count?
>
> Thanks


The trick is to modify the ValuePanel's background before is is displayed:

m = magic(3);
var = com.mathworks.mlservices.WorkspaceVariable('m',0);
vp = com.mathworks.mlwidgets.array.ValuePanel(var);
vp.setBackground(java.awt.Color.white);
[hvp,hContainer] = javacomponent(vp,[10,10,400,200],hFig);

The data table sub-component can be gotten from:
vt = vp.getComponent(1).getComponent(0).getViewport.getView;

and you can take the rest from here

Yair Altman
http://UndocumentedMatlab.com
Read my Matlab-Java programming book

Subject: mlwidgets -> Array -> ValuePanel

From: Jens

Date: 13 Mar, 2012 18:54:15

Message: 3 of 3

Hi Yair,

thank you very much.
I got this idea of using a mlwidget already from your book, which is very very useful.

Thx

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us