New feature for SDK: AbstractControl + ButtonProperty

Hi guys,
I’d like to show you some simple ideas that could be added to the SDK to increase its functionality so that programmers don’t have to constantly write new editors. I have used the SDK a lot over the years, taking advantage of the built-in editor and AbstractControls to recreate the same functionality as the tutorials in Unity. One thing that is missing is the ability to create functions in the AbstractControls that are executable via clickable buttons.

Here’s the idea: could an annotation library be created to extend the functionality of the editor?
Here is an example:

  1. ButtonProperty
import java.lang.annotation.*;

public @interface ButtonProperty {

    String name() default "";
    String tooltip() default "";

  1. MyControl
public class MyControl extends AbstractControl {

    protected void controlUpdate(float tpf) {

    protected void controlRender(RenderManager rm, ViewPort vp) {
    @ButtonProperty(name="Click Me", tooltip="sayHello")
    public void sayHello() {
        System.out.println("Hello: " + MyControl.class.getSimpleName());

  1. UIBuilder

import java.lang.reflect.Method;
import org.apache.commons.lang3.reflect.MethodUtils;
import com.jme3.scene.control.Control;

import javax.swing.*;


    public static JPanel buildPanel(Control control) {

        JPanel container = new JPanel(false);
        container.setLayout(new MigLayout("fillx"));

        List<Method> methods = MethodUtils.getMethodsListWithAnnotation(control.getClass(), ButtonProperty.class);
        for (Method method : methods) {
            ButtonProperty bp = method.getAnnotation(ButtonProperty.class);
            JButton button = new JButton(;
            button.addActionListener(e ->  {
                try {
                } catch (ReflectiveOperationException ex) {
            container.add(new JLabel(""), "align righ");
            container.add(button, "wrap, pushx, growx");

        return container;

Here is the result in java-swing:

If the idea is feasible and there is interest in implementing it, then I will write another post for SerializeField and SerializableClass annotations.

Let me know what you think.



Hi guys,
any news about my proposal?

Thanks in advance.

I think it’s a great idea. I can also say I won’t be able to pick it up for the time being. I think it’s best to describe it in an issue on github, where it doesn’t get drowned in the forum and someone, some time may start working on it.


Hi @rickard,
I am happy to help. With some more functionality, I think the SDK can become an even more useful tool. I will take your advice and open an issue on the SDK to keep track of my proposal. I hope it can be added in the next release. I have done some testing with my Swing editor to provide code examples compatible with the SDK libraries. I hope it will be useful.

1 Like

Thanks. The SDK UI is plain Swing. So if there is any chance of contribution in the from of PRs, this would be absolutely golden.


Unfortunately, I am not able to modify the SDK. I do not exclude that I could learn how to do it in the future, but that would still take a long time, instead by teaming up and helping each other we could take the SDK to a higher level in a short time. At the moment the best I can do is to write a technical guide with pictures and code examples. Turning the idea into reality requires the help and experience of someone who knows the SDK. With the other two annotations I mentioned earlier “SerializeField” and SerializableClass" we can bring the AbstractControl editor to compete with Unity’s MonoBehaviour editor. IMO, this would allow more flexibility and extensibility of the SDK functions by increasing their use among community developers. Please help me make the dream a reality!

1 Like

Is there something specific blocking you in doing so [contributing actual code]? We would be happy to help.

I’m encouraging anyone to take a stab at it. Since there is nothing special. Surely my title/role here on the forums seems to be SDK developer. But to be honest, I don’t really have any special knowledge about it. I don’t even know my way around Swing that well. Last time I touched Swing has to be 20 years ago in university :smiley: What I’m saying that it would be roughly equal effort from me than it would be from you.

People are probably scared about the Netbeans part of it… There is usually very little of this if any. And there is no expert on this subject. Apache documentations and copy pasting, that is the trait secret right there :smiley:


I started dipping my toes by fixing some long standing gripes I had with the SDK. Little, specific, things that required changes to one class only. Try it! You must have something that has been troubling you for a long time and wished someone would fix. :slight_smile:


I strongly agree with your point of view. If the subclasses of AbstractController could have capabilities similar to extending editors in Unity3D, this would almost enable the SDK to achieve a workflow close to Unity3D development.

1 Like