What's New in JFormDesigner 5
JFormDesigner 5 introduces more than 40 new features and enhancements. This topic describes some of the significant or more interesting changes. Please have a look at the change log for a complete list of changes.
Beans Binding (JSR 295) support
Using Beans Binding (JSR 295) helps you to keep UI state and model in sync. It drastically reduces the amount of listener code that is usually necessary.
The new Bindings view gives a good overview of all bindings in a form.
BeanInfo Annotations
The new @BeanInfo
and @PropertyDesc
annotations make it very easy to specify
BeanInfo information directly in the custom component. It is no longer necessary
to implement extra BeanInfo classes. This drastically reduces time and code
needed to create BeanInfo information.
@BeanInfo(isContainer=true, categories={ @Category(name="Gradient Properties", properties={"direction", "magnitude"}) }) public class JGradientPanel extends JPanel { @PropertyDesc(displayName="direction (to)", preferred=true, enumValues={ @Enum(name="NORTH", intValue=SwingConstants.NORTH, code="SwingConstants.NORTH"), @Enum(name="EAST", intValue=SwingConstants.EAST, code="SwingConstants.EAST"), @Enum(name="SOUTH", intValue=SwingConstants.SOUTH, code="SwingConstants.SOUTH"), @Enum(name="WEST", intValue=SwingConstants.WEST, code="SwingConstants.WEST") }, imports=SwingConstants.class) public int getDirection() { return direction; } @PropertyDesc(displayName="magnitude (in %)", preferred=true) public int getMagnitude() { return magnitude; } }
Improved Properties view
The Properties view has been improved in many ways:
- Ability to filter properties.
- Introduced categories to group properties.
- Added Bindings and Events categories.
- Group by Category, Group by Defining Type and Alphabetical commands introduced to allow grouping of bean properties into categories (normal, expert, read-only and custom categories); into defining types (e.g. JTextField, JTextComponent, JComponent, Container, Component); or alphabetically.
- Support for custom categories specified in PropertyDescriptor of BeanInfo.
- Show changed properties even if containing category is collapsed.
- Moved Code Generation properties from its own tab to a new category.
- Show number of (set) properties per category.
- Removed grid lines to show more properties.
Search for property names
The Properties view now supports searching for property names. Select the Show Filter () toolbar button to show the search text field below the toolbar, where you can enter your filter criteria.
Events in Properties view
Events have been moved from the Structure view to the new Events category in the Properties view. Here you can also add, edit or remove event handlers.
The Add Event Handler popup menu has been optimized to reduce the necessary clicks to add event handlers. Listeners that have only one method are now in the main popup menu instead of in its own submenu.
"New form" and "Go to form" commands
(Eclipse plug-in only)
Similar to the other IDE plug-ins, the Eclipse plug-in now also has a Go to JFormDesigner form () / Go to Java code () command in its toolbar, which allows you to quickly switch from a Java editor to a JFormDesigner form editor and vice versa. Default key binding is Ctrl+Shift+D (Mac: Shift+Command+D).
Additionally, there is a new New JFormDesigner form () command in the toolbar. Default key binding is Ctrl+Shift+V (Mac: Shift+Command+V).
Styled text
JFormDesigner now uses styled text everywhere where useful. Styled text not only looks cool, it mainly helps you to better distinguish between main information and decoration.
Project specific settings
Many settings from the global Preferences dialog are now also available per project. You can use project specify settings for JGoodies FormLayout, null Layout, Localization, Java Code Generator (including sub-pages) and Client Properties.
IDE plug-ins: The pages are integrated into the IDE Project dialogs. The project specific settings are stored in the project files of the IDEs in their format. Stand-alone edition: The settings are stored in JFormDesigner project files (.jfdproj) and can be modified in the Project dialog.
Simplified handling of JScrollPanes
Now you can change layout properties of a JScrollPane (in Properties view and using the context popup menu) even if its child is selected. No longer worry about JScrollPane selection.
When clicking a JScrollPane in Design view, its child gets now selected, which is usually what you need. You can still select the JScrollPane in Structure view.
Improved Choose Bean dialog
The Choose Bean dialog has been improved in many ways:
- Camel-case pattern match finds classes with fewer keystrokes. E.g. DPB matches DatePickerBean.
- Highlights characters in list that match the filter pattern.
- Ability to disable JavaBean filter and to show matching interfaces in result.
- Displays additional information about matching classes: modifiers (as icon), class hierarchy (in tooltip), number of matching classes and used filter.
- Classpath Info link added, which shows the resolved classpath used by JFormDesigner.
non-public JavaBeans
You can now use non-public JavaBeans and interfaces in Design view.
Non-public JavaBeans must be in the same package as the form or a nested static
class of the form class. Interfaces are not initialized in the generated Java
code. You have to do this yourself before invoking
initComponents()
.
Auto-reload custom component classes
JFormDesigner's new class loader technology automatically reloads custom components when they change. This is extremely useful when you develop custom beans. Simply edit your component, compile it and you see your changes immediately in JFormDesigner.
The new class loader now can load custom beans compiled for Java 6+ while running JFormDesigner in a Java 5 VM (when the custom beans do not use Java 6+ API).
JGoodies Forms 1.3 support
JGoodies FormLayout 1.3, which provides a
new factory class com.jgoodies.forms.factories.CC
for
CellConstraints objects creation, is now supported.
JGoodies Forms version auto-detection
The code generator can now automatically detect the version of your JGoodies Forms library (forms.jar) in the classpath of your project and generate appropriate Java code.
GroupLayout improvements
The new Duplicate command allows you quick duplication of selected components. Properties for empty space around components have been added to the GroupLayout constrains properties.
Code formatter
(Eclipse plug-in only)
The Java code generator can now use the Eclipse code formatter to format generated code. Enable option "Use Eclipse code formatter" in Java Code Generator preferences.
Custom Create property
Better support for custom creation of components (e.g. using factories) with
new property Custom Create (category
Code Generation). When checked for a
component, the JFormDesigner generates an empty method
createUIComponents()
where you can write your own component
creation code.
Improved IntelliJ IDEA and NetBeans form conversion
The IntelliJ IDEA forms converter now supports nested forms and the Custom Create flag. The new option Form class extends top-level container changes the extends clause of the converted form to extend the top-level container, which is necessary for nested forms.
The NetBeans forms converter now supports forms that use Swing Application Framework resource management.
Command-line localization
If you have to localize many existing non-localized forms, then you can now use the command-line tool to quickly externalize many forms.