I have a GUI with big buttons and wouls like to align the text in the button to the top, all I found is "horizontal alignment" property. Thanks...
btn = uibutton creates a push button in a new figure and returns the Button object. MATLAB® calls the uifigure function to create the figure. btn = uibutton( style ) creates a button of the specified style. btn = uibutton( parent ) creates the button in the specified parent container.
To align text using the alignment buttons:Left-align text: Word's default lines up objects to the left with a ragged right edge. Center text: This centers selected text, numbers, and inline objects. Right-align text: Selected text, numbers, and inline objects are aligned to the right with a ragged left edge.
newStr = strjust( str ) returns a right-justified version of the text in str .
You need to access the underlying Java Swing component (I am using FINDJOBJ function):
figure('Menubar','none', 'Position',[200 200 300 200])
h = uicontrol('Style','pushbutton', 'String','click', ...
'Units','normalized', 'Position',[0.3 0.3 0.5 0.5]);
jh = findjobj(h);
jh.setVerticalAlignment( javax.swing.AbstractButton.BOTTOM );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With