MATLAB: UIComponent JTextField Text alignment

javaMATLABuicomponent

Hi,
I included Yair Altman's UICOMPONENT to place a Text Field on my figure like so:
myFigure=figure('position',[200,200,350,200]);
JTextField=uicomponent('Parent',myFigure,'style','JTextField',...
'position',[100,100,150,20],'Text','TestText','KeyTypedCallback',@testCallb);
Now I would like the Text to appear center-aligned.
How can I do that? I've been trying for hours yesterday and haven't figured it out yet.
Also, if you do know how, can you perhals also tell me, where I need to look to find out such things?
Many thanks!
BR, Michael

Best Answer

Use JTextField.JavaPeer.CENTER or the value 0 instead of 'CENTER':
JTextField.HorizontalAlignment = JTextField.JavaPeer.CENTER; % =0
Related Question