Position group docked figures proportional to screen size (javaframe)

6 ビュー (過去 30 日間)
Veronica Taurino
Veronica Taurino 2021 年 3 月 2 日
コメント済み: Mario Malic 2021 年 3 月 2 日
Hi! I docked 7 figures within a group (javaframe?). I can't define a position for the whole group. Could you help me? I followed this suggestions by Jan to create the group:
I read few articles on https://undocumentedmatlab.com/ but I could not solve it for now.
My code is something like this:
close all
clear all
f1=figure('WindowStyle', 'normal', 'Name', '1', 'NumberTitle', 'off');
f2=figure('WindowStyle', 'normal', 'Name', '2', 'NumberTitle', 'off');
f3=figure('WindowStyle', 'normal', 'Name', '3', 'NumberTitle', 'off');
f4=figure('WindowStyle', 'normal', 'Name', '4', 'NumberTitle', 'off');
f5=figure('WindowStyle', 'normal', 'Name', '5', 'NumberTitle', 'off');
f6=figure('WindowStyle', 'normal', 'Name', '6', 'NumberTitle', 'off');
f7=figure('WindowStyle', 'normal', 'Name', '7', 'NumberTitle', 'off');
figH = gobjects(1, 7);
figH(1, 1)=f1;
figH(1, 2)=f2;
figH(1, 3)=f3;
figH(1, 4)=f4;
figH(1, 5)=f5;
figH(1, 6)=f6;
figH(1, 7)=f7;
name_files={'1','2','3','4','5','6','7'};
desktop = com.mathworks.mde.desk.MLDesktop.getInstance;
pixels=get(0,'screensize');
myGroup = desktop.addGroup('myGroup');
desktop.setGroupDocked('myGroup', 0);
myDim = java.awt.Dimension(4, 2);
desktop.setDocumentArrangement('myGroup', 2, myDim)
bakWarn = warning('off','MATLAB:HandleGraphics:ObsoletedProperty:JavaFrame');
for iFig = 1:7
figH(1, iFig).Position=[0 0 800 300]; %desired position
figH(1, iFig).WindowStyle='docked';
drawnow;
pause(0.05);
set(get(handle(figH(iFig)), 'javaframe'), 'GroupName', 'myGroup');
end
desktop.setDocumentArrangement('myGroup', 1, myDim)
  3 件のコメント
Mario Malic
Mario Malic 2021 年 3 月 2 日
See figure properties: Position and Units. If you set Units to normalized, you don't need to work with resolution.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeGraphics Objects についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by