📘 قراءة كتاب magazine Number OneLight Java Development أونلاين
في نهاية الكتاب يجب أن تكون قادراً على :
• إنشاء مشروع جديد باستخدام برنامج نتبينز .
• صناعة واجهة لتطبيق الجوال.
• استخدام الدوال والمصفوفات والاستفادة منها في صناعة تطبيق للجوال.
• التعامل مع الأزرار والعناصر والفورمات وأزرار الاختيار.
• إضافة أيقونة لتطبيق الجوال وإضافة تفاصيل أخرى
Leonardo Galvão
Publisher
&
Editor-in-Chief
Leonardo Galvão
[email protected]
Assistant Editor
Osvaldo Pinali Doederlein
[email protected]
Design and Layout
phDesign (
phdesign.com.br
)
Graphic Designers
Tarcísio Bannwart, Jaime Peters Jr,
Tersis Zonato, Lais Pancote
Illustrators
Felipe Machado & Francisco Peixoto
Contributors
Fernando Lozano
Geertjan Wielenga
Gregg Sporar
Leonardo Galvão
Osvaldo Doederlein
Tomas Pavek
Editorial Support
Robert Demmer
John Jullion-Ceccarelli
NetBeans Magazine is
supported by NetBeans.org
Java and all Java-based marks are trademarks or registered
trademarks of Sun Microsystems, Inc. in the United States and
other countries. NetBeans Magazine is independent of Sun
Microsystems, Inc.
Although every precaution has been taken in the preparation of
this magazine, the publisher assumes no responsibility for
errors
or omissions, or for damages resulting from the use of
the information herein contained.
Produced in Brazil
First Edition
N
IDE Overview . Plug-in modules . Profiling . Matisse . GroupLayout . Web development
magazine
May . 2006
Writing Quality Code
Using rules and validation tools
to avoid common bugs
NetBeans Profiler
An in-depth tutorial about the
best profiling tool on the market
Matisse in Action
Using Matisse and more to
create a complete desktop app
Extending the IDE
Build your own plug-in
modules step by step
Practical Web Apps
Develop JSP & Struts applications
using the best of the IDE
Plug-in Showcase
Enrich your NetBeans
development experience
Exploring GroupLayout
Learn details about the layout
manager that powers Matisse
magazine
Number One
T
he NetBeans project has been going through an unprecedented number
of changes, broadening its scope, increasing quality and usability, and
expanding communities and user adoption. In many areas, like Swing
building or JME development, NetBeans IDE is now the tool to beat, with
levels of functionality and productivity that match or exceed any other
tool, open source or commercial.
This special first edition of NetBeans Magazine showcases a wide selection of
IDE and extension features, from desktop and web development to plug-in module
creation. Beginners will learn how to develop a complete desktop application using
Matisse and other IDE facilities. Seasoned programmers will also benefit, knowing
details about the NetBeans Profiler, which introduces breakthrough innovations in
profiling tools, and further learn about GroupLayout, the layout manager that is the
core of Matisse. Also shown is how to use IDE features and modules to detect bug
patterns, enforce code conventions, and closely follow coding rules that promote
overall quality and reduce maintenance costs.
NetBeans IDE has always followed the “it just works” principle, aggregating all the
functionality developers need from day to day. But there’s always some little niche
necessity that has to be taken care of. The extensibility features of NetBeans come
to the rescue, and the recent versions of the IDE make creating plug-in modules a
breeze. Catering for the growing community of plug-in module fans, the magazine
includes a special section describing tens of little and great extensions, which enable
NetBeans developers to program in other languages, use new APIs and frameworks,
and squeeze more functionality out of standard IDE features. And if you just can’t
stand being in the user role for long, a tutorial shows how to create a new plug-in
module from scratch.
NetBeans has gone very far and very fast – but still the community manages to
increase the rhythm, with version 5.5 at the door and the first releases of 6.0 already
available. The best part is you don’t get only to watch. You can join in, and participate
in this movement that’s bringing light to Java development.
Happy coding,
Leonardo Galvão
Publisher
&
Editor-in-Chief
Leonardo Galvão
[email protected]
Assistant Editor
Osvaldo Pinali Doederlein
[email protected]
Design and Layout
phDesign (
phdesign.com.br
)
Graphic Designers
Tarcísio Bannwart, Jaime Peters Jr,
Tersis Zonato, Lais Pancote
Illustrators
Felipe Machado & Francisco Peixoto
Contributors
Fernando Lozano
Geertjan Wielenga
Gregg Sporar
Leonardo Galvão
Osvaldo Doederlein
Tomas Pavek
Editorial Support
Robert Demmer
John Jullion-Ceccarelli
NetBeans Magazine is
supported by NetBeans.org
Java and all Java-based marks are trademarks or registered
trademarks of Sun Microsystems, Inc. in the United States and
other countries. NetBeans Magazine is independent of Sun
Microsystems, Inc.
Although every precaution has been taken in the preparation of
this magazine, the publisher assumes no responsibility for
errors
or omissions, or for damages resulting from the use of
the information herein contained.
Produced in Brazil
First Edition
N
IDE Overview . Plug-in modules . Profiling . Matisse . GroupLayout . Web development
magazine
May . 2006
Writing Quality Code
Using rules and validation tools
to avoid common bugs
NetBeans Profiler
An in-depth tutorial about the
best profiling tool on the market
Matisse in Action
Using Matisse and more to
create a complete desktop app
Extending the IDE
Build your own plug-in
modules step by step
Practical Web Apps
Develop JSP & Struts applications
using the best of the IDE
Plug-in Showcase
Enrich your NetBeans
development experience
Exploring GroupLayout
Learn details about the layout
manager that powers Matisse
Bringing
to
to
to
Light
Development
to
to
Light
Light
to
Light
to
Java
Contents
04
19
Plug-in Module
Showcase
Enrich your development
experience with dozens of
NetBeans extensions
22
32
Writing Quality Code
with NetBeans IDE
Exploring rules, modules and IDE
features that increase code quality
and avoid common bugs
Plug-in Module
Quick Start
Build plug-in modules step by
step, using the new extensibility
APIs in NetBeans 5
44
Web Development
with NetBeans 5
Use the best of NetBeans to
develop and debug JSPs, Servlets,
and Struts applications
A Complete App
Using NetBeans 5
Using Matisse and more to
create a complete application,
from UI to database access
58
52
Exploring the
NetBeans Profiler
An in-depth exploration
and tutorial about the best
profiling tool on the market
Get to Know
GroupLayout
Learn details about the new
layout manager that powers the
Matisse GUI buildn
First Edition
N
A Complete App Using NetBeans
N
etBeans is not a
newcomer to the Java
arena. In fact, it is one
of the oldest Java
IDEs still available
on the market. But
the most exciting developments happened
in the latest releases, specially 4.0 and 5.0,
with the renewed commitment from Sun and
participation of an ever-growing community
of users and developers. In many respects,
such as desktop development, NetBeans
can be regarded as the most powerful and
most easy-to-use Java IDE
This article gives an overview of the
IDE while building a complete desktop
application. Instead of a hello-world kind
of app, we build a more “real-world”
application: a to-do list commonly found as
part of PIM suites. The application will use an
embedded relational database and require
customization of Swing components, so
it will be a small-scale real project except
only for the lack of help content and an
installer.
We won’t just demo the IDE features. The
project will also stick to Object-Ori
-
ented best practices, showing
that you can develop GUI ap
-
plications quickly and inter
-
actively, without compro
-
mising long-term main
-
tenance and a sound
architecture.
How
-
ever, to keep the
tutorial short we’ll
skip some prac
-
tices usually required
by corporate environments and
well supported by NetBeans, such
as test-driven development using JUnit
tests, and source-control systems like CVS.
The reader will need basic Swing and JDBC skills, beyond familiarity
with the Java language and Object-Oriented programming. We
start with the basic procedures to install and configure NetBeans,
including a quick tour of the IDE user interface. Then the sample
application is presented, followed by the steps to create it using the
IDE features.
The first part of this article will be more detailed, because the
visual design capabilities are among NetBeans’ strongest features.
As we move deeper into the application logic, the article will switch
to a higher level discussion. That way, this article aims for two
objectives:
1.
Provide newbie developers with an introduction to using the
NetBeans IDE;
2.
Provide more seasoned developers with useful insights about
GUI development best practices, while using the best of NetBeans
features.
The to-do application will be developed using a three-step process.
The first step prototypes the UI design, where NetBeans really shines.
The second step focuses on user interaction and event handling; it’s
actually a second prototype for the application. The third and last
step builds the persistence and validation logic. Readers familiar
with the MVC architecture will note these steps form a process that
starts with the View, then builds the Controller, and finally builds the
Model.
Installing NetBeans
Installing NetBeans, as with most Java-based applications, is easy.
Just visit
netbeans.org
and click on
NetBeans IDE 5.0
under the
Latest Downloads
category at the top-right corner of the page. You
can choose installers for your platform, including Windows, Mac OS,
Linux and Solaris.
Before installation, you’ll need a JDK 1.4.2 or higher installed and
configured for use at the command-line. NetBeans uses JDK tools
like the
javac
compiler, so a JRE won’t be enough. If you don’t yet
have a JDK, there are download options bundling the latest JDK with
the IDE.
I personally prefer to click on the link below
Other distributions,
sources and extras
after the download form, and download instead
the
NetBeans IDE 5.0 Archive
, choosing the
.zip
format. After all,
Complete
G
NetBeans
IDE home
page
netbeans.org
osing the .zip format. After all,
Complete
G
NetBeans
IDE home
page
netbeans.org
N NetBeans Magazine
IDE Overview & Matisse
NetBeans is a pure-Java application, so you can use the same archive
to install it on any platform with a suitable JDK. Just pick a directory
and unpack the archive, and NetBeans is ready to run.
Starting and customizing NetBeans
After installing/unpacking NetBeans, the folder bin below the IDE
installation folder will contain platform-specific commands to start the
IDE. Windows users will use the netbeans.exe file, while Linux users
will use the netbeans file. The IDE will open with a welcome page (see
Figure 1).
EIf you have used the archive instead of the native installer, you’ll get a license
agreement dialog on the IDE’s first run. Don’t worry; the Sun Public License (SPL)
used by NetBeans is an OSI-approved open source software license.
At the top of the IDE window, you see the main menu and toolbar.
If you don’t like the big toolbar icons configured by default, righ-click
any empty spot in the toolbar and choose the Small Toolbar icons
menu entry.
A2
A A1
Figure 1
The NetBeans
main window
and welcome
page
The left area contains two navigational
panels. The top one is shared by the Projects,
Files and Runtime windows. The bottom
area contains the Navigator window, and
the right-center area is used for the many
editors included with NetBeans. Multiple
editors and windows can share the same
area; the IDE provides tabs for selecting the
one displayed.
Most of the time, you’ll use the Projects
window to browse and edit Java code. The
Navigator Window displays the structure of
the artifact being edited; for example for Java
code you’ll see class attributes and methods,
and for GUI design you’ll see the component
tree. The Files window is used when you
need to see the physical file structure of your
projects, and the Runtime window shows IDE
processes and other environment resources
like databases and Java EE servers.
To tweak your NetBeans environment,
the two most used tools are the Options
Window under Tools|Options on the main
menu, and the Library Manager also under
Tools. Figure 2 shows the pre-configured
libraries included with NetBeans 5.0, and
Figure 3 shows the first option I change
before starting GUI development: the idiom
for the code generated for Swing event
listeners.
Most Swing tutorials and samples from
books use anonymous inner classes (which
is the installation default for NetBeans), but
I find this idiom difficult to read and maintain.
You get giant methods containing the code
for handling many unrelated events. I prefer
instead to have each listener as a named
inner class, as shown in the figure.
The IDE provides a lot more customization
than is shown by the Options window. Just
click on the Advanced Options button and
A
Figure 2
NetBeans Library
Manager showing
default libraries
configured with
NetBeans 5.0
First Edition N
A Complete App Using NetBeans
حجم الكتاب عند التحميل : 12.2 ميجا بايت .
نوع الكتاب : pdf.
عداد القراءة:
اذا اعجبك الكتاب فضلاً اضغط على أعجبني و يمكنك تحميله من هنا:
شكرًا لمساهمتكم
شكراً لمساهمتكم معنا في الإرتقاء بمستوى المكتبة ، يمكنكم االتبليغ عن اخطاء او سوء اختيار للكتب وتصنيفها ومحتواها ، أو كتاب يُمنع نشره ، او محمي بحقوق طبع ونشر ، فضلاً قم بالتبليغ عن الكتاب المُخالف:
قبل تحميل الكتاب ..
يجب ان يتوفر لديكم برنامج تشغيل وقراءة ملفات pdf
يمكن تحميلة من هنا 'http://get.adobe.com/reader/'