Add an external Java bean

Hi, is it possible to add an external Java bean in a Servoy form? I’d like to use SteppedComboBox.java in my form because of its key listeners. How can I do this and redraw the form?

Any input is highly appreciated.

this basic bean, just package it as a bean and drop the jar in your bean folder and then you can drop the bean on your form.

I copied the downloaded and compiled the SteppedCombobox.java with the commands below.

javac SteppedCombobox.java
jar cvf SteppedCombobox.jar SteppedCombobox.class

The commands above worked perfectly and so I placed the SteppedCombobox.jar in my application server’s bean folder together with IClock, browser_suite, etc.

When I open a form at design time, I couldn’t find the SteppedCombobox at the left portion of Servoy IDE where beans are listed. Should I see it already in Java Beans tab? Did I miss out any step?

Hi

The external java beans are hidden from the palette by default.

If you right click anywhere in the palette and select configure, you will be able to un hide the java beans folder.

Regards

as i said you have to package it as a bean, look for example at the MANIFEST.MF file inside the iclock example:

Name: com/ibm/clock/IClock.class
Java-Bean: True

and that needs to be done so that servoy sees it as a bean.

I still couldn’t see it. Attached is my custom java bean.

SteppedComboBox.jar (1.06 KB)

The MANIFEST.MF structure in your jar is wrong.

In your case it should be:

Manifest-Version: 1.0
Created-By: 1.6.0_16 (Sun Microsystems Inc.)

Java-Bean: True
Name: SteppedComboBox.class

You should also add a few line breaks after the last name, otherwise the bean parser might not see it correctly.

Also note that using the default package in Java is bad practice. You should put your class in a package of its own to avoid class name collisions.

See my tutorials on ServoyForge about beans: Files - Servoy-Stuff Tutorials - ServoyForge

Hi,

I still can’t see the bean in Servoy IDE. I have revised the jar file to add package naming.

I compiled the java class, compressed into a jar file, updated the manifest file, and dropped it into my Servoy app beans folder.

Did I miss out anything?

SteppedCombobox.jar (1.1 KB)

Have you considered hiring Patrick Talbot for a training and help? Might be a much faster way to get it working.

Yes, It seems you would need to better understand how it’s done.

For now, I can see that your class is SteppedCombobox, yet you declare SteppedComboBox.class in your manifest:
SteppedCombobox != SteppedComboBox

Hi Jan, if this cannot be resolved in the forum, it means it’s too complicated and that would mean a red light for me. I would need to take a u-turn Thanks.

Erik,
The forum is a great place to ask questions but it is not a university. It is pretty clear that a trained Java developer can create and use beans in Servoy with the supplied documentation so I fail to understand why this would be a red light. There’s nothing wrong with getting trained and in particular not by the master of beans Patrick himself! Servoy has always made clear that if you want to create your own Javabeans you need to have a good understanding of Javabeans.

ptalbot:
Yes, It seems you would need to better understand how it’s done.

Jan Aleman:
Erik,
The forum is a great place to ask questions but it is not a university. It is pretty clear that a trained Java developer can create and use beans in Servoy with the supplied documentation so I fail to understand why this would be a red light. There’s nothing wrong with getting trained and in particular not by the master of beans Patrick himself! Servoy has always made clear that if you want to create your own Javabeans you need to have a good understanding of Javabeans.

We appreciate you offer of help, Jan, Patrick.
The question about the SteppedComboBox was asked more out of curiosity rather than business necessity.
We aim to use as many of Servoy tools as we can without having to call for external beans/plugins because Servoy is already providing alternative ways of doing pretty much all we need.
Thanks again for advice, we might take you up on that offer sometime later :)

Cheers,
Maria