Borrar filtros
Borrar filtros

How can i solve set problem?

2 visualizaciones (últimos 30 días)
Martí Pons
Martí Pons el 6 de Dic. de 2017
Comentada: Martí Pons el 8 de Dic. de 2017
jPb = javax.swing.JProgressBar; set(jPb,'StringPainted','on','Value',0,'Indeterminate','off','Foreground',[0 0 1]);
StatusBar(1)=uicontrol('Style','Text','Position',[.03*scrsz(3),.51*scrsz(4) .3*scrsz(3)15],'String','','BackgroundColor','w');
[SB1, ~] = javacomponent(jPb,[.03*scrsz(3) .48*scrsz(4) .3*scrsz(3) 20],F1);
% StatusBar2 - Pitch progression
jPb = javax.swing.JProgressBar; set(jPb,'StringPainted','on','Value',0,'Indeterminate','off','Foreground',[0 0 1]);
StatusBar(2)=uicontrol('Style','Text','Position',[.03*scrsz(3),.46*scrsz(4) .3*scrsz(3) 15],'String','','BackgroundColor','w');
[SB2, ~] = javacomponent(jPb,[.03*scrsz(3) .43*scrsz(4) .3*scrsz(3) 20],F1);
And the error is:
Error using set Parameter must be scalar.
Error in GenDesign/UserInterface (line 95) jPb = javax.swing.JProgressBar; set(jPb,'StringPainted','on','Value',0,'Indeterminate','off','Foreground',[0 0 1]);

Respuestas (1)

Elizabeth Reese
Elizabeth Reese el 8 de Dic. de 2017
The javacomponent function is undocumented and will change in a future release. I do not recommend using it.
With regard to the error, this is because the types for your inputs do not match what that Java object is expecting. It expects a boolean, int, boolean, and Color respectively.
set(jPb,'StringPainted',1,'Value',0,'Indeterminate',0,'Foreground',java.awt.Color(0,0,1));
  1 comentario
Martí Pons
Martí Pons el 8 de Dic. de 2017
Seriously, you've saved my life. Thank you very much Liz!!

Iniciar sesión para comentar.

Categorías

Más información sobre Software Development Tools en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by