How to colorize the document tabs of the editor?

4 ビュー (過去 30 日間)
Ricardo.Neves
Ricardo.Neves 2018 年 5 月 24 日
回答済み: Yair Altman 2018 年 11 月 22 日
I often work with several .m files open simultaneously in the editor. Thus, it would be helpful to colorize the tabs of these .m files according to their directory location.
Up to matlab_2012a, this shared code (mathworks.com/matlabcentral/fileexchange/39157) use to do the job exactly as I wanted. Unfortunately, it does not work for my current matlab_2018a.
I tried to debug it, however I encountered a wall. With the following code I was able to change the background color of tabs all together:
desktop = com.mathworks.mde.desk.MLDesktop.getInstance;
jEditor = desktop.getGroupContainer('Editor').getTopLevelAncestor;
jh_gf = findjobj(jEditor,'-property',{'name','EditorGroupFrame'});
DocTab = jh_gf.getComponent(0).getComponent(1).getComponent(0).getComponent(0);
DocTab.setBackground(java.awt.Color(.8,.9,.9));
Now, my problem was when I tried to set the background color of each tab individually. My logic says that the following should work:
First_Tab = DocTab.getComponent(0);
First_Tab.setBackground(java.awt.Color(1,0,0));
Unfortunately it does not work. Anyone knows how to set the background color of each tab individually?
Thanks for the answers.

採用された回答

Yair Altman
Yair Altman 2018 年 11 月 22 日
I looked into this problem but I could not find a way to do so.
What you proposed is the way that it should have worked, but it seems that the com.mathworks.widgets.desk.DTDocumentTabs$Tab component ignores the Background/Foreground properties in its paintComponent(Graphics) method.

その他の回答 (1 件)

Image Analyst
Image Analyst 2018 年 5 月 24 日
Sounds like a question only Yair might be able to answer with anything other than a "No", which the rest of us would. See http://undocumentedmatlab.com/
  1 件のコメント
Ricardo.Neves
Ricardo.Neves 2018 年 5 月 28 日
Thank you for the referral.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by