필터 지우기
필터 지우기

Image to java button

조회 수: 2 (최근 30일)
Rayane
Rayane 2013년 12월 24일
편집: Walter Roberson 2019년 5월 5일
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에서 Startup and Shutdown에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by