Discussion:
Ribbon UI in figure GUI (using java & Flamingo)
(too old to reply)
Yoav Mor
2012-12-24 12:15:11 UTC
Permalink
I've been trying to add a ribbon UI to my figure GUI and I made some progress.
First, I downloaded Flamingo jar file from here:
http://www.shemnon.com/speling/

Then I did :
javaaddpath('flamingo-6.3.jar');
jR = org.pushingpixels.flamingo.api.ribbon.JRibbon();
f = figure('units','pixels');
pos = get(f,'position');
mypanel = javax.swing.JPanel(java.awt.BorderLayout);
mypanel.add(jR);
jR.setVisible(true);
[obj, hcontainer] = javacomponent(mypanel, [0,0,pos(3:4)], f);

This actually works and shows an empty ribbon...
Now I'm trying to add the actual ribbon band with the buttons and I can't seem to figure out how to do in using the Java / Matlab interface.

I found a tutorial here:
http://java.dzone.com/articles/flamingo-tutorial

If anyone could lend me a hand, I'd be very grateful...

Thanks.
Y.
Yoav Mor
2012-12-26 11:49:07 UTC
Permalink
I'm so close!

I had an email exchange with the "java King" Yair Altman who recommended going for the matlab undocumented toolstrip. Since neither are documented and I have no idea how to make it look normal, I decided to see if I can still figure this one out using Flamingo...
(Until someone will decide to document things properly or to add them to Matlab).

So here's my code so far:

jR = org.pushingpixels.flamingo.api.ribbon.JRibbon();

roundButton = org.pushingpixels.flamingo.api.ribbon.RibbonApplicationMenu();
jR.setApplicationMenu(roundButton);

f = figure('units','pixels');
pos = get(f,'position');

mypanel = javax.swing.JPanel(java.awt.BorderLayout);
mypanel.add(jR);
jR.setVisible(true);
[obj, hcontainer] = javacomponent(mypanel, [0,0,pos(3:4)], f);

jRB1 = org.pushingpixels.flamingo.api.ribbon.JRibbonBand('Hello',[]);
jRB2 = org.pushingpixels.flamingo.api.ribbon.JRibbonBand('World',[]);

policy1 = org.pushingpixels.flamingo.api.ribbon.resize.IconRibbonBandResizePolicy(jRB1.getControlPanel());
policy1_List=java.util.ArrayList();
policy1_List.add(policy1);
jRB1.setResizePolicies(policy1_List);

policy2 = org.pushingpixels.flamingo.api.ribbon.resize.IconRibbonBandResizePolicy(jRB2.getControlPanel());
policy2_List=java.util.ArrayList();
policy2_List.add(policy2);
jRB2.setResizePolicies(policy2_List);

JRT = org.pushingpixels.flamingo.api.ribbon.RibbonTask('One',jRB2);

%%%%

this is my attempt to follow the tutorial of Flamingo here:
http://java.dzone.com/articles/flamingo-tutorial

Unfortunately, I'm stuck at that last line there.
I have no idea why it's returning an error, it's supposed to work...!

If someone will figure this one out, it could be great...
Ramiro Massol
2014-01-10 18:35:09 UTC
Permalink
hi Yoav
I just found your comments about implementing a ribbon. I'm also interested in this new type of toolbar and I'd love to be able to add it to my GUIs. I followed your steps but I got an unexpected error in:

jRB1 = org.pushingpixels.flamingo.api.ribbon.JRibbonBand('Hello',[]);


Error:
Java exception occurred:
java.lang.NoClassDefFoundError: org/pushingpixels/trident/callback/TimelineCallback

at
org.pushingpixels.flamingo.api.ribbon.AbstractRibbonBand.updateUI(AbstractRibbonBand.java:246)

at
org.pushingpixels.flamingo.api.ribbon.AbstractRibbonBand.<init>(AbstractRibbonBand.java:206)

at org.pushingpixels.flamingo.api.ribbon.JRibbonBand.<init>(JRibbonBand.java:169)

at org.pushingpixels.flamingo.api.ribbon.JRibbonBand.<init>(JRibbonBand.java:154)

Caused by: java.lang.ClassNotFoundException:
org.pushingpixels.trident.callback.TimelineCallback

at java.net.URLClassLoader$1.run(Unknown Source)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(Unknown Source)

at com.mathworks.jmi.CustomURLClassLoader.findClass(ClassLoaderManager.java:760)

at java.lang.ClassLoader.loadClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

at java.lang.ClassLoader.loadClassInternal(Unknown Source)

... 4 more


Have you had this before? Have you been able to implement the ribbon layout? Please help!
best
ramiro
Post by Yoav Mor
I've been trying to add a ribbon UI to my figure GUI and I made some progress.
http://www.shemnon.com/speling/
javaaddpath('flamingo-6.3.jar');
jR = org.pushingpixels.flamingo.api.ribbon.JRibbon();
f = figure('units','pixels');
pos = get(f,'position');
mypanel = javax.swing.JPanel(java.awt.BorderLayout);
mypanel.add(jR);
jR.setVisible(true);
[obj, hcontainer] = javacomponent(mypanel, [0,0,pos(3:4)], f);
This actually works and shows an empty ribbon...
Now I'm trying to add the actual ribbon band with the buttons and I can't seem to figure out how to do in using the Java / Matlab interface.
http://java.dzone.com/articles/flamingo-tutorial
If anyone could lend me a hand, I'd be very grateful...
Thanks.
Y.
Loading...