Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: backgroundcolor of menubar and toolbar
Date: Mon, 29 Oct 2007 10:11:45 +0000 (UTC)
Organization: TACT Computer Systems Ltd
Lines: 53
Message-ID: <fg4bl1$8n$1@fred.mathworks.com>
References: <faeq5n$agk$1@fred.mathworks.com> <fg3div$mqv$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1193652705 279 172.30.248.35 (29 Oct 2007 10:11:45 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 29 Oct 2007 10:11:45 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 642467
Xref: news.mathworks.com comp.soft-sys.matlab:435037



"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