Quantcast
Viewing latest article 2
Browse Latest Browse All 18

Re: Customizing check boxes

"Joel Marchand" wrote in message <kvoba2$r9i$1@newscl01ah.mathworks.com>...
> By default, MATLAB places the label of a check-box to the right of the associated check-box. To make the check-box align with other controls, I would like to place the check-box to the right of it's label. Is there a way to do this without creating a separate label (static text box), or having to dig into the Java code?
>
> MATLAB Default:
> [Checkbox] Label
>
> What I want:
> Label [Checkbox]
>
> I am using MATLAB 2013A on Windows XP SP3.
> I am NOT using GUIDE to build my interface.


This can only be done using Java. You have 2 options:
1. Use findjobj (http://www.mathworks.com/matlabcentral/fileexchange/14317) to get the uicontrol's underlying Java component and then set its HorizontalTextPosition and HorizontalAlingment properties. This is described in section 6.4 of my book.
2. Create a new JCheckbox component, set its properties accordingly, then use the javacomponent function (http://undocumentedmatlab.com/blog/javacomponent) to place it in the Matlab figure.

Yair Altman
http://UndocumentedMatlab.com
Read my book: Undocumented Secrets of MATLAB-Java Programming
 

Viewing latest article 2
Browse Latest Browse All 18

Trending Articles