Position group docked figures proportional to screen size (javaframe)

조회 수: 8 (최근 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 CenterFile Exchange에서 Graphics Objects에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by