Question

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! :)

Was it helpful?

Solution 3

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

OTHER TIPS

If I understand your question correctly, all you'd have to do is right click the class in the package explorer > Open with > WindowBuilder Editor

I have found that sometimes the code doesn't transfer over nicely when trying to directly re-open the file using the WindowBuilder editor. I found that creating a new WindowBuilder document of the same type as your existing code, then replacing the file contents works pretty well, if you don't mind the inconvenience.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top