IntelliJ IDEA plug-in | JFormDesigner – Java/Swing GUI Designer

Documentation

IntelliJ IDEA plug-in

This plug-in integrates JFormDesigner into
Jetbrains
IntelliJ IDEA (Community and Ultimate
Editions).

Benefits

Using this plug-in has following benefits compared to JFormDesigner stand-alone
edition:

  • Fully integrated as editor for JFormDesigner .jfd files. Create and design
    forms within IntelliJ IDEA. No need to switch between applications.
  • Uses the source folders and classpath of the current IntelliJ IDEA
    project/module. No need to specify them twice.
  • The Java code generator updates the .java file in-memory on each change in
    the designer. You can design forms and edit its source code without the need
    to save them (as necessary when using JFormDesigner stand-alone edition).
  • Folding of generated GUI code in Java editor.
  • Go to event handler method in Java editor.
  • Two-way synchronization of localized strings in designer and in properties
    file editors. Changing localized strings in the designer immediately updates
    the .properties file in-memory and changing the .properties file updates the
    designer.
  • Copy needed libraries (MigLayout, JGoodies Forms, TableLayout, etc) to the
    project and add them to the classpath of the current IntelliJ IDEA
    project/module. Optionally include source code and Javadoc.
  • Assign shortcut keys to most JFormDesigner commands in IntelliJ IDEA’s
    keymap settings.

User interface¶

The screenshot below shows the IntelliJ IDEA main window editing a JFormDesigner
form.

IntelliJ IDEA main window

A JFormDesigner editor consists of:

  • Toolbar: Located at top of the editor area.
  • Palette: Located at the left side.
  • Design View: Located at the center.
  • Structure View: Located at the upper right. You
    can hide this view in the editor and show it instead in IntelliJ IDEA’s
    Structure tool window by unselecting Show Structure in Editor
    (Show Structure in Editor).
  • Properties View: Located at the lower right.
  • Bindings View: Located below the Design view.
    This view is not visible by default. Click the Show Bindings View button
    (Show Bindings View) in the toolbar to
    make is visible.
  • Error Log View: Automatically opens on errors in
    a tool window at the bottom. This view is not visible in the above
    screenshot.

Creating new forms¶

You can create new forms in any of IntelliJ IDEA’s project views. First select
the destination package or folder, then invoke IDEA’s New command and choose
JFormDesigner Form.

New Form Menu

In the New JFormDesigner Form dialog, enter the form name (which is also
used as class name), choose a superclass, a
layout manager and set
localization options.

Open forms for editing¶

You can open existing forms the same way as opening any other file in IntelliJ
IDEA. Locate it in any of IntelliJ IDEA’s project views and double-click it.

Go to Java code / Go to form¶

JFormDesigner adds a button to IntelliJ IDEA’s main toolbar that enables you to
switch quickly from a JFormDesigner form editor to its Java editor and vice
versa. If a form editor is active, then the button is named Go to Java code
(Go to Java code). If a Java editor is
active, then it is named Go to JFormDesigner form
(Go to JFormDesigner form). You can also
use Ctrl+Shift+D (Mac:
Shift+Command+D).

Go to Java code 
 Go to form

Code folding¶

To move the generated code out of the way, JFormDesigner folds it in the Java
editor.

Code folding

Convert IntelliJ IDEA and NetBeans forms¶

You can convert existing IntelliJ IDEA and NetBeans forms to JFormDesigner
forms. Right-click on the form file (or any container) and select Convert to
JFormDesigner Form
.

Convert forms

When converting an IntelliJ IDEA form, JFormDesigner inserts its own generated
GUI code into the existing Java class and removes IntelliJ IDEA’s GUI code.

JFormDesigner uses the term “Preferences” instead of IntelliJ IDEA’s “Settings”.
The JFormDesigner preferences are fully integrated into the IntelliJ IDEA
settings dialog. Select File > Settings from the menu to open it, expand the
“Other Settings” node and then select the “JFormDesigner” page. To set project
specific settings, select the item named “JFormDesigner (Project)”. See
Preferences for details.

Keyboard shortcuts¶

You can assign shortcut keys to most JFormDesigner commands in IntelliJ IDEA’s
keymap settings. Select File > Settings > Keymap to open it. In the actions
tree expand Plug-ins > JFormDesigner.