Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
set a figure always on the top of all the others

Subject: set a figure always on the top of all the others

From: Camille Couzi

Date: 23 Aug, 2010 21:15:23

Message: 1 of 3

Hi!
How can I set a figure to be always on top of all the others?
I have been seing WindowStyle, but I can't figure out if it is the apropriate thing I need...
Thanks a lot

Camille.

Subject: set a figure always on the top of all the others

From: Matthew Whitaker

Date: 26 Aug, 2010 22:55:25

Message: 2 of 3

"Camille Couzi" <camillecouzi@yahoo.fr> wrote in message <i4uoda$58a$1@fred.mathworks.com>...
> Hi!
> How can I set a figure to be always on top of all the others?
> I have been seing WindowStyle, but I can't figure out if it is the apropriate thing I need...
> Thanks a lot
>
> Camille.

If you have a reasonably recent version of Matlab (R2006b onward) this little hack should do it.
 f= figure;
j = get(f,'JavaFrame');
drawnow %importatnt for the next step
w = javaMethodEDT('getWindow',j.fFigureClient);
javaMethodEDT('setAlwaysOnTop',w,true)

Hope this helps
Matt W

Subject: set a figure always on the top of all the others

From: Igor

Date: 18 Jun, 2013 06:37:10

Message: 3 of 3

If someone is still looking how to do it, there's a FileExchange submission (using almost the same method as Matthew Whitaker proposed:
http://www.mathworks.com/matlabcentral/fileexchange/42252

"Matthew Whitaker" <mattlwhitaker@REMOVEgmail.com> wrote in message <i56rct$6ln$1@fred.mathworks.com>...
> j = get(f,'JavaFrame');
> drawnow %importatnt for the next step
> w = javaMethodEDT('getWindow',j.fFigureClient);
> javaMethodEDT('setAlwaysOnTop',w,true)

Tags for this Thread

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.

Contact us