How can i solve set problem?

1 次查看(过去 30 天)
Martí Pons
Martí Pons 2017-12-6
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]);

回答(1 个)

Elizabeth Reese
Elizabeth Reese 2017-12-8
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));

类别

Help CenterFile Exchange 中查找有关 Dialog Boxes 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by