Third-party Java Swing components in CUBA

I have a third-party swing component Pivot table . Is it possible we can use it as 3rd party add-on in CUBA?

Hi,

you can add any swing library to Maven dependencies (you can do it using Advanced tab in Project Properties) of desktop module of your project and then use it in your desktop screens:


public class Screen extends AbstractWindow {
    @Inject
    private BoxLayout container;

    @Override
    public void init(Map<String, Object> params) {
        super.init(params);

         // obtain Swing implementation from CUBA component
        JPanel swingContainer = container.unwrap(JPanel.class);

        JSlider slider= new JSlider(JSlider.HORIZONTAL, 100, 0);
        CC cc = new CC();
        cc.width("300!");
        cc.growY(0.0f);
        // add JSlider with special MigLayout constraints
        swingContainer.add(slider, cc);
    }
}

CUBA Containers use MigLayout library thus you have to use MigLayout constraints (CC class) to be able to add Swing components to CUBA containers.

We have not tried to integrate JIDE Pivot table, but I suppose that it can be integrated in a similar way.