|
Create GUIs with NetBeans
For developers working on Swing for building GUI-based applications, NetBeans provides an easy-to-use yet powerful GUI builder option called Matisse
Rahul Gupta
Thursday, September 06, 2007
Writing code manually to create a GUI application is no less than a nightmare
for any developer. These days almost all development IDEs come packaged with a
GUI builder. NetBeans IDE too provides you with a GUI builder for Java
applications called 'Matisse.' Why is Matisse so special? you may ask. To
understand this let's look at what has been used for building GUIs till now.
Swing and AWT are two main Java libraries that are used for building UIs for
desktop applications. Most IDEs support various Swing layout managers for
designing the user interface, but the limitation with them has been that their
UI view is different from the WYSIWYG view. With Matisse, NetBeans introduced a
new layout manager called 'GroupLayout.' Though this new layout manager is not a
part of Swing, it can be freely distributed with the applications that you build
with NetBeans.
| Direct Hit! |
|
Applies
To: Java Developers
USP: Convenient way of creating
Java GUI apps
Primary Link: netbeans.org
Google Keywords: Matisse,
NetBeans GUI builder
|
New in Matisse
Matisse is as easy to use as Visual Basic. With Matisse, developers now have
the power and freedom to spend more time designing the application UI instead of
dealing with trivial issues, which used to be the case with other layout
managers like GriDBagLayout Manager. The new layout manager in Matisse,
GroupLayout, is from org.jdesktop.layout package. It comes preloaded with
NetBeans. The GroupLayout manager allows developers to place controls anywhere.
The controls auto-snap to one of the several predefined distances, and then can
be aligned easily by baselines or guidelines that appear along with the control.
This relation between controls and the frame they're placed in is also saved.
This way, even when you resize the frame, the positions of the controls change
accordingly. When we place a control on the form, the guidelines and baselines
appear. These hint at how the control is positioned in accordance with other
controls, and how it will be resized when the form is manipulated. This feature
is what makes WYSIWYG possible.
 |
| The Properties tab (right pane)
lists all properties of a control. The guidelines and anchors appear along
with each control showing how it can be resized |
The design view of NetBeans is easy to use and the palette has options for
using the Swing and AWT controls. Switching between the code and design views
lets you write code for a particular control while designing the form. But the
auto-generated code that is highlighted cannot be edited while in NetBeans IDE.
A separate frame shows all properties of a control, and can be easily edited.
Hooking up a control with an event is easy with just a right click and selecting
the appropriate event handler for that control. While designing the form, there
is an option to preview it also. This is not a special feature, except that it
doesn't require you to compile the class file for it, as some other editors
require.
 |
|
When you place a control from
the Palette, guidelines appear and show its relative position with other
controls. The palette itself has different Swing and AWT controls |
Page(s) 1 2
|