How to create GUI as inner class with WindowBuilder

Posted by Tim Kemp on Stack Overflow See other posts from Stack Overflow or by Tim Kemp
Published on 2010-12-22T19:50:22Z Indexed on 2010/12/22 19:54 UTC
Read the original article Hit count: 189

I would like to use WindowBuilder in Eclipse to construct Swing GUIs. The JPanels I need to build will be inner classes in a non-GUI wrapper, like so:

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

So my question is this: can I construct MyPanel using WindowBuilder? If so, how should I set it up?

If anyone is interested, the wrapper is an abstract base class which the plug-ins I am developing for my app must extend; deployment concerns mean that it's not really practical to put the GUIs in a separate JAR either so I pretty much have to do it this way.

My current workflow, which is awful, is to build the GUI in NetBeans and paste the entire generated class into Eclipse where I connect it up to the methods in my wrapper. I am very hopeful that WindowBuilder will let me work more reliably and efficiently if I can trick it into generating code in MyPanel, not MyWrapper.

Thanks

© Stack Overflow or respective owner

Related posts about java

Related posts about eclipse