Matlab Custom Rich Text Editor

234 Views Asked by At

The following code creates a GUI with a rich text editor in Matlab (this is all undocumented features):

hFig = figure();
jCodePane = com.mathworks.widgets.SyntaxTextPane;
codeType = com.mathworks.widgets.text.mcode.MLanguage.M_MIME_TYPE;
jCodePane.setContentType(codeType)
jCodePane.setText('')
jScrollPane = com.mathworks.mwswing.MJScrollPane(jCodePane);
[jhPanel,hContainer] = javacomponent(jScrollPane,[10,10,300,100],hFig);
hContainer.Units = 'normalized';
hContainer.Position = [0 0 1 1];

As you can see in the screenshot below, when you type in the editor the text is formatted in Matlab style, this comes from the com.mathworks.widgets.text.mcode.MLanguage.M_MIME_TYPE command:

enter image description here

Does anyone know how to have a custom formatting? e.g. underline certain words, or bold etc....

The aim is to have a GUI where the user enters text and we could spell check it and highlight incorrect spelling (using a predefined dictionary).

0

There are 0 best solutions below