blob: b8d8175d54acf4b89c894a7502d8ae2f3f99c099 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<META NAME="keywords" CONTENT="netbeans,magazine,UI,Design,6.0,NetBeans GUI Builder,Matisse,GUI,layout,visual,graphical user interface">
<META NAME="description" CONTENT="NetBeans Magazine: UI Design in NetBeans IDE 6.0 with the NetBeans GUI Builder Matisse">
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
<title>UI Design in NetBeans IDE 6.0</title>
<style>
<!--
p.Noparagraphstyle, li.Noparagraphstyle, div.Noparagraphstyle
{line-height:120%;
text-autospace:none;
font-size:12.0pt;
font-family:Times;
color:black;}
p.NB-Corpo, li.NB-Corpo, div.NB-Corpo
{text-align:left;
text-indent:5.65pt;
line-height:16.0pt;
text-autospace:none;
font-size:9.0pt;
font-family:"Verdana";
color:black;
letter-spacing:.05pt;}
p.NB-Interttulo, li.NB-Interttulo, div.NB-Interttulo
{line-height:120%;
page-break-after:avoid;
text-autospace:none;
font-size:13.0pt;
font-family:"Verdana";
color:#A20018;
font-weight:bold;}
p.NB-Interttulo2, li.NB-Interttulo2, div.NB-Interttulo2
{line-height:12.0pt;
page-break-after:avoid;
text-autospace:none;
font-size:9.0pt;
font-family:"Verdana";
color:#D0780A;
font-weight:bold;}
p.NB-Notadica, li.NB-Notadica, div.NB-Notadica
{text-align:left;
line-height:13.0pt;
tab-stops:14.15pt;
text-autospace:none;
font-size:10.0pt;
font-family:"Verdana";
color:#D0780A;
letter-spacing:.05pt;}
p.NB-Legendaimagem, li.NB-Legendaimagem, div.NB-Legendaimagem
{line-height:12.0pt;
tab-stops:14.15pt;
text-autospace:none;
font-size:10.0pt;
font-family:"Verdana";
color:black;
letter-spacing:.05pt;}
span.NB-NegritoTcnico
{font-family:"Verdana";
color:black;
letter-spacing:.05pt;
font-weight:bold;
vertical-align:baseline;}
span.NB-Legendanegrito
{font-weight:bold;}
div.NB-Corpo1 {text-align:left;
text-indent:5.65pt;
line-height:16.0pt;
text-autospace:none;
font-size:9.0pt;
font-family:"Verdana";
color:black;
letter-spacing:.05pt;}
div.NB-Interttulo1 {line-height:120%;
page-break-after:avoid;
text-autospace:none;
font-size:13.0pt;
font-family:"Verdana";
color:#A20018;
font-weight:bold;}
div.NB-Interttulo21 {line-height:12.0pt;
page-break-after:avoid;
text-autospace:none;
font-size:9.0pt;
font-family:"Verdana";
color:#D0780A;
font-weight:bold;}
div.NB-Notadica1 {text-align:left;
line-height:13.0pt;
tab-stops:14.15pt;
text-autospace:none;
font-size:10.0pt;
font-family:"Verdana";
color:#D0780A;
letter-spacing:.05pt;}
div.Noparagraphstyle1 {line-height:120%;
text-autospace:none;
font-size:12.0pt;
font-family:Times;
color:black;}
li.NB-Corpo1 {text-align:left;
text-indent:5.65pt;
line-height:16.0pt;
text-autospace:none;
font-size:9.0pt;
font-family:"Verdana";
color:black;
letter-spacing:.05pt;}
li.NB-Interttulo1 {line-height:120%;
page-break-after:avoid;
text-autospace:none;
font-size:13.0pt;
font-family:"Verdana";
color:#A20018;
font-weight:bold;}
li.NB-Interttulo21 {line-height:12.0pt;
page-break-after:avoid;
text-autospace:none;
font-size:9.0pt;
font-family:"Verdana";
color:#D0780A;
font-weight:bold;}
li.NB-Notadica1 {text-align:left;
line-height:13.0pt;
tab-stops:14.15pt;
text-autospace:none;
font-size:10.0pt;
font-family:"Verdana";
color:#D0780A;
letter-spacing:.05pt;}
li.Noparagraphstyle1 {line-height:120%;
text-autospace:none;
font-size:12.0pt;
font-family:Times;
color:black;}
p.NB-Corpo1 {text-align:left;
text-indent:5.65pt;
line-height:16.0pt;
text-autospace:none;
font-size:9.0pt;
font-family:"Verdana";
color:black;
letter-spacing:.05pt;}
p.NB-Interttulo1 {line-height:120%;
page-break-after:avoid;
text-autospace:none;
font-size:13.0pt;
font-family:"Verdana";
color:#A20018;
font-weight:bold;}
p.NB-Interttulo21 {line-height:12.0pt;
page-break-after:avoid;
text-autospace:none;
font-size:9.0pt;
font-family:"Verdana";
color:#D0780A;
font-weight:bold;}
p.NB-Notadica1 {text-align:left;
line-height:13.0pt;
tab-stops:14.15pt;
text-autospace:none;
font-size:10.0pt;
font-family:"Verdana";
color:#D0780A;
letter-spacing:.05pt;}
p.Noparagraphstyle1 {line-height:120%;
text-autospace:none;
font-size:12.0pt;
font-family:Times;
color:black;}
span.NB-NegritoTcnico1 {font-family:"Verdana";
color:black;
letter-spacing:.05pt;
font-weight:bold;
vertical-align:baseline;}
p.NB-Corpo22 {text-align:left;
text-indent:5.65pt;
line-height:16.0pt;
text-autospace:none;
font-size:9.0pt;
font-family:"Verdana";
color:black;
letter-spacing:-.05pt;}
p.NB-Corpo221 {text-align:left;
text-indent:5.65pt;
line-height:16.0pt;
text-autospace:none;
font-size:9.0pt;
font-family:"Verdana";
color:black;
letter-spacing:-.05pt;}
p.NB-Corpo222 {text-align:left;
text-indent:5.65pt;
line-height:16.0pt;
text-autospace:none;
font-size:9.0pt;
font-family:"Verdana";
color:black;
letter-spacing:-.05pt;}
p.NB-Corpo223 {text-align:left;
text-indent:5.65pt;
line-height:16.0pt;
text-autospace:none;
font-size:9.0pt;
font-family:"Verdana";
color:black;
letter-spacing:-.05pt;}
p.NB-Corpo224 {text-align:left;
text-indent:5.65pt;
line-height:16.0pt;
text-autospace:none;
font-size:9.0pt;
font-family:"Verdana";
color:black;
letter-spacing:-.05pt;}
p.NB-Corpo225 {text-align:left;
text-indent:5.65pt;
line-height:16.0pt;
text-autospace:none;
font-size:9.0pt;
font-family:"Verdana";
color:black;
letter-spacing:-.05pt;}
p.NB-Corpo226 {text-align:left;
text-indent:5.65pt;
line-height:16.0pt;
text-autospace:none;
font-size:9.0pt;
font-family:"Verdana";
color:black;
letter-spacing:-.05pt;}
p.NB-Corpo227 {text-align:left;
text-indent:5.65pt;
line-height:16.0pt;
text-autospace:none;
font-size:9.0pt;
font-family:"Verdana";
color:black;
letter-spacing:-.05pt;}
p.NB-Corpo228 {text-align:left;
text-indent:5.65pt;
line-height:16.0pt;
text-autospace:none;
font-size:9.0pt;
font-family:"Verdana";
color:black;
letter-spacing:-.05pt;}
p.NB-Corpo229 {text-align:left;
text-indent:5.65pt;
line-height:16.0pt;
text-autospace:none;
font-size:9.0pt;
font-family:"Verdana";
color:black;
letter-spacing:-.05pt;}
p.NB-Corpo2251 {text-align:left;
text-indent:5.65pt;
line-height:16.0pt;
text-autospace:none;
font-size:9.0pt;
font-family:"Verdana";
color:black;
letter-spacing:-.05pt;}
p.NB-Corpo1111 {text-align:left;
text-indent:5.65pt;
line-height:16.0pt;
text-autospace:none;
font-size:9.0pt;
font-family:"Verdana";
color:black;}
.NB-Listagenstitulos {font-family: Verdana, Arial, Helvetica, sans-serif;
color: #FFFFFF;
font-size: 14px;}
.style4 {font-size: 11px; font-weight: bold; color: #BC001C;}
-->
</style>
</head>
<body bgcolor="#FFFFFF" lang=PT-BR>
<table width="770" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="/images_www/magazine/matisse/top_matisse.jpg" alt="Title" width="770" height="200"></td>
</tr>
<tr>
<td height="82"><p class="NB-Corpo1"><strong>Beans Binding, Swing Application Framework, and features you've probably been <br>
dreaming about having in your IDE</strong></p></td>
</tr>
<tr>
<td><div class=Section1>
<p class=NB-Corpo1><span lang=EN-US>One of the most
talked about and innovative features since NetBeans 5.0 is Project Matisse or
the Form Editor. Many would agree that Matisse is the best user interface
designer across different IDE categories and technologies. A good number of
developers will start or have started using NetBeans because of it. </span></p>
<p class=NB-Corpo1><span lang=EN-US>With software, there is never-ending room
for improvement and growth. In NetBeans 6.0, familiar and new developers will
find many new Matisse features to help improve Swing application development,
as you&rsquo;ll see in this article.</span><br>
</p>
<p class=NB-Interttulo1><span lang=EN-US>Beans Binding and the Swing Application
Framework</span></p>
<p class=NB-Corpo1><span lang=EN-US>Building on the recent JCP specs Beans
Binding (JSR 295) and Swing Application Framework (JSR 296), desktop developers
have a few new cards up their sleeve; they&rsquo;ll also benefit from more efficient
development. Plain Swing application developers gain more from the Swing
Application Framework enhancements in NetBeans, but Platform developers should
not feel left out. The latter already have a Swing-based application framework
in the NetBeans Platform, with many more features than JSR 296 provides. All
gain much with Beans Binding support, however.</span><br>
</p>
<p class=NB-Interttulo21><span lang=EN-US>Beans Binding support</span></p>
<p class=NB-Corpo1><span lang=EN-US>Beans Binding allows you to escape the
common monotony of writing code to copy data from user interface components to
data classes or JavaBeans and vice versa. With the new Beans Binding
enhancements, you can right click on a UI element and access the <i>Bind</i> context menu item. For instance, selecting this item for a </span><span
class=NB-NegritoTcnico1><span lang=EN-US style='font-size:10.0pt'>javax.swing.JTextField </span></span><span lang=EN-US>will show the preferred bound property of <i>text</i> (see <b>Figure&nbsp;1</b>). Other properties can be accessed through the
property inspectors Binding tab (<b>Figure&nbsp;2</b>).</span></p>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="/images_www/magazine/matisse/image/image001.png" width="343" height="177"></td>
</tr>
<tr>
<td><p class=NB-Corpo22><strong>Figure 1.</strong> The Beans Binding menu item.<br>
</p></td>
</tr>
</table>
<br>
<br>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="/images_www/magazine/matisse/image/image003.png" width="485" height="456"></td>
</tr>
<tr>
<td><p class=NB-Corpo221><strong>Figure 2.</strong> Setting Beans Binding options for a JTextField.<br>
<br>
</p></td>
</tr>
</table>
<br>
<p class=NB-Corpo1><span lang=EN-US>Once you&rsquo;ve chosen the property to bind, a
dialog is displayed, where you can select the target JavaBean. You can then
enter an expression using the Beans Binding Expression Language. The syntax is
much like the JSP EL. Aside from entering the expression by hand, a nifty
selector, accessed as a drop-down list or combo box, allows developers to
quickly build the expression by drilling down through properties and
sub-properties.</span></p>
<p class=NB-Corpo1><span lang=EN-US>When the application is run, the selected UI
component updates its bound component when focus is lost or the user presses
Enter. The main point is that the developer no longer has to manage this and
other operations with a load of event handling code.</span><br>
</p>
<p class=NB-Interttulo21><span lang=EN-US>Swing Application Framework support</span></p>
<p class=NB-Corpo1><span lang=EN-US>The Swing Application Framework provides
mechanisms to quickly build complete desktop applications. NetBeans 6 takes it
further with integrated support for the framework in the IDE, while providing a
set of standard icons such as Copy, Paste, and Cut. This is better than piece
milling an application from Swing components, and coming up every time with a
separate solution for starting an application or shutting it down, basic
actions or events, custom icons, a resource manager, session storage, etc. </span></p>
<p class=NB-Corpo1><span lang=EN-US>To create a Swing Application Framework
project in NetBeans 6, select <i>File|New Project</i> and, under the General
category, choose the new Java Desktop Application project template. At the time
of writing, there are two application templates available: Basic and Database
(see <b>Figure&nbsp;3</b>). Others will be included in future releases. For
example, thought is being given to templates for creating web client
applications based on the Swing Application Framework.</span><br>
</p>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="/images_www/magazine/matisse/image/image005.png" width="729" height="503"></td>
</tr>
<tr>
<td><p class=NB-Corpo222><strong>Figure 3.</strong> Choosing a desktop application template. <br>
</p></td>
</tr>
</table>
<p class=NB-Corpo1><span lang=EN-US>The Basic template generates a regular Swing
application with simple features such as Cut, Copy, Paste, Save, and New.
Simple applications like Notepad or KWrite can be easily created with this
template (see <b>Figure&nbsp;4</b>). </span></p>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="/images_www/magazine/matisse/image/image007.png" width="414" height="381"></td>
</tr>
<tr>
<td><p class=NB-Corpo223><strong>Figure 4.</strong> Example application generated with the Basic template.<br>
<br>
</p></td>
</tr>
</table>
<p class=NB-Corpo1><span lang=EN-US>The Database template allows users to create
CRUD database applications. Along with Apache Derby/JavaDB or HSQLDB, this can
be like Microsoft Access on steroids. </span></p>
<p class=NB-Corpo1><span lang=EN-US style='letter-spacing:-.1pt'>To me, the
Swing Application Framework support works best for developing simpler
applications. This may get better in the future with JSR 277 (Java Module
System). However, a module system alone does not provide a framework with all
the components and utilities offered by the NetBeans Platform. For more complex
applications, I advise you to build on the NetBeans Platform. A path from Swing
Application Framework-based applications to Platform-based apps is being
pondered, but nothing is concrete in this regard at the time of writing. </span></p>
<p class=NB-Notadica1><span lang=EN-US><strong>Note: </strong>The Swing Application Framework and the
NetBeans Platform are both Swing frameworks. The Swing Application Framework
provides application lifecycle management, session management (e.g. windows are
stored in the same locations when the application restarts), a resource
manager, actions, storage, an application context, and synchronous and
asynchronous tasks. The NetBeans Platform provides all these plus numerous
other features, including a powerful module/plug-in system which allows modules
to install their own UI menus, actions, and services, among other application
items.</span></p>
<p class=NB-Interttulo1><span lang=EN-US>More new features</span></p>
<p class=NB-Corpo1><span lang=EN-US>Additional new features in NetBeans 6
include a new visual menu designer, protected code customizer enhancements,
centering of components and improved Free Design preferred-gaps and copy-paste
support. </span></p>
<p class=NB-Corpo1><span lang=EN-US>Other features added to version 6 have been
made available for NetBeans 5.5 developers as an update. These include
automatic internationalization, visual localization, a preview with look and
feel support, relative font definitions, and dragging of components from the
projects explorer to the UI &ndash; as well as a context-sensitive help bar, and a
pre/post declaration code editor. In the upcoming IDE release, all these
features will be fully integrated, and come out of the box.</span></p>
<p class=NB-Interttulo21><span lang=EN-US>Visual Menu Designer</span></p>
<p class=NB-Corpo1><span lang=EN-US>Previous versions of Matisse had limited
application menu design support; you needed to use the Inspector window to
create menu items and sub-menus. Now menu components can be selected and edited
visually in the UI designer. This helps in a couple Java Desktop Application
ways: it&rsquo;s clearer which menu and menu item is being edited, and the form
doesn&rsquo;t have to be previewed or the application run to see what the menu will
look like at runtime. See the Visual Menu Designer in action in <b>Figure&nbsp;5</b>. </span></p>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="/images_www/magazine/matisse/image/image009.png" width="280" height="254"></td>
</tr>
<tr>
<td><p class=NB-Corpo224><strong>Figure 5.</strong> New Visual Menu Designer.<br>
</p></td>
</tr>
</table>
<p class=NB-Interttulo21><span lang=EN-US>Protected Code Customizer Enhancements</span></p>
<p class=NB-Corpo1><span lang=EN-US>NetBeans uses the concept of protected code.
This is used by Matisse so that the generated code is not changed and possibly
broken by the developer, allowing the visual designer to continue working.
Sometimes, though, this is a little too strict, and restrictions on protected
code are a common complaint in the NetBeans mailing lists. </span></p>
<p class=NB-Corpo1><span lang=EN-US>In NetBeans 6 this will be much better, and
you&rsquo;ll be able to change the protected code sections in many ways. These help
you get around issues of timing actions and method calls, with initialization
and property/bean configuration, for example. </span></p>
<p class=NB-Corpo1><span lang=EN-US>Here are some options for modifying
protected code, all accessible through the Properties window Code tab (also see <b>Figure&nbsp;6</b>):<b> </b></span></p>
<p class=NB-Corpo1><span lang=EN-US style='font-family:Wingdings;'>&sect; </span><i><span lang=EN-US>Post-Listener-Code</span></i><span
lang=EN-US> &ndash; Included after all properties of all beans are set and all
listeners are added. </span></p>
<p class=NB-Corpo1><span lang=EN-US style='font-family:Wingdings;'>&sect; </span><i><span lang=EN-US>Pre-Adding Code and Post-Adding Code</span></i><span
lang=EN-US> &ndash; Included before and after the component is added to the parent
container such as a </span><span class=NB-NegritoTcnico1><span lang=EN-US
style='font-size:10.0pt'>JPanel</span></span><span lang=EN-US> or </span><span
class=NB-NegritoTcnico1><span lang=EN-US style='font-size:10.0pt'>JFrame</span></span><span
lang=EN-US>. </span></p>
<p class=NB-Corpo1><span lang=EN-US style='font-family:Wingdings;letter-spacing:0pt'>&sect; </span><i><span lang=EN-US style='letter-spacing:
0pt'>A</span><span lang=EN-US>fter-All-Set Code </span></i><span lang=EN-US>&ndash; I</span><span
lang=EN-US style='letter-spacing:0pt'>ncluded after the component is completely
set-up. </span></p>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="/images_www/magazine/matisse/image/image011.png" width="348" height="351"></td>
</tr>
<tr>
<td><p class=NB-Corpo2251><strong>Figure 6.</strong> Protected Code Customizer enhancements. </p></td>
</tr>
</table>
<p class=NB-Corpo1><span lang=EN-US>The new Pre/Post Declaration Code Editor is more
of a must-have than a development boost. As of Java 5, developers can now
annotate different things in Java source code, and for libraries or
technologies requiring annotations, Matisse must allow the developer to somehow
set these annotations. Annotations can also be added through the Properties
window's Code tab, in the Pre-Declaration Code field; and there&rsquo;s a
Post-Declaration Code field available. </span></p>
<p class=NB-Corpo1><span lang=EN-US>NetBeans 6 comes with a new code customizer,
which lets you inject source code more easily into the protected sections. It&rsquo;s
accessible by right clicking on the UI form in the designer and selecting <i>Customize
Code</i>. A dialog with a Java editor pops up. See <b>Figure&nbsp;7</b> for an
example.</span></p>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="/images_www/magazine/matisse/image/image013.png" width="680" height="617"></td>
</tr>
<tr>
<td><p class=NB-Corpo225><strong>Figure 7.</strong> Code Customizer Dialog<br>
<br>
</p></td>
</tr>
</table>
<p class=NB-Interttulo21><span lang=EN-US><br>
Centering of components</span></p>
<p class=NB-Corpo1><span lang=EN-US>Aligning components along a center axis just
got easier. Matisse now allows a group of selected components to be centered
down the axis of the first selected component. Horizontal and vertical
centering are available. Currently, more than one component must be selected;
then all are centered on the widest selection. Another option will allow
centering components horizontally and vertically in their parent container.</span><br>
</p>
<p class=NB-Interttulo21><span lang=EN-US>More gaps </span></p>
<p class=NB-Corpo1><span lang=EN-US>Before NetBeans 6, the Free Design layout
manager supported a single preferred gap for component placement. In 6.0, three
preferred gaps are supported. A preferred gap is the preferred spacing between
components, and is available on all sides of a component for quick and elegant
placement, as shown in <b>Figure&nbsp;8</b>. For developers who may like more
control over spacing between components, having three choices comes in handy.</span><br>
</p>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="/images_www/magazine/matisse/image/image015.png" width="350" height="83"></td>
</tr>
<tr>
<td><p class=NB-Corpo226><strong>Figure 8.</strong> Free Design
preferred gap support &ndash; three offsets instead of one<br>
<br>
</p></td>
</tr>
</table>
<p class=NB-Interttulo21><span lang=EN-US>Better copy/paste support</span></p>
<p class=NB-Corpo1><span lang=EN-US>While using the Free Design layout, copying
and pasting produces a horrible result in versions before 6.0. It places all
copied components, no matter the number selected, at location [0,0] on the UI
form. This problem has now been solved. Instead of messing up the layout,
copies are now pasted to a manageable offset of the original components. The
components also keep their layout after copying (see <b>Figure&nbsp;9</b>).</span><br>
</p>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="/images_www/magazine/matisse/image/image015.png" width="350" height="83"></td>
</tr>
<tr>
<td><p class=NB-Corpo227><strong>Figure 9.</strong> Improved copy/paste support in Free Design (components were pasted multiple times).<br>
<br>
</p></td>
</tr>
</table>
<p class=NB-Interttulo21><span lang=EN-US>Automatic Internationalization and Visual
Localization</span></p>
<p class=NB-Corpo1><span lang=EN-US>Previous releases of NetBeans required a few
extra steps to internationalize and localize a UI. Now the process is
streamlined. In previous versions, you had to setup each individual UI element
to pull values from the correct resource bundle. Then to actually localize the
bundle you needed to create separate bundle files or localized entries
manually, enter the text for the correct locale, and format the file
accordingly (using a different encoding, for example).</span></p>
<p class=NB-Corpo1><span lang=EN-US>In NetBeans 6.0, you can now ask Matisse to
automatically internationalize the application during UI design. This means
that for each resource that would normally be internationalized by hand Matisse
automatically adds the value supplied in the UI designer to a resource bundle.
This is done for all UI elements.</span></p>
<p class=NB-Corpo1><span lang=EN-US>The visual localization feature works in
harmony with automatic internationalization. You can right click the top form
node in the tree of the Inspector window, locate the Design Locale combo box in
the Properties window, and then select a locale or add a new one. </span></p>
<p class=NB-Corpo1><span lang=EN-US>Once the Design Locale is selected, you can
simply edit the text in the UI as if normally editing a form. The localization
for the Design Locale takes place automatically with the values entered into
the UI. The locale can be changed and the form re-edited to set the values for
the newly selected locale. It is as simple as it sounds to create a fully
internationalized UI with NetBeans 6 (see <b>Figure&nbsp;10</b>).</span><br>
<br>
</p>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="/images_www/magazine/matisse/image/image019.png" width="353" height="278"></td>
</tr>
<tr>
<td><p class=NB-Corpo228><strong>Figure 10.</strong> Access the Automatic Resource Management combo box to set the resource management style to Internationalization, and Design Locale to set the locale used while editing the UI in Matisse. Change the locale and re-edit the UI to localize the user interface. Nice and easy! <br>
</p></td>
</tr>
</table>
<br>
<br>
<p class=NB-Interttulo21><span lang=EN-US>Preview with look and feel support</span></p>
<p class=NB-Corpo1><span lang=EN-US>Before NetBeans 6.0, there was no mechanism
to allow the project&rsquo;s look and feel to be set in the designer for a regular
Swing application. It was left to the developer to add the appropriate code to
set the application look and feel.</span></p>
<p class=NB-Corpo1><span lang=EN-US>Setting the look and feel of a regular Swing
application with source code is quite simple. However, without the Form <br>
Editor allowing the design look and feel to be set, the developer has no way to
see how the application will look at runtime with different look and feels.
This will no longer be a problem.</span></p>
<p class=NB-Corpo1><span lang=EN-US>In NetBeans 6.0, forms can be previewed with
any available look and feel. In the Inspector window, the developer right
clicks on the form containers node, or on the node on the same level as the
Other Components node and just below it (its sibling), which has the name of
the forms extended class such as </span><span class=NB-NegritoTcnico1><span
lang=EN-US style='font-size:10.0pt'>JFrame</span></span><span lang=EN-US>, </span><span
class=NB-NegritoTcnico1><span lang=EN-US style='font-size:10.0pt'>JDialog</span></span><span
lang=EN-US>, or </span><span class=NB-NegritoTcnico1><span lang=EN-US
style='font-size:10.0pt'>JPanel</span></span><span lang=EN-US>. Then the
Preview Design sub-menu is rolled over and the look and feel is selected. The
form is then previewed with the chosen look and feel. </span></p>
<p class=NB-Notadica1><span lang=EN-US>A right-click on the form in the UI
designer also makes the Preview Design sub-menu accessible.</span><br>
</p>
<p class=NB-Interttulo21><span lang=EN-US>Relative font definitions</span></p>
<p class=NB-Corpo1><span lang=EN-US>Have you ever wanted to define your UI fonts
just a little larger or smaller than the overall system or application font?
This would come in handy in that fonts would not have to be set for each
component. Instead, fonts for specific components could be set to a different
relative size, or have a different style than the main application or system
font.</span></p>
<p class=NB-Corpo1><span lang=EN-US>In the latest version of Matisse this is
quick and simple. You select a UI component on a form, and in the Properties
window click the button to the right of the </span><span
class=NB-NegritoTcnico1><span lang=EN-US style='font-size:10.0pt'>font</span></span><span
lang=EN-US> property. The font editor appears. There, you can select the
checkbox &ldquo;Derive the font from the default font&rdquo; and choose the font style. The
font can be sized relative to the default font; the size can also be made
absolute. Regardless of the size, the font is not hard-coded and will be determined
at runtime. This feature uses the </span><span class=NB-NegritoTcnico1><span
lang=EN-US style='font-size:10.0pt'>Font.deriveFont()</span></span><span
lang=EN-US> method.</span><br>
</p>
<p class=NB-Interttulo21><span lang=EN-US>Dragging components from Project
Explorer to the UI</span></p>
<p class=NB-Corpo1><span lang=EN-US>In previous versions of NetBeans, the
developer had to install UI components from developing projects into the Form
Editor&rsquo;s Palette to use them in UI forms. This created different issues with
modifications to the components, and complicated using components from
sub-projects in project UIs. Things have gotten better, however.</span></p>
<p class=NB-Corpo1><span lang=EN-US>Now you can work on a library as a
sub-project or dependency. You create a new form in the parent project, and the
sub-project UI controls/classes can then be dragged from the project hierarchy
and dropped onto a form without adding them to the palette or the global IDE.
This is essentially
project-level palette items: a nicer and cleaner solution.</span><br>
</p>
<p class=NB-Interttulo21><span lang=EN-US>Context-sensitive Help Bar</span></p>
<p class=NB-Corpo1><span lang=EN-US>Who says you can&rsquo;t teach an old dog new
tricks? The new context-sensitive help bar (see <b>Figure&nbsp;11</b>) can help
new and familiar developers alike. New users will probably find it more useful,
as it can quickly bring them up to speed with the Matisse features. The new
help bar provides contextual hints about what can be done with the selected
component or current feature being used. Even seasoned users may find new
shortcuts or features they did not know existed.</span><br>
<br>
</p>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="/images_www/magazine/matisse/image/image021.png" width="549" height="218"></td>
</tr>
<tr>
<td><p class=NB-Corpo229><strong>Figure 11.</strong> Context-sensitive help bar<br>
</p></td>
</tr>
</table>
<p class=NB-Interttulo1><span lang=EN-US>Conclusions</span></p>
<p class=NB-Corpo1><span lang=EN-US>Matisse is part of the reason for the
NetBeans community&rsquo;s recent growth spurt, and it gets better and better with
each release. The 6.0 release is no different, and the latest features are a
great boost to Swing application development efficiency. Everyone should try
it.</span></p>
<p class=NB-Corpo1><span lang=EN-US>NetBeans 6.0 Matisse feature development is
ongoing, and other features are currently in the works. Most notably, the
possibility to fix refactorings for generated UI code should be ready in the
final version, along with many other new features and
improvements. </span> <span
style='letter-spacing:.15pt;'>&nbsp;</span><br>
</p>
<table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#BC001C">
<tr>
<td height="24" valign="middle" bgcolor="#BC001C"><p class="NB-Listagenstitulos"><strong>Links</strong></p></td>
</tr>
<tr>
<td><br>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="40">&nbsp;</td>
<td><a href="https://netbeans.org/projects/guibuilder"><span class="style4"><font face="Verdana">NetBeans GUI Builder</font></span></a></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><font size=1 color=black face="Verdana"><span style="font-size:9.0pt;letter-spacing:0pt">"Matisse" GUI Builder project home page.</span></font></td>
</tr>
</table>
<br>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="40">&nbsp;</td>
<td><a href="http://wiki.netbeans.org/wiki/view/NetBeansDreamTeam"><span class="style4"><font face="Verdana">wiki.netbeans.org/wiki/view/NetBeansDreamTeam </font></span></a></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><font size=1 color=black face="Verdana"><span style="font-size:9.0pt;letter-spacing:0pt">NetBeans Dream Team Wiki/home page
.</span></font></td>
</tr>
</table>
<br>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>&nbsp;</td>
<td><a href="http://blogs.sun.com/roumen/entry/swing_application_framework_swing_databinding"><span class="style4"><font face="Verdana"> blogs.sun.com/roumen/entry/swing_application_framework_databinding </font></span></a></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><font size=1 color=black face="Verdana"><span style="font-size:9.0pt;letter-spacing:0pt">Swing Application Framework and Beans Binding demo by Roman Strobl</span></font><font color=black face="Verdana"><span style="font-size:9.0pt;letter-spacing:0pt">.</span></font></td>
</tr>
</table>
<br>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="40">&nbsp;</td>
<td><a href="http://wadechandler.blogspot.com/"><span class="style4"><font face="Verdana">http://wadechandler.blogspot.com/</font></span></a></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><font size=1 color=black face="Verdana"><span style="font-size:9.0pt;letter-spacing:0pt">Wade Chandler&rsquo;s home page</span></font><font color=black face="Verdana"><span style="font-size:9.0pt;letter-spacing:0pt">.</span></font></td>
</tr>
</table>
<br>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="40">&nbsp;</td>
<td><a href="http://appframework.dev.java.net"><span class="style4"><font face="Verdana">appframework.dev.java.net </font></span></a></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><font color=black face="Verdana"><span style="font-size:9.0pt;letter-spacing:0pt">A JSR 296 Swing Application Framework implementatio, </span></font></td>
</tr>
</table>
<br>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="40">&nbsp;</td>
<td><a href="https://netbeans.org/projects/guibuilder/updates/update55.html"><span class="style4"><font face="Verdana">form.netbeans.org/updates/update55.html </font></span></a></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><font color=black face="Verdana"><span style="font-size:9.0pt;letter-spacing:0pt">NetBeans 5.5 Matisse update feature page. </span></font></td>
</tr>
</table></td>
</tr>
</table>
<table width="770" border="1" cellpadding="0" cellspacing="0" bordercolor="#BC001C">
<tr>
<td><table width="100%" border="0" cellpadding="0" cellspacing="1" bordercolor="#BC001C">
<tr>
<td width="93"><div align="center"><img src="/images_www/magazine/autores/Wade.jpg" alt="Autor" width="77" height="94"></div></td>
<td width="677" valign="middle"><p class=NB-Corpo1111> <strong>Wade Chandler</strong> <br>
(<em>hwadechandler-nb@yahoo.com</em>) is a software engineer working for Decision Dynamics, Inc. and an independent software developer. He began his career in 1997 and has been involved with the NetBeans community since it was known as Forte for Java, and with Java since JDK 1.0. Wade contributes to the NetBeans project, and is a member of the NetBeans <br>
Dream Team.</p></td>
</tr>
</table></td>
</tr>
</table>
</div></td>
</tr>
</table>
</body>
</html>