I am looking to have all of the strings in a popupmenu centered in the menu. Now they are all left aligned and it just looks a little off.
Is there any way to do this easily?
I am looking to have all of the strings in a popupmenu centered in the menu. Now they are all left aligned and it just looks a little off.
Is there any way to do this easily?
You can do this via the java handle to the uicontrol. You can get the java handle using Yair's findjobj
utility from the file exchange.
p = uicontrol('style', 'popupmenu', 'String', {'item1', 'item2'}, 'Position', [0 0 200 30]);
jobj = findjobj(p);
renderer = jobj.getRenderer();
renderer.setHorizontalAlignment(renderer.CENTER);