Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Plot window maximised

4 views
Skip to first unread message

n o s p a m p l e a s e

unread,
Nov 28, 2007, 4:26:38 AM11/28/07
to
When I execute plot(x,y), the plot window opens in normal model.

I want it to open in maximized mode. How can I do this? I am running
Matlab 2007a.

Huy

unread,
Nov 28, 2007, 7:12:31 AM11/28/07
to
n o s p a m p l e a s e <nospam...@alum.com> wrote in
message <87e0922f-8a41-4207-947b-
9f96c4...@e6g2000prf.googlegroups.com>...

you can do like that

fig = figure
set(fig,'units','normalized','outerposition',[0 0 1 1]);

plot(x,y)

By the way, you could find more detail with key word:
maximized window figure in search section.

Huy

unread,
Dec 11, 2007, 9:14:41 AM12/11/07
to
n o s p a m p l e a s e <nospam...@alum.com> wrote in
message <87e0922f-8a41-4207-947b-
9f96c4...@e6g2000prf.googlegroups.com>...

Here is another pretty code:

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


Miroslav Balda

unread,
Dec 11, 2007, 5:04:41 PM12/11/07
to
"Huy " <phana...@mathworks.com> wrote in message
<fjm60h$5d3$1...@fred.mathworks.com>...
Hi,

the simplest way how to place figure window on the full
screen is to call "fig(5);"

function fig.m for figure window placement in the coded
position can be found in FEX Id: 9035.

Mira

Miroslav Balda

unread,
Dec 11, 2007, 5:04:41 PM12/11/07
to
"Huy " <phana...@mathworks.com> wrote in message
<fjm60h$5d3$1...@fred.mathworks.com>...

Miroslav Balda

unread,
Dec 11, 2007, 5:04:42 PM12/11/07
to
"Huy " <phana...@mathworks.com> wrote in message
<fjm60h$5d3$1...@fred.mathworks.com>...

Paul Mennen

unread,
Dec 11, 2007, 6:31:57 PM12/11/07
to
"Miroslav Balda" wrote

> > > I want it to open in maximized mode.

> Here is another pretty code:


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

I couldn't get that to work (in R2007b).
For the first line, I get

jf = com.mathworks.hg.peer.FigurePeer@1a8a9e7

And then the 2nd line gives me this error:

??? No appropriate method or public field com for class
com.mathworks.hg.peer.FigurePeer.

> the simplest way how to place figure window on the full

> screen is to call "fig(5);" (FEX Id: 9035.)

As Einstein said, things should be as simple as possible
but no simpler. This one is too simple. Perhaps this can
be done with some complex .m code, I don't know. For one
thing the .48 constant is not going to work for all screen
resolutions and configurations. To make matters worse, you
don't want the figure to overlap the task bar, and you
don't know where that is (top, bottom, left, right), nor
how big it is.

I wish I had a .m routine that could do this, but so far
I haven't found it. Now I do this with the
winshowwin(figHandle,'maximize') function which is part
of the Mpacks package from www.soundslogical.com.
(Its primary drawback is that it costs $40)

~Paul

Yair Altman

unread,
Dec 12, 2007, 4:31:14 AM12/12/07
to
"Paul Mennen" <nos...@mennen.org> wrote in message
<fjn6ld$dhf$1...@fred.mathworks.com>...

> "Miroslav Balda" wrote
> > > > I want it to open in maximized mode.
>
> > Here is another pretty code:
> > jf =get(gcf,'JavaFrame');
> > jf.fClientProxy.getFrameProxy.
> getClientFrame.setMaximized(1)
>
> I couldn't get that to work (in R2007b).
> For the first line, I get
>
> jf = com.mathworks.hg.peer.FigurePeer@1a8a9e7
>
> And then the 2nd line gives me this error:
>
> ??? No appropriate method or public field com for class
> com.mathworks.hg.peer.FigurePeer.


Here's a small fix for R2007b:

jf=get(gcf,'JavaFrame');
awtinvoke(jf.fFigureClient.getFrameProxy,'setMaximized(Z)',1);

Yair Altman
http://ymasoftware.com

Huy

unread,
Dec 12, 2007, 6:33:07 AM12/12/07
to
"Yair Altman" <altma...@gmailDEL.comDEL> wrote in message
<fjo9p2$n7g$1...@fred.mathworks.com>...


Thanks Yair Altman! You're right.

In MATLAB Version 7.1 (R14) (or older), we use

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


and in MATLAB Version 7.2.(R2006a) (or later), we have

awtinvoke(jf.fFigureClient.getFrameProxy,'setMaximized(Z)',1);

or

jf.getFigurePanelContainer.getComponent(0).getTopLevelAncestor.setMaximized(1)


Anh Huy Phan

RIKEN - BSI

Stephan Hoffmann

unread,
Dec 14, 2007, 8:49:01 AM12/14/07
to
Instead of:

> jf=get(gcf,'JavaFrame');
>
> awtinvoke(jf.fFigureClient.getFrameProxy,'setMaximized
(Z)',1);

you could also use:

set(jf,'Maximized',1);

Best regards,
Stephan Hoffmann

Stephan Hoffmann

unread,
Dec 14, 2007, 8:49:57 AM12/14/07
to

Marcelo Soto-Thompson

unread,
Oct 23, 2008, 5:07:02 PM10/23/08
to
Running Stephan's code I get:
Exception in thread "AWT-EventQueue-0" java.lang.Error: FigureFrame object is NULL at com.mathworks.hg.peer.FigureFrameProxy.getClientFrame(FigureFrameProxy.java:195) at com.mathworks.hg.peer.FigureFrameProxy.setMaximized
... and a bunch of other similar error messages

Running Yair's code(s):
jf.getFigurePanelContainer.getComponent(0).getTopLevelAncestor.setMaximized(1)
Results in:
??? Attempt to reference field of non-structure array.

Code:
awtinvoke(jf.fFigureClient.getFrameProxy,'setMaximized(Z)',1);
jf.getFigurePanelContainer.getComponent(0).getTopLevelAncestor.setMaximized(1)

Results in:
Exception while dispatching java method:
java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
... and a slew of similar messages

I'm running version 7.5.0.342 (R2007b) on Win Xp and I know zip about java programming. ;-)

Thanks


Marcelo Soto-Thompson

unread,
Oct 23, 2008, 5:20:20 PM10/23/08
to
Weird..

I can get the code to work if I run it line by line in the command window NOT if run it from within a script or a function.

Yair Altman

unread,
Oct 23, 2008, 5:36:02 PM10/23/08
to
"Marcelo Soto-Thompson" <mar...@sti-hawaii.com> wrote in message <gdqp1m$t73$1...@fred.mathworks.com>...
> <snip java error msgs>

> I'm running version 7.5.0.342 (R2007b) on Win Xp and I know zip about java programming. ;-)

The reason is that using jf (the Java Frame) requires the figure window to be visible, and in your code you probably try to maximize the window while its 'visible' property is 'off'.

Yair Altman

Marcelo Soto-Thompson

unread,
Oct 24, 2008, 5:30:20 PM10/24/08
to
"Yair Altman"
> The reason is that using jf (the Java Frame) requires the figure window to be visible, and in your code you probably try to maximize the window while its 'visible' property is 'off'.
>
> Yair Altman

The figure's visible property is 'on'.

However, by adding a pause before retrieving the JavaFrame handle the code suddenly worked...

h = figure;
pause(0.01) %<== Adding this line made it all work...
jf=get(h,'JavaFrame');
set(jf,'Maximized',1);

I have no clue why it worked but sometimes, I guess, ignorance is bliss.

Thanks guys!

Mohamed Asheik

unread,
Oct 25, 2008, 10:07:01 AM10/25/08
to
try this,

figure('name',mfilename,...
'NumberTitle','off','Position',[20 20 700 500],...
'Color',[0.45 0.25 .05]);

0 new messages