필터 지우기
필터 지우기

set a non visible figure to maximize

조회 수: 13 (최근 30일)
Jennifer
Jennifer 2011년 9월 15일
I've been using this code to maximize figures:
drawnow % Required to avoid Java errors
jFig=get(handle(gcf),'JavaFrame');
jFig.setMaximized(true);
However, in my code I use figures that are not visible for printing purposes. When I use the aforementioned I get a lot of java errors in red text in the command window. Any suggestions as to how I can get this functioning properly? Is there another way to maximize windows?

답변 (2개)

Hoi Wong
Hoi Wong 2011년 9월 29일
Actually thanks for the hint as I'm trying to do the same thing in one or two lines. I tried adding pause(0.01) between getting the handle and calling the setMaximized() method and there were no errors after since.
I also noticed quite often when I get these java errors when I attempt operations that are supposed to be safe, it's timing issue.
  댓글 수: 1
Gabriel Ruiz-Martinez
Gabriel Ruiz-Martinez 2012년 11월 16일
I had a similar problem with maximize figures as Jennifer, I tried the Hoi's trick, adding "pause", and it works! Thanks Hoi!

댓글을 달려면 로그인하십시오.


Jan
Jan 2011년 9월 15일
Why are the the figures invisible for printing purposes?
Can you maximize the figures before you make them invisible?
What about setting the size manually:
set(gcf, 'Position', get(0, 'ScreenSize'))
% Or:
set(gcf, 'OuterPosition', get(0, 'ScreenSize'))
MATLAB changes the horizontal size magically, but the figure is at least near to be maximized.
My Windows-C-Mex function FEX: WindowAPI cannot work with invisible figures also, because they are not found by the operating system and get a new HWnd handle when made visible again.
  댓글 수: 1
Jennifer
Jennifer 2011년 9월 15일
This routine is to be used in a face paced environment. The user needs to view plots, while others are "working" in the background. Having them maximize before going invisible will interrupt the user while they are viewing the current plot.
Your code solution would work, but I would rather the windows be maximized, rather than resized to fit the screen. The reason for this may seem a bit silly, but trust me. When a window is maximized you can quickly throw your mouse in the top corner and click to close. Whereas if it is simply the size of the screen, then throwing the mouse quickly in the top right corner and clicking will do nothing. I know the figure in question is invisible, but the option to make it visible is a possibility in future development.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by