Search code examples
javaeclipseswingwindowbuildervisual-editor

Is there a way to convert from Visual Editor created GUI to WindowBuilder GUI in Eclipse?


Since Visual Editor is no longer supported in newer versions of eclipse, I am trying to make the switch to WindowBuilder.

It seems that I should just be able to open a panel created in Visual Editor in WindowBuilder and all components should display, but this does not seem to be the case. All components sizes seem to come in as 0px x 0px and even after changing this, the components still do not show up in the preview window.

All components are custom that extend the standard JComponent (such as JLabel).

I am not sure if the problem is some sort of incompatibility, the fact that I am using custom components and containers, or a problem with my WindowBuilder installation (or something else!). Does anyone have any insight? I would be much appreciated! :)


Solution

  • After working on this problem for some time I have found out what was causing the errors. It seems that Visual Editor was a bit more forgiving when parsing the code to display the preview.

    My issues with Window Builder generally stemmed from the following things:

    • lack of paramterless contructors in both the panel/dialog to be displayed and components within. WB relies on these constructors to parse the code
    • trouble getting dynamically generated resources which led to throwing null pointer exceptions. Visual Editor seemed to ignore these and display what it could. Window Builder would not display any part of the offending component. Adding null checks in certain places remedied this.

    After fixing these problems, I did not have to recreate any of my GUI screens in Window Builder