How to use WindowBuilder to edit JPanel in inner class

I would like to use WindowBuilder in Eclipse to create Swing GUIs. The JPanels I need to build will be inner classes in a shell without a GUI, for example:

public class MyWrapper extends MyBaseClass { ... class MyPanel extends JPanel { ... } } 

So my question is this: can I create a MyPanel using WindowBuilder? If so, how do I configure it?

If anyone is interested, the shell is an abstract base class, which the extension modules that I develop for my application should expand; deployment problems mean it’s not very practical to host GUIs in a separate JAR, so I pretty much need to do this.

My current workflow, which is terrible, is to create a GUI in NetBeans and insert the entire generated class into Eclipse, where I connect it to the methods in my wrapper. I really hope that WindowBuilder will allow me to work more reliably and efficiently if I can trick it into generating code in MyPanel, and not MyWrapper.

thanks

+4
source share
1 answer

It is not clear why JPanel should be an inner class. In general, this is not a good idea (in any case, you will get several .class files). JPanel should only be its own top-level class and refer to your wrapper class (all of them can be in one bank). WindowBuilder can easily be used to create / edit subclasses of JPanel (including those originally created using NetBeans), but it will only do this for top-level classes. This will not allow you to create / edit an inner class like this (which is completely intentional).

+2
source

Source: https://habr.com/ru/post/1333090/


All Articles