How can i solve set problem?

1 vue (au cours des 30 derniers jours)
Martí Pons
Martí Pons le 6 Déc 2017
Commenté : Martí Pons le 8 Déc 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]);

Réponses (1)

Elizabeth Reese
Elizabeth Reese le 8 Déc 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 commentaire
Martí Pons
Martí Pons le 8 Déc 2017
Seriously, you've saved my life. Thank you very much Liz!!

Connectez-vous pour commenter.

Catégories

En savoir plus sur Dialog Boxes dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by