Pages

Showing posts with label Background Color. Show all posts
Showing posts with label Background Color. Show all posts

Wednesday, December 4, 2013

How to Programatically Change the Background and Foreground Color of the Matlab Command Window

Reference: http://undocumentedmatlab.com/blog/changing-matlab-command-window-colors/

Code:

import com.mathworks.mde.cmdwin.CmdWinDocument.getInstance;
cmdWinDoc = com.mathworks.mde.cmdwin.CmdWinDocument.getInstance;
listeners = cmdWinDoc.getDocmentListeners;
for ii = 1:length(listeners)
    if ~isempty(regexp(char(listeners(ii).toString()),'JTextArea'))
        jTextArea = listeners(ii);
        break;
    end
end
jTextArea.setBackground(java.awt.Color.yellow);
jTextArea.setBackground(java.awt.Color(1,1,0));
set(jTextArea,'Background',[1,1,0]);
set(jTextArea,'Foreground',[0,1,1]);