Image to java button
1 view (last 30 days)
Show older comments
I have multiple questions to ask considering Matlab use
Thank you in advance
Prog Description:
-I am creating a prog that draws the influence line of a : Beam, Truss and Frame
-I have a Main menu in which there are 3 buttons -When the user clicks a button another matlab proj opens
My questions are:
1-How can I put an image background to a java button here's my button :
btLinePropsPos = [0.1,0.6,0.32,0.2];
btLineprops = com.mathworks.mwswing.MJButton('Beam');
btLineprops.setBorder([]);
uiColor = get(handles.figure1,'Color');
btLineprops.setBackground(java.awt.Color(uiColor(1),uiColor(2),uiColor(3)));
btLineprops.setFont(java.awt.Font('Vivaldi',java.awt.Font.PLAIN,60))
btLineprops.setCursor(java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
btLineprops.setFlyOverAppearance(true);
btLineprops.setToolTipText('Modify properties of plot lines');
[dummy,btContainer] = javacomponent(btLineprops,[0 0 1 1]); %#ok
set(btContainer, 'Units','Norm', 'Position',btLinePropsPos);
set(btLineprops, 'ActionPerformedCallback',@beamCallback);
2-When the user opens the project related to beam button for example, how can I forbid him from opening it another time ? (I want the beam project to be opened only one time on button click from main menu if it is open )
0 Comments
Accepted Answer
Image Analyst
on 24 Dec 2013
Edited: Image Analyst
on 24 Dec 2013
Here's the official Mathworks solution: http://www.mathworks.com/matlabcentral/answers/98593-how-do-i-display-an-image-on-a-gui-component-eg-pushbutton
For your #2. Just set a flag
global userOpenedBeam;
userOpenedBeam = true;
and check it wherever you need to
global userOpenedBeam;
if userOpenedBeam
uiwait(warndlg('You cannot open beam project again!'));
return;
end
0 Comments
More Answers (0)
See Also
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!