Set a new external Java look and feel, programmatic GUI

Hi guys!
I’m Luca an Italian mechanical engineer. These days I have tried to add the JTattoo look and feel in Matlab programmatic GUI R2015b but I have failed. I’m not an expertise of Java and I have tried your instructions on http://undocumentedmatlab.com/blog/modifying-matlab-look-and-feel without success.
---------------------------------------------------------------------
% A simple GUI script
function TestGUI ()
fig= figure ;
% Add the JTatto java library
folder = fileparts(mfilename('fullpath'));
javaclasspath( {folder, [folder '\JTattoo.jar']} );
newLnF = 'com.jgoodies.looks.plastic.Plastic3DLookAndFeel'; %string
javax.swing.UIManager.setLookAndFeel(newLnF);
jbutton = javax.swing.JButton('Java Button');
function placeJavaComponent ( jcomponent, position, parent )
jcomponent = javaObjectEDT( jcomponent ); % ensure component is auto-delegated to EDT
jcomponent.setOpaque(false); % useful to demonstrate L&F backgrounds
[jc,hContainer] = javacomponent( jcomponent, [], parent ); %#ok<ASGLU>
set(hContainer, 'Units','Normalized', 'Position',position);
end % placeJavaComponent
placeJavaComponent(jbutton,[0.1 0.8 0.8 0.07],fig );
drawnow;
originalLnF = javax.swing.UIManager.getLookAndFeel;
% Restore original L&F for other GUI
javax.swing.UIManager.setLookAndFeel(originalLnF)
end
---------------------------------------------------------------------
the above matlab script run without problem but if I set a JTattoo look and feel, for example
newLnF = 'com.jtattoo.plaf.smart.SmartLookAndFeel'; %string
javax.swing.UIManager.setLookAndFeel(newLnF)
I get this error:
---------------------------------------------------------------------------------------------------
Java exception occurred:
java.lang.ClassNotFoundException: com.jtattoo.plaf.smart.SmartLookAndFeel
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at javax.swing.SwingUtilities.loadSystemClass(Unknown Source)
at javax.swing.UIManager.setLookAndFeel(Unknown Source)
---------------------------------------------------------------------------------------------------
Surely Matlab have no idea where the selected look and feel are saved, and cannot point to it even if the JAR file is in the correct folder. Could you explain me how to solve this problem, It’s surely a trivial problem but don’t know how to solve it, I would appreciate very much.
Many thanks in advance
Luca Di Leta

Respuestas (1)

Image Analyst
Image Analyst el 29 de Mzo. de 2016
I haven't tried it personally yet, but maybe you'd like to try the new App Designer user interface builder tool: http://www.mathworks.com/products/matlab/app-designer/

5 comentarios

Luca Di Leta
Luca Di Leta el 29 de Mzo. de 2016
Editada: Luca Di Leta el 29 de Mzo. de 2016
Hi Image Analyst, tanks a lot for the answer, I will look surely this new app, but I want to find the solution to my problem because it would me allow more flexibility in programming, also should not be something impossible... anyway thanks for your answer
edit: app designer work only on r2014 and i have r2015b
Luca
Image Analyst
Image Analyst el 29 de Mzo. de 2016
Editada: Image Analyst el 29 de Mzo. de 2016
I believe it will work with R2015b. I know for a fact it works with R2016a because that's what I have. Type appdesigner on the command line and see if it comes up.
If you want undocumented ways of using Java, the place to go is Yair Altman's outstanding MATLAB site http://undocumentedmatlab.com/
Luca Di Leta
Luca Di Leta el 31 de Mzo. de 2016
Editada: Luca Di Leta el 31 de Mzo. de 2016
Hi image, i have tried but don't work. I know the "undocumented matlab" site but my problem it's not documented, it's only mentioned in the comments( http://undocumentedmatlab.com/blog/modifying-matlab-look-and-feel/ ). I have also downloaded the
that does what i try to do but i don't understand when in the code the look and feel are pointed, i have tried with only one look and feel but don't works :(
many tanks in advance
Luca
I'm not an expert in java and in using special java code in MATLAB. But Yair is, so that's why I referred you to him. Sorry, but good luck.
thank you anyway Image, I will try with Yair

Iniciar sesión para comentar.

Categorías

Más información sobre Environment and Settings en Centro de ayuda y File Exchange.

Productos

Preguntada:

el 29 de Mzo. de 2016

Comentada:

el 1 de Abr. de 2016

Community Treasure Hunt

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

Start Hunting!

Translated by