Image to java button
조회 수: 2 (최근 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 )
댓글 수: 0
채택된 답변
Image Analyst
2013년 12월 24일
편집: Image Analyst
2013년 12월 24일
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!