2016-04-01 1 views
2

Matlab R2015aのウェイトバー内のバーの幅を制御するにはどうすればよいですか?ウェイトバーの棒グラフの幅を変更する - MATLAB R2015a

私は、次の質問を参照:それは言及したユーザーとしてソリューションを使ってMATLAB R2012bで完璧に動作しますが、R2015aのために、「ウエイトバー1」という文字列が中央に配置されて

waitbar -> length ot the bar figure?

HWait = waitbar(0,'Waitbar 1', 'Units', 'normalized', 'Position', [0.25 0.4 0.3 0.08]); 
set(HWait,'Name','Tests running'); 
childrenWaitb = get(HWait, 'Children') ; 
set(childrenWaitb, 'Position',[10.8000 13.5000 320 9]); 

答えて

1

WAI:、およびすべての幅を変更しない割合バーが....

は、私は、次のコードを使用しましたtbarはr2014bの(多くのグラフィックと並んで)変更されました。ウェイトバーの進行状況バーは、単純な軸であったので、その位置を設定することができました。

新しいウエイトバーがJavaのプログレスバー上に構築されている - ので、あなたはそれを更新するには、Javaの文書化されていない機能にアクセスする必要があります。

% Create a progress bar. 
hBar = waitbar (0, 'Please Wait....'); 
% now use java to get to the progress bar 
jFrame = get (hBar, 'JavaFrame'); % this will throw a warning 
jFigPanel = jFrame.getFigurePanelContainer; 
% Now go down through the children of the panel to get the container for the progress bar 
jContainer = jFigPanel.getComponent(0); 
jPanel = jContainer.getComponent(0); 
% Change the location of the panel (ref pixels) 
jPanel.setLocation(0,40); 
% Change the size of the panel 
jPanel.setSize(360,18); 
% You then need to repaint and validate for the update to be visible. 
jContainer.repaint 
jContainer.revalidate 
関連する問題