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:
backgroundcolor of menubar and toolbar

Subject: backgroundcolor of menubar and toolbar

From: Jette

Date: 21 Aug, 2007 13:43:19

Message: 1 of 3

Hi,

I wonder whether there is a way to change the
backgroundcolor of a figure's menubar and toolbar? Both
seem to depend on the user's Windows settings (classical
style versus XP style) which I don't like. I would like to
set it to the same color as the figure's color.

Thanks for any hints.

Jette

Subject: backgroundcolor of menubar and toolbar

From: Craig Hamilton

Date: 29 Oct, 2007 01:38:39

Message: 2 of 3

"Jette " <jette.schroeder@web.de> wrote in message
<faeq5n$agk$1@fred.mathworks.com>...
> Hi,
>
> I wonder whether there is a way to change the
> backgroundcolor of a figure's menubar and toolbar? Both
> seem to depend on the user's Windows settings (classical
> style versus XP style) which I don't like. I would like
to
> set it to the same color as the figure's color.
>
> Thanks for any hints.
>
> Jette
>

I would love to see an answer to this question....
anyone, anyone, Bueller???

Subject: backgroundcolor of menubar and toolbar

From: Yair Altman

Date: 29 Oct, 2007 10:11:45

Message: 3 of 3

"Craig Hamilton" <crhamilt.nospam@wfubmc.edu> wrote in
message <fg3div$mqv$1@fred.mathworks.com>...
> "Jette " <jette.schroeder@web.de> wrote in message
> <faeq5n$agk$1@fred.mathworks.com>...
> > Hi,
> >
> > I wonder whether there is a way to change the
> > backgroundcolor of a figure's menubar and toolbar? Both
> > seem to depend on the user's Windows settings (classical
> > style versus XP style) which I don't like. I would like
> to
> > set it to the same color as the figure's color.
> >
> > Thanks for any hints.
> >
> > Jette
> >
>
> I would love to see an answer to this question....
> anyone, anyone, Bueller???


Another one of those challenges that I simply cannot resist...

The following is entirely unsupported, undocumented, but
works on Matlab 7+:

1. Download my FindJObj utility from the File Exchange:
http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=14317

2. run the following:

c = get(gcf,'color');

% set the figure menu bg color
hmb=findjobj(gcf,'class','FigureMenuBar');
for idx=0:hmb.getComponentCount-1
  hm=hmb.getComponent(idx);
  hm.setBackground(java.awt.Color(c(1),c(2),c(3)));
end
for idx=0:hmb.getParent.getComponentCount-1
  hm=hmb.getParent.getComponent(idx);
  hm.setBackground(java.awt.Color(c(1),c(2),c(3)));
end

% set the figure toolbar bg color
htb=findjobj(gcf,'class','MJToolbar');
htb=findjobj(htb(1)); % get all decendents...
set(htb,'background',java.awt.Color(c(1),c(2),c(3)));

Yair Altman
http://ymasoftware.com

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