The JFormDesigner / FormDev Blog

JFormDesigner 5.0.2 with IntelliJ IDEA 11 support

2011-12-07 3 Comments , ,

We've just released JFormDesigner 5.0.2, which is now compatible with IntelliJ IDEA 11, fixes minor bugs and brings some minor improvements.

See Change Log for details and download JFormDesigner 5.0.2.

3 Comments »

Swing Tip: JSplitPane with pixel thin divider

2011-09-09 3 Comments

Modern GUIs are becoming more and more minimalistic. Most controls (e.g. text fields or buttons) nowadays use 1 pixel thin borders. Everybody is removing borders from scroll and split panes. Even the split pane divider is often reduced to 1 pixel (e.g. on Mac OS X since years or in current Mozilla Thunderbird).

But how to create a 1 pixel thin divider with JSplitPane?

First idea was of course to invoke splitPane.setDividerSize(1). This seems to work, but has the disadvantage that it is very hard for the user to hit that single pixel line to move the divider. What we need is a transparent divider that has a easy-to-hit width (e.g. 9 pixels) and is placed between and over the left and right split pane components.

zeros-size split divider

Thanks to Swing's flexible design, it is relative easy to implement this.

First we set the divider size to 1 and let the split pane layout manager do its work. The trick is now to override JSplitPane.layout() and modify the bounds of the divider (e.g. increase width and move left):

public class JSplitPaneWithZeroSizeDivider extends JSplitPane {
    private int dividerDragSize = 9;
    private int dividerDragOffset = 4;
 
    public JSplitPaneWithZeroSizeDivider() {
        setDividerSize( 1 );
        setContinuousLayout( true );
    }
 
    @Override
    public void layout() {
        super.layout();
 
        // increase divider width or height
        BasicSplitPaneDivider divider = ((BasicSplitPaneUI)getUI()).getDivider();
        Rectangle bounds = divider.getBounds();
        if( orientation == HORIZONTAL_SPLIT ) {
            bounds.x -= dividerDragOffset;
            bounds.width = dividerDragSize;
        } else {
            bounds.y -= dividerDragOffset;
            bounds.height = dividerDragSize;
        }
        divider.setBounds( bounds );
    }

Then we need our own UI delegate that creates our divider.

    @Override
    public void updateUI() {
        setUI( new SplitPaneWithZeroSizeDividerUI() );
        revalidate();
    }
 
    private class SplitPaneWithZeroSizeDividerUI extends BasicSplitPaneUI {
        @Override
        public BasicSplitPaneDivider createDefaultDivider() {
            return new ZeroSizeDivider( this );
        }
    }

And finally our divider, which draws the divider line and updates the drag locations.

    private class ZeroSizeDivider extends BasicSplitPaneDivider {
        public ZeroSizeDivider( BasicSplitPaneUI ui ) {
            super( ui );
            super.setBorder( null );
            setBackground( UIManager.getColor( "controlShadow" ) );
        }
 
        @Override
        public void setBorder( Border border ) {
            // ignore
        }
 
        @Override
        public void paint( Graphics g ) {
            g.setColor( getBackground() );
            if( orientation == HORIZONTAL_SPLIT )
                g.drawLine( dividerDragOffset, 0, dividerDragOffset, getHeight() - 1 );
            else
                g.drawLine( 0, dividerDragOffset, getWidth() - 1, dividerDragOffset );
        }
 
        @Override
        protected void dragDividerTo( int location ) {
            super.dragDividerTo( location + dividerDragOffset );
        }
 
        @Override
        protected void finishDraggingTo( int location ) {
            super.finishDraggingTo( location + dividerDragOffset );
        }
    }
}

That's it.

Download Source

Tested with Oracle/Sun Java 5, 6, and 7. Licensed under BSD-2-Clause with clause 2 removed.

3 Comments »

JFormDesigner 5.0.1 and 5.1 Beta 3

2011-08-08 0 Comments , ,

We've just released JFormDesigner 5.0.1 and 5.1 Beta 3.

JFormDesigner 5.0.1

This release fixes minor bugs and brings some minor improvements.

If you're running JFormDesigner in a Java 7 VM, it is recommened to update to this release because it fixes a NullPointerException when using TitledBorder and running JFormDesigner in a Java 7 VM.

See Change Log for details and download JFormDesigner 5.0.1.

JFormDesigner 5.1 Beta 3

Beta 3 Change Log:

  • Go to event handler method in Java editor.
  • All fixes from JFormDesigner 5.0.1.

Beta 2 Change Log:

  • NetBeans: Project specific options.
  • Palette: Display multiple items per row if there is enough room.
  • Palette: New option "Item Names" in context menu to show only item icons.
  • NetBeans: fixed too dark background of panels, palette, headers, etc on Mac.
  • NetBeans: bug fixes.
  • Fixed NullPointerException when using TitledBorder and running
    JFormDesigner in a Java 7 VM.

Please give it a try, download it and report bugs. Thanks.

0 Comments »

JFormDesigner 5.1 Beta; NetBeans plug-in

2011-07-26 1 Comments , ,

Finally, the first build of the JFormDesigner plug-in for NetBeans is available now as part of JFormDesigner 5.1 Beta.

NetBeans plug-in

Major new features and improvements:

  • NetBeans plug-in.
  • JGoodies Forms 1.4 support.
  • New JFDML persistence format for .jfd form files. This is a compact, easy-to-merge and fast-to-load format.

Please have a look at the change log for a complete list of changes.

Please give it a try, download it and report bugs. Thanks.

1 Comments »

JFormDesigner 5 Released

2011-04-19 6 Comments ,

We're pleased to announce the immediate availability of JFormDesigner 5, now with Beans Binding (JSR 295) support, BeanInfo annotations, project specific settings and more.

Feature Highlights:

  • Beans Binding (JSR 295) support
  • BeanInfo Annotations
  • Improved Properties view
  • Project specific settings
  • Improved Choose Bean dialog
  • Auto-reload custom component classes
  • and more...

See What's New in JFormDesigner 5 for the significant or more interesting changes.
Please have a look at the change log for a complete list of changes.

Download JFormDesigner 5

Customer information: JFormDesigner 5 is free of charge for existing customers if the "Free updates until" date of your license key is 2010-01-01 or later. Upgrades are available here.

6 Comments »

JFormDesigner 5 Release Candidate 2

2011-01-26 1 Comments ,

We've just released JFormDesigner 5 Release Candidate 2.

Change Log:

  • Stand-alone on Mac OS X: JFormDesigner canceled Log Out and Shut Down even when there were no unsaved forms.
  • Stand-alone: Improved startup script for Unix/Linux based systems.
  • NetBeans form converter: Fixed occasional error when converting NetBeans 6.9+ forms.
  • Minor bugs fixed.

Please give it a try, download it and report bugs. Thanks.

Customer information: JFormDesigner 5 is free of charge for existing customers if the "Free updates until" date of the license key is 2010-01-01 or later.

1 Comments »

JFormDesigner 5 Release Candidate

2010-12-20 0 Comments ,

We've just released JFormDesigner 5 Release Candidate.

JFormDesigner 5 introduces more than 40 new features and enhancements.
See What's New in JFormDesigner 5 for the significant or more interesting changes.
Please have a look at the change log for a complete list of changes.

Please give it a try, download it and report bugs. Thanks.

Customer information: JFormDesigner 5 is free of charge for existing customers if the "Free updates until" date of your license key is 2010-01-01 or later.

0 Comments »

JFormDesigner 4.0.9 and 5 Beta 3

2010-11-19 0 Comments ,

We've just released JFormDesigner 4.0.9 and 5 Beta 3.

JFormDesigner 4.0.9

This release fixes minor bugs and brings some minor improvements. It now supports Java 7 EA.

See Change Log for details and download JFormDesigner 4.0.9.

JFormDesigner 5 Beta 3

Change Log:

  • Added property editor for string arrays.
  • I18n: Support localization of string arrays.
  • I18n: Externalization of forms from command-line.
  • Look and Feels: Added option "Enable Look and Feel switching" to "Look and Feels" preferences page, which allows you to disable Look and Feel switching if it causes problems.
  • Minor bugs fixed.

Please give it a try, download it and report bugs. Thanks.

0 Comments »

JFormDesigner 5 Beta 2

2010-09-20 2 Comments ,

We've just released JFormDesigner 5 Beta 2. This second beta contains an important bugfix for the i18n support. Users that use JFormDesigner's great i18n features are recommended to update from the first beta.

Change Log:

  • I18n: Fixed generation of wrong resource bundle keys (since 5 Beta).
  • Minor bugs fixed.

Please give it a try, download it and report bugs. Thanks.

Customer information: JFormDesigner 5 is free of charge for existing customers if the "Free updates until" date of the license key is 2010-01-01 or later.

2 Comments »

JFormDesigner 5 Beta

2010-09-10 1 Comments ,

After hard (and long) work on the next major release of JFormDesigner, the first JFormDesigner 5 Beta build is finally available.

Major new features and improvements:

  • Beans Binding (JSR 295) support.
  • Project specific settings.
  • JGoodies Forms 1.3 support.
  • Properties view: Ability to filter properties.
  • Properties view: "Group by Category", "Group by Defining Type" and "Alphabetical" commands introduced.
  • Properties view: Moved "Code Generation" properties from own tab to category into properties table.
  • "Choose Bean" dialog now supports camel-case search.
  • Automatically reload custom components when changed.
  • Automatically refresh designers on project classpath changes.
  • Simplified handling of JScrollPanes: now you can select the child of a JScrollPane and change layout properties of the JScrollPane in the Properties view and using the context popup menu.
  • Eclipse plug-in: 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.

For more new features and improvements see the change log.

Please give it a try, download it and report bugs. Thanks.

Customer information: JFormDesigner 5 is free of charge for existing customers if the "Free updates until" date of the license key is 2010-01-01 or later.

1 Comments »