Effacer les filtres
Effacer les filtres

Image to java button

2 vues (au cours des 30 derniers jours)
Rayane
Rayane le 24 Déc 2013
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 )

Réponse acceptée

Image Analyst
Image Analyst le 24 Déc 2013
Modifié(e) : Image Analyst le 24 Déc 2013
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

Plus de réponses (0)

Catégories

En savoir plus sur Startup and Shutdown dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by