Image to java button

1 次查看(过去 30 天)
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 )

采纳的回答

Image Analyst
Image Analyst 2013-12-24
编辑:Image Analyst 2013-12-24
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 个)

类别

Help CenterFile Exchange 中查找有关 Java Package Integration 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by