Multiple windows in eclipse window builder

Jake Runzer picture Jake Runzer · Nov 15, 2012 · Viewed 21k times · Source

I am using Google Window Builder for eclipse to create the UI aspect of my program. I need to create a preferences window so that the user can change different settings for the program. I want the user to be able to press the 'preferences' button in the menu to bring up a separate window. The problem I am having is that I do not know how to create or add components to this separate window visually through Window Builder. Is there a way I can create a jpanel that is not a child of the main jframe program through Window Builder?

Answer

Emma Vartdal picture Emma Vartdal · Nov 15, 2012

Right click on the package where you want the file for the new window to be stored. Go "New -> Other" and select "WindowBuilder -> Swing Designer -> JDialog". Write in a name for the class of the new Window. That will bring up an editor, select "Design" tab at the bottom of the window. Now you can customize this new window.

To open this window from your main JFrame you'll need do this:

MyNewWindowClass newWindow = new MyNewWindowClass();
newWindow.setVisible(true);