I want to change the appearance of a Matlab pushbutton with Java. For it, I use the application Findjobj. However, because of I do not know Java, I have troubles to use Java classes properly that I need to get my button has rounded corners. Based on the information found here), I have tried to set up the button with the class BorderFactory:
hButton = uicontrol('string','click me!');
jButton = findjobj(hButton);
jButton.setCursor(java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jButton.setBorder(BorderFactory.createLineBorder(red,1,true));
But this does not work. I got the following error message:
??? Undefined function or variable 'red'.
Error in ==> de at 4
jButton.setBorder(BorderFactory.createLineBorder(red,1,true));
EDIT: I realize I forgot to include the Java classes for color and LineBorder. After fixing it, the code looks like this:
import java.awt.Color;
import javax.swing.border.LineBorder;
hButton = uicontrol('Style','pushbutton','String','click me!',...
'Units','normalized','Position',[0.156 0.64 0.688 0.1],'FontSize',9,...
'ForegroundColor','w','BackgroundColor','k');
jButton = findjobj(hButton);
jButton.setCursor(java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jButton.setBorder(LineBorder(Color.white,5,true));
However, the result still be unpleased for me. Here is the final appearance. I can get the corners to be rounded.