Thread Subject: set(get(gcf,'JavaFrame'),'Maximized',1)

Subject: set(get(gcf,'JavaFrame'),'Maximized',1)

From: Yoav Mor

Date: 29 May, 2007 09:52:25

Message: 1 of 5

I'm trying to load a maximized figure. Adding Yair Altman's hack to
the openingFcn function:
set(get(gcf,'JavaFrame'),'Maximized',1);
or even manually changing the size of the figure from within the
openingFcn does indeed work, but only for a few miliseconds because
later on later on gui_mainfcn continues, which in turn calls
movegui('onscreen'), and that, in line 185 of movegui.m [Matlab
r2007a] defines a margin of 30 pixels from the left hand side of the
screen. Hence the figure is again resized and it no longer remains
maximized.

Annoying, to say the least.

Any known hack for this?

Thanks...

Yoav.

Subject: set(get(gcf,'JavaFrame'),'Maximized',1)

From: Yair Altman

Date: 29 May, 2007 12:06:20

Message: 2 of 5

Yoav Mor wrote:
>
> I'm trying to load a maximized figure. Adding Yair Altman's hack to
> the openingFcn function:
> set(get(gcf,'JavaFrame'),'Maximized',1);
> or even manually changing the size of the figure from within the
> openingFcn does indeed work, but only for a few miliseconds because
> later on later on gui_mainfcn continues, which in turn calls
> movegui('onscreen'), and that, in line 185 of movegui.m [Matlab
> r2007a] defines a margin of 30 pixels from the left hand side of
> the screen. Hence the figure is again resized and it no
> longer remains maximized.
>
> Annoying, to say the least.
>
> Any known hack for this?
>
> Thanks...
>
> Yoav.
  

Try placing this in your openingFcn:

%timerFcn = 'set(get(gcf,''JavaFrame''),''Maximized'',1)';
timerFcn = @(o,e)
set(get(get(o,'userdata'),'JavaFrame'),'Maximized',1);
start(timer('StartDelay',5,'Userdata',gcf,'TimerFcn',timerFcn));

(Modify the 5-secs timer startup delay to whatever fits your needs)

Yair

Subject: set(get(gcf,'JavaFrame'),'Maximized',1)

From: matt dash

Date: 29 May, 2007 15:29:02

Message: 3 of 5

im not sure about the whole maximization business, but you can avoid
the annoying 30 pixel border by defining a gui_LayoutFcn up in the
"do not edit" part of the m-file (assuming you used guide to make the
gui)

example:
gui_State = struct('gui_Name', mfilename, ...
    'gui_Singleton', gui_Singleton, ...
    'gui_OpeningFcn', @test_OpeningFcn, ...
    'gui_OutputFcn', @test_OutputFcn, ...
    'gui_LayoutFcn', @test_Layout , ...
    'gui_Callback', []);
  
then add the following function to your mfile:
function h=test_Layout(varargin)
h=openfig('test.fig','new','invisible');

this is just the default figure opening command that your gui
normally uses, but by having it defined in the layout function it
will bypass the annoying resizing.

ps, i start it out invisible and then at the end of the OpeningFcn
turn visibility on to avoid it flickering while it loads. (tested in
2006 a,b)

Subject: set(get(gcf,'JavaFrame'),'Maximized',1)

From: Yoav Mor

Date: 30 May, 2007 03:33:49

Message: 4 of 5

Thanks matt!

That's the best solution I've found so far!
Works like a charm!

Thanks again,
Yoav.

 matt dash wrote:
>
>
> im not sure about the whole maximization business, but you can
> avoid
> the annoying 30 pixel border by defining a gui_LayoutFcn up in the
> "do not edit" part of the m-file (assuming you used guide to make
> the
> gui)
>
> example:
> gui_State = struct('gui_Name', mfilename, ...
> 'gui_Singleton', gui_Singleton, ...
> 'gui_OpeningFcn', @test_OpeningFcn, ...
> 'gui_OutputFcn', @test_OutputFcn, ...
> 'gui_LayoutFcn', @test_Layout , ...
> 'gui_Callback', []);
>
> then add the following function to your mfile:
> function h=test_Layout(varargin)
> h=openfig('test.fig','new','invisible');
>
> this is just the default figure opening command that your gui
> normally uses, but by having it defined in the layout function it
> will bypass the annoying resizing.
>
> ps, i start it out invisible and then at the end of the OpeningFcn
> turn visibility on to avoid it flickering while it loads. (tested
> in
> 2006 a,b)

Subject: set(get(gcf,'JavaFrame'),'Maximized',1)

From: Huy

Date: 11 Dec, 2007 14:12:20

Message: 5 of 5

Let's try this source code.

jf =get(gcf,'JavaFrame');
jf.fClientProxy.getFrameProxy.getClientFrame.setMaximized(1)

It works.

Best wishes,

Huy Phan

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
undocumented Scott Hirsch 2 Jun, 2008 17:25:16
javaframe setmaximized Anh Huy Phan 11 Dec, 2007 09:15:09
undocumented Yair Altman 22 Sep, 2007 18:20:05
rssFeed for this Thread

Public Submission Policy

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.

Contact us at files@mathworks.com