Sunday, May 12, 2013

Java Basics: Programming and Certification


-----

Trails Covering the Basics

These trails are available in book form as The Java Tutorial, Fifth Edition. To buy this book, refer to the box to the right.
  • Getting Started — An introduction to Java technology and lessons on installing Java development software and using it to create a simple program.
  • Learning the Java Language — Lessons describing the essential concepts and features of the Java Programming Language.
  • Essential Java Classes — Lessons on exceptions, basic input/output, concurrency, regular expressions, and the platform environment.
  • Collections — Lessons on using and extending the Java Collections Framework.
  • Deployment — How to package applications and applets using JAR files, and deploy them using Java Web Start and Java Plug-in.
  • Preparation for Java Programming Language Certification — List of available training and tutorial resources.

Creating Graphical User Interfaces



-----

Windows 7


-----

Getting Around the Desktop
New to Windows 7? Even though there’s a lot in common with the version of Windows that you had before, you might still need a hand getting up to speed. This guide is filled with useful info about personalizing your PC.
It covers the topics that Andy Sweet showed you in his video: Getting around the desktop. http://windows.microsoft.com/get-started
Use this guide as a reference while exploring what you can do with Windows 7.
In this guide
Pin a program to the taskbar ........................................................................................................................ 2
Rearrange buttons on the taskbar ................................................................................................................ 2
Using Jump Lists ............................................................................................................................................ 2
To open an item from a Jump List ............................................................................................................ 3
To pin and unpin an item to a Jump List ................................................................................................... 3
To change the order of items in a Jump List ............................................................................................. 3
To remove a recent item from a Jump List ............................................................................................... 3
Snap a window to the side ............................................................................................................................ 4
Snap a window vertically .............................................................................................................................. 4
Snap a window to the top ............................................................................................................................. 5
Minimize open windows using Aero Shake .................................................................................................. 5
Getting Around the Desktop
Page | 2
© 2009 Microsoft Corporation. All rights reserved.
Pin a program to the taskbar
You can pin a program directly to the taskbar so that you can open it quickly and conveniently, rather than having to look for the program in the Start menu each time. Here’s how:
 If the program isn't running, click the Start button, click All Programs, find the program you want, right-click it, and then click Pin to Taskbar.
 If the program is already running, right-click the program button on the taskbar, and then click Pin this program to taskbar.
Rearrange buttons on the taskbar
You can rearrange and organize program buttons on the taskbar so they appear in the order you prefer.
To rearrange the order of program buttons on the taskbar, just drag a button from its current position to a different position on the taskbar.
Using Jump Lists
Jump Lists are lists of recent items, such as files, folders, or websites, organized by the program that you use to open them.
You can open programs, recent items, and favorite items using Jump Lists so that you can quickly get to the items you use every day. Here are some ways to use Jump Lists:
Getting Around the Desktop
Page | 3
© 2009 Microsoft Corporation. All rights reserved.
To open an item from a Jump List
You can view the Jump List and then open items both from the taskbar and the Start menu. Here’s how:  Right-click the program’s icon on the taskbar, and then click the item. - or -  Click the Start button, point to a pinned program or recently used program, point to or click the arrow next to the program, and then click the item.
To pin and unpin an item to a Jump List You can pin a favorite item to a Jump List, so it will always appear at the top of the list. That way, you’ll be able to get to the file quickly and easily. Here’s how:  To pin an item to a Jump List, open the program's Jump List, point to the item, click the pushpin icon, and then click Pin to this list.  To remove an item from a Jump List, open the program's Jump List, point to the item, click the pushpin icon, and then click Unpin from this list.
To change the order of items in a Jump List
To change the order of either pinned items or recent items, open the Jump List, and then drag the item to a different position.
To remove a recent item from a Jump List
To remove a recent item entirely from a Jump List, open the Jump List, right-click the item, and then click Remove from this list.
Don’t worry, you won’t delete the file, you’re just removing it from the Jump List. The next time you open that item, it might reappear in the Jump List again.
Getting Around the Desktop
Page | 4
© 2009 Microsoft Corporation. All rights reserved.
Snap a window to the side
You can use Snap to arrange windows side by side, which can be especially helpful when comparing two documents or when dragging files from one place to another. Here’ how: 1. Drag the title bar of a window to the left or right side of the screen until an outline of the expanded window appears. 2. Release the title bar to expand the window. 3. Repeat steps 1 and 2 with another window to arrange the windows side by side.
To return the window to its original size, drag the title bar away from the top of the desktop, and then release.
Snap a window vertically
You can use Snap to expand windows vertically, which can be especially helpful for reading longer documents. Here’s how: 1. Point to the top or bottom edge of an open window until the pointer changes into a double-headed arrow. 2. Drag the edge of the window to the top or bottom of the screen to expand the window to the entire height of the desktop. The width of the window doesn't change.
To return the window to its original size, drag the title bar away from the top of the desktop, or drag the bottom edge of the window away from the bottom of the desktop.
Getting Around the Desktop
Page | 5
© 2009 Microsoft Corporation. All rights reserved.
Snap a window to the top
You can use Snap to maximize a window, which makes it easier to focus solely on that window with less distraction from other open windows. Here’s how:
1. Drag the title bar of the window to the top of the screen until an outline of the expanded window appears.
2. Release the title bar to expand the window to fill the entire desktop. To return the window to its original size, drag the title bar of the window away from the top of the screen.
Minimize open windows using Aero Shake
You can use Aero Shake to quickly minimize every open window except the one you want. You can then restore all of your windows just as easily. Here’s how: 1. In the window you want to keep open, drag (or shake) the title bar back and forth quickly. 2. To restore the minimized windows, shake the open window again.

-----
http://windows.microsoft.com/en-hk/windows7/help/getting-started

Ruby On Rails

-----

Getting Started with Rails

This guide covers getting up and running with Ruby on Rails. After reading it, you should be familiar with:
  • Installing Rails, creating a new Rails application, and connecting your application to a database
  • The general layout of a Rails application
  • The basic principles of MVC (Model, View Controller) and RESTful design
  • How to quickly generate the starting pieces of a Rails application


Chapters

  1. Guide Assumptions
  2. What is Rails?
  3. Creating a New Rails Project
  4. Hello, Rails!
  5. Getting Up and Running Quickly with Scaffolding
  6. Creating a Resource
  7. Adding a Second Model
  8. Refactoring
  9. Deleting Comments
  10. Security
  11. Building a Multi-Model Form
  12. View Helpers
  13. What’s Next?
  14. Configuration Gotchas

-----
from: http://guides.rubyonrails.org/getting_started.html

JOOMLA!

-----

GETTING STARTED WITH JOOMLA!

 1538 1838 136 90
 
Joomla makes creating and maintaining Web sites easy for everyone, from total beginners setting up their first site to IT professionals managing enterprise installations.

Get the Basic Details

If you have never used Joomla! before, you might want to read What is Joomla? first. If you are evaluating Joomla for use on a project, you may want to review the materials for evaluators on the Joomla Documentation Wiki.

Test Out the Online Demo

You can really test out Joomla using our online demo at demo.joomla.org. Don't worry, you can't break it! You'll quickly discover how easy it is to create and manage content as well as learn your way around the Joomla administrator interface.
The demo site content is refreshed every 30 minutes. There are security precautions in effect to protect the privacy of other site users and to better ensure site stability. To test drive the demo site, you need to:
  1. Create Account
    You must create an account with a valid email address. Once registered, your account is created, and an email is sent to your email address. This email will contain an account activation link.
  2. Activate Account
    To activate your account click on the activation link contained in the email.
  3. Use Demos
    Once your account is activated you are free to login to the public frontend and the administrative backend.
All user accounts are given Super Administrator access and can perform all functions except those that could be abused. Each demo user account remains active for one month. Feel free to use the new demo resource and to share it with others interested in exploring Joomla's capabilities.
For more details about the operation of the demo site, visit demo.joomla.org.

Find Documentation and Help

Documentation for Joomla is available on the Joomla Documentation Wiki at docs.joomla.org. Choosing a user type will help you find the appropriate resources on the wiki. The wiki page The Absolute Beginners Guide to Joomla contains lots of information, advice, and links for first time users. If you have more questions, visit theJoomla forums.

Get Ready to Install

Getting started on your Joomla Web site is easy to do. Many hosting services offer a simple one-click installation, but if you'd rather be more hands-on, have more control or are your own host, all you need is a Web server with PHP and MySQL. Most commercial hosts provide these as part of their basic package of services. Then download a copy of Joomla.  The Joomla Installation Manual (Download PDF) takes you through the installation process step by step, The Joomla Quick Start Guide (Download PDF) should get you running quickly, and the accompanying video is a nice resource.

What to Do Next

Start creating your site by adding content, images, and, if you wish, any of the thousands of extensions to the Joomla! CMS.
If you're looking to get started in Joomla development, developer.joomla.org is the best place for you to start. There you'll find tons of information on Joomla, the APIs and much more.
If you're a designer and want to learn more about creating Joomla templates, the Joomla Template Tutorialshows how easy it is to design in Joomla and even convert an existing Web site to Joomla.

-----
from: http://www.joomla.org/about-joomla/getting-started.html

Arduino

-----

Getting Started with Arduino

Introduction: What Arduino is and why you'd want to use it.
Installation: Step-by-step instructions for setting up the Arduino software and connecting it to an Arduino Uno, Mega2560, Duemilanove, Mega, or Diecimila.
Environment: Description of the Arduino development environment and how to change the default language.
Libraries: Using and installing Arduino libraries.
Troubleshooting: Advice on what to do if things don't work.
Instructions for other boards:
The text of the Arduino getting started guide is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the guide are released into the public domain.

-----
from: http://arduino.cc/de/Guide/HomePage

Java SWT, Swing or AWT

-----

SWT, Swing or AWT: Which is right for you?

What to consider when choosing a GUI tool kit for new applications
Barry Feigenbaum, Programming Adviser, IBM, Software Group
Summary:  By providing a comparison of Eclipse's SWT with the Java Swing and Abstract Windows Toolkit (AWT) GUI tool kits, this article helps developers of new applications decide which to choose. Read descriptions of each tool kit's basic features, and the pros and cons of using each.
Date:  21 Feb 2006
Level:  Introductory

Comments:   0 (View | Add comment - Sign in)
Average rating 4 stars based on 613 votes Average rating (613 votes)
Rate this article
Other developerWorks authors have shown how to handle the tricky migration between Swing and SWT (see Resources). This article is intended to help you decide which GUI tool kit to choose before starting a project.
But first: Why is there more than one Java™ GUI tool kit? The best answer is that one size does not fit all, nor is there a one-size-fits-all GUI tool kit to be invented soon. Each tool kit offers advantages and disadvantages that make selecting one more appropriate, given your needs and intended audience.
Let's learn about each of these tool kits.
Abstract Windows Toolkit (AWT) is the original Java GUI tool kit. AWT's main advantages are that it comes standard with every version of Java technology, including Java implementations in old Web browsers, and it is very stable. This means you do not need to install it, you can depend on it being available everywhere you find a Java runtime environment, and it will have the features you expect.
AWT is a very simple tool kit with limited GUI components, layout managers, and events (see Listing 1, Listing 2 and Listing 3). This is because Sun Microsystems decided to use a lowest-common denominator (LCD) approach for AWT. Only GUI components defined for all Java host environments would be used. As a result -- and unfortunately -- some commonly used components, such as Tables, Trees, Progress Bars, and others, are not supported. For applications that need more component types, you need to create them from scratch. This is a big burden.

Listing 1. The basic AWT Class tree (all in the java.awt package, "*" indicates abstract)
Object

    CheckboxGroup

    *Component

        Button

        Canvas

        CheckBox

        Choice

        Container

            Panel

                Applet

            ScrollPane

            Window

                Dialog

                Frame

        Label

        List

        TextComponent

            TextArea

            TextField

    MenuComponent

        MenuItem

            CheckboxMenuItem

            Menu

                PopupMenu


NOTE: Other AWT components exist in several other packages, but this is the basic set.

Listing 2. AWT provides the following layout managers (all in the java.awt package, "*" indicates interface)
*LayoutManager

    FlowLayout

    GridLayout

    *LayoutManager2

        BorderLayout

        CardLayout

        GridBagLayout


NOTE: Other AWT layout managers exist in several other packages, and many are specialized to the container they lay out, but this is the basic set.

Listing 3. AWT provides the following events (most in the java.awt.events package)
Object

    EventObject

        AWTEvent

            ActionEvent

            AdjustmentEvent

            ComponentEvent

                ContainerEvent

                FocusEvent

                InputEvent

                    KeyEvent

                    MouseEvent

                        MouseWheelEvent

                PaintEvent

                WindowEvent

            HierarchyEvent

            InputMethodEvent

            InvocationEvent

            ItemEvent

            TextEvent


NOTE: Other AWT events exist in several other packages, but this is the basic set. These are specific events generated from a more generic event.
In general for AWT (and also Swing and SWT), each event type has an associated XxxListener interface (and possiblyXxxAdapter null implementation), where Xxx is the event without the Event suffix (for example, KeyListener for a KeyEvent), which is used to pass the events to handlers. Applications register with the event source (the GUI component or widget) for the events they are interested in processing. Some listeners handle multiple events.
One nice feature of AWT is that it, in general, supports automatic disposal of GUI components. This means that you rarely need to dispose components. The exception is high-level components, such as Dialogs and Frames. If you create resources that consume significant host resources, you can dispose of them manually.
AWT components are thread-safe, which means you do not need to be concerned as to which thread in your application updates the GUI. This can eliminate many GUI update problems, but can make AWT GUIs run slower.
AWT allows you to build GUIs top-down or bottom-up or in any combination. By top-down, I mean creating a container component before any of its children. By bottom-up, I mean creating children before creating their containing (or parent) component. Thus, a component can exist without a parent container, and its parent can change over time.
AWT GUIs, in general, are not accessible. There is no API for an AWT programmer to specify accessibility information. Accessibility deals with how well an application can be used by people with disabilities. To be accessible an application, together with the platform it runs on, must enable PwDs to use the application with the appropriate assistive technologies (tools that provide alternate user interfaces). Many governments and corporations have standards that require applications to be enabled for accessibility.
Sun wanted the Java language to be a "write once, run everywhere" (WORE) environment. This means Java code could be developed and tested on one host (Windows®, for example) and be expected to run the same on any other Java host without testing. For the most part, Java technology succeeded, but AWT was a weak spot. Because AWT depended on host GUI peercontrols (where each AWT component has a parallel host control or peer) to implement the GUI, the GUI looked and -- more importantly -- behaved differently on different hosts. This resulted in a "write once, test everywhere" (WOTE) situation, which was less than satisfactory.
AWT provides a rich graphics environment, especially in Java V1.2 and beyond. Through the Graphics2D object, and Java2D andJava3D services, many powerful graphical applications, such as drawing and charting packages and, combined withJavaSound, competitive interactive games, can be created.
Java Swing, also known as a part of the Java Foundation Classes (JFC), was an attempt to solve most of AWT's shortcomings. In Swing, Sun created a very well-engineered, flexible, powerful GUI tool kit. Unfortunately, this means Swing takes time to learn, and it is sometimes too complex for common situations.
Swing is built on parts of AWT. All Swing parts are also AWT parts. Swing uses the AWT event model and support classes, such as Colors, Images, and Graphics. The Swing components, layout managers, and events are summarized below (see Listing 4,Listing 5 and Listing 6). As you can see, these sets are far more extensive than that supplied by AWT and compares well to the SWT set.

Listing 4. The basic Swing Class tree (all in the javax.swing package or subpackage, "*" indicates an abstract class)
Object

    *Component

        Container

            *JComponent

                *AbstractButton

                    JButton

                    JMenuItem

                        JCheckBonMenuItem

                        JMenu

                        JRadioButonMenuItem

                    *JToggleButton

                        JCheckBox

                        JRadioButton

                Box 

                Filler

                JColorChooser

                JComboBox

                JDesktopIcon

                JFileChooser

                JInternalFrame

                JLabel

                JLayeredPane

                    JDesktopPane

                JList

                JMenuBar

                JOptionPane

                JPanel

                JPopupMenu

                JProgressBar

                JRootPane

                JScrollBar

                JScrollPane

                JSeparator

                JSlider

                JSplitPane

                JTabbedPane

                JTable

                JTableHeader

                *JTextComponent

                    JEditorPane

                        FrameEditorPane

                        JTextPane

                    JTextArea

                    JtextField

                        JPasswordField

                JToolBar

                JToolTip

                JTree

                JViewport

                    ScrollableTabViewport

            Panel

                Applet

                    JApplet

            Window

                Dialog

                    JDialog

                Frame

                    JFrame

                JWindow


NOTE: Many other Swing components exist, in several other packages, but this is the basic set.

Listing 5. Swing provides the following additional LayoutManagers (all in the javax.swing package or subpackages, "*" indicates interface)
*LayoutManager

    CenterLayout

    *LayoutManager2

        BoxLayout

        OverlayLayout

        SpringLayout


NOTE: Many other Swing layout managers exist in several other packages, and many are specialized to the container they lay out, but this is the basic set.

Listing 6. Swing provides additional events (most in the javax.swing.events package and subpackages)
Object

    EventObject

        AWTEvent

            AncestorEvent

            ComponentEvent

                InputEvent

                    KeyEvent

                        MenuKeyEvent

                    MouseEvent

                        MenuDragMouseEvent

            InternalFrameEvent


NOTE: Other AWT events exist in several other packages, but this is the basic set. These are "high-level" events generated from a more generic event.
To overcome the variation in behavior across different hosts, Swing minimized its dependence on host controls. In fact, Swing uses peers for only top-level components like windows and frames. Most components (JComponent and its subclasses) are emulated in pure-Java code. This means that Swing is naturally portable across all hosts. Thus, Swing does not typically look like a native application. In fact, it has multiple looks, some that can emulate -- although often not exactly -- different hosts and some that provide unique looks.
Swing uses the term heavyweight for peer-based components and lightweight for emulated components. In fact, Swing supports mixed heavy and light components in a single GUI, such as mixing AWT and Swing controls in the same JContainer, but care must be taken with drawing order if the components overlay each other.
Swing may not be able to take advantage of hardware GUI accelerators and special host GUI operations. As a result, Swing applications may be slower than native GUIs. Sun has worked hard on the performance of the recent versions of Swing (Java V1.4 and 1.5), and this disadvantage is becoming less noticeable. Because Swing's design is more robust, its code base is larger. This can mean it takes a beefier machine to run it than AWT or SWT might.
Beyond more components, layout mangers, and events, Swing has many features that make it more powerful than AWT. Some of the more important ones are:
Separation of model from the view and controller
For all components with models (such as buttons, lists, tables, trees, rich text), the model is separate from the component. This allows the model to be adapted to the needs of the application and for it to be shared by multiple views. Default models per component type are provided for convenience.
Programmable look and feel
Each component's look (appearance) and feel (how it reacts to input events) is controlled by a separate and dynamically replaceable implementation. This allows the look and feel of all or part of a Swing-based GUI to change.
Renderers and editors
Most components that show model content, such as lists, tables, and trees, can process model elements of almost any type. This is done by mapping a renderer or editor for each component type and model type. For example, a table with a column containing java.util.Date values can have special code to present the date value and edit the date value. Each column can have different types.
Accessibility
Creating a GUI that is accessible to people with disabilities is important. Swing offers an extensive infrastructure and API for enabling GUIs for accessibility. This support is independent of but integrates with the host accessibility support, if any.
Like AWT, Swing supports automatic disposal of GUI components. Swing also supports the AWT bottom-up and top-down construction methods.
Unlike AWT, Swing components are not thread-safe, which means you need to be concerned as to which thread in your application updates the GUI. If you err in thread use, unpredictable behavior, including user interface glitches, can occur. Utility routines exist to help manage threading issues.
Like AWT, one of Swing's advantages is that it comes standard with Java technology. This means you do not need to install it. Unfortunately, Swing has evolved a lot, so it is easy to become dependent on features provided in more recent versions of the Java language, which may force users to upgrade their Java runtimes.
SWT is a low-level GUI tool kit comparable in concept to AWT. JFace is a set of enhanced components and utility services to make building GUIs with SWT easier. The builders of SWT learned from the AWT and Swing implementations and tried to build a system that had the advantages of both without their disadvantages. In many ways, they succeeded.
SWT is a lot like AWT in that it is based on a peer implementation. It overcomes the LCD problem faced by AWT by defining a set of controls adequate to make most office applications or developer tools and then, on a host-by-host basis, creating emulated (like Swing) controls for any not supplied by the particular host. For most modern hosts, nearly all the controls are based on native peers. This means that an SWT-based GUI has a host look and feel, and host performance. This avoids the most widely held complaints with AWT and Swing. Certain hosts have low-function controls, so SWT supplies extended, often emulated, versions (often with "C" as the first letter in their names) to allow the more generally expected behavior.
SWT is different from AWT in how the peers work. In SWT, the peers are just wrappers on host controls. In AWT, peers can provide services to minimize the differences between hosts (this is where AWT ran into a lot of its behavior issues). This means that an SWT application is really a host application, with all the good and bad points that entails. It also means that SWT does not fully achieve the WORE goal; it is more a WOTE solution. That said, SWT does a remarkable job of creating a portable solution, albeit not as well as Swing.
The SWT widgets, layouts, and events are summarized below (see Listing 7, Listing 8 and Listing 9). As you can see, these sets are far more extensive than that supplied by AWT and compares well to the Swing set.

Listing 7. The basic SWT Class tree (most in the org.ecipse.swt.widgets or org.eclipse.swt.custom package or subpackages, "*" indicates an abstract class, "!" in custom package, "~" some other package)
Object

    *Dialog

         ColorDialog

         DirectoryDialog

         FileDialog

         FontDialog

         MessageDialog

         PrintDialog 

    *Widget

        Menu

        *Item

            CoolItem

            !CTabItem

            MenuItem

            TabItem

            TableColumn

            TableItem

            TableTreeItem

            ToolItem

            TrayItem

            TreeColumn

            TreeItem

        *Control

            Button

            Label

            ProgressBar

            Sash

            Scale

            Scrollable

                Composite

                    ~Browser

                    Canvas

                        *~AbstractHyperlink

                            ~Hyperlink

                                ~ImageHyperlink

                            *~ToggleHyperline

                                ~TreeNode

                                ~Twistie

                        AnimatedProgress

                        !CLabel

                        Decorations

                            Shell

                        FormText

                        StyledText

                        TableCursor

                    !CBanner

                    !CCombo

                    Combo

                    CoolBar

                    !CTabFolder

                    ~ExpandableComposite

                        ~Section

                    ~FilteredList

                    ~FilteredTree

                    ~Form

                    Group

                    ~PageBook

                    ProgressIndicator

                    !SashForm

                    !ScrolledComposite

                    TabFolder

                    Table

                    TableTree

                    ToolBar

                    Tray

                    Tree

                    ViewForm

                List

                Text

            Slider


NOTE: Many other SWT widgets exist in several other packages, but this is the basic set.
Like AWT and Swing layout managers, SWT provides a comprehensive set of layouts. Both layout systems, combined with nested containers, can generate almost any needed layout algorithm. All three GUI libraries also support absolute control positioning. The lack of a SWT BorderLayout equivalent is disappointing. The FormLayout is very nice for creating form-base input. I think the SWT layout scheme is a little harder to learn to use than the AWT/Swing set.

Listing 8. SWT provides the following layout managers (most in the org.eclipse.swt.layout org.eclipse.swt.custom package or subpackages, "*" indicates interface, "!" in custom package)
*Layout

    FillLayout

    FormLayout

    GridLayout

    RowLayout

    !StackLayout


NOTE: Other SWT layout managers exist in several other packages, and many are specialized to the container they lay out, but this is the basic set.
Like the AWT and Swing event systems, SWT provides a comprehensive set of events. Although the events are not one-to-one with AWT/Swing (for example, AWT and Swing buttons both fire ActionEvent while SWT buttons fire SelectionEvent), they are generally equivalent.

Listing 9. SWT provides the following events (most in the org.eclipse.swt.events package or org.eclipse.swt.custom package or subpackages, "*" indicates abstract, "!" in custom package)
Object

    EventObject

        SWTEventObject

            TypedEvent

                AimEvent

                !BidiSegmentEvent

                ControlEvent

                !CTabFlolderEvent

                DisposeEvent

                DragSourceEvent

                DragTargetEvent

                !ExtendedModifyEvent

                focusEvent

                HelpEvent

                KeyEvent

                    TraverseEvent

                    VerifyEvent

                !LineBackgroundEvent

                !LineStyleEvent

                MenuEvent

                ModifyEvent

                MouseEvent

                PaintEvent

                SelectionEvent

                    TreeEvent

                ShellEvent

                !TextChangedEvent

                !TextChangingEvent


NOTE: Other SWT events exist in several other packages, but this is the basic set. These are specific events generated from a more generic event.
Many Swing components, such as JTable, have models. SWT control equivalents (such as Table) do not; they have items, instead. Items are generally limited to showing text or generally small images (such as icons). To provide a Swing-like model structure, JFace ContentProviders are used. These providers act as a bridge between the application-supplied model (such as ajava.util.Array for a List or Table), and the control acting as the view. In order to format arbitrary model objects into items, SWT uses JFace LabelProviders, which generate a text or iconic form for any model object. This can limit the sophistication of the display of complex model objects. Other providers, such as ColorProviders and LabelDecorators, can enhance the display of items. For the special case of Tables, SWT provide a CellEditor that temporarily links an arbitrary SWT control to a Table cell to act as an editor for that cell.
SWT does not support automatic disposal of GUI controls. This means that you must explicitly dispose of any controls or resources, such as colors or fonts, you create, as opposed to getting from an API call. This effort is eased somewhat as container controls dispose of their child controls automatically.
SWT only allows you to build GUIs top-down. Thus, a control cannot exist without a parent container, and its parent cannot, in general, change over time. This approach is much less flexible than AWT/Swing. Controls are added to a parent container during creation and removed when disposed. Also, the SWT use of style bits only at construction time can limit the flexibility of some GUI controls. Many styles are hints only and do not work the same on all platforms.
Like Swing, SWT components are not thread-safe, which means you need to be concerned about which thread in your application updates the GUI. If you err in thread use an exception is thrown. I think this is better than the non-deterministic Swing approach. Special utility routines exist to help manage threading issues.
SWT GUIs are generally accessible if the supporting host provides accessibility services. SWT provides a basic out-of-process API for programmers to specify accessibility information when the default information is inadequate.
SWT provides a limited graphics environment. To date, it does not compare well to the support of Java2D and Java3D. Eclipse provides a separate feature called Graphical Editing Framework (GEF) with a component called Draw2D that can be used to create some drawing applications, such as UML modeling tools. Unfortunately, GEF is difficult to use stand-alone (meaning outside the entire Eclipse environment).
Unlike AWT and Swing, SWT and JFace do not come with Java technology. They must be installed separately, as part of an Eclipse installation or as separate libraries. The Eclipse team has made it fairly easy to install and run SWT independently of Eclipse. The needed Java archives (JAR) and Dynamic Link Libraries (DLL), and similar libraries for UNIX® and Macintosh can be downloaded separately from the Eclipse Web site. The JFace libraries require you to download all of Eclipse and copy out the needed JARs. Once downloaded, the JARs need to be on the Java CLASSPATH and the DLLs on the system PATH.
The following table compares, in no particular order, many characteristics of the AWT, SWT, and Swing libraries. This list is not exhaustive, but covers the most important characteristics.

Table 1. SWT vs. AWT and Swing Feature comparison
Function/Role/AspectAWTSwingSWT (style)
Display static textLabelJLabelLabel, CLabel
Display multi-line static textMultiple LabelsMultiple JLabels or JLabel with HTML contentMultiple Labels or Label with newlines
Display multi-line formatted static textMultiple Labels with different fontsJLabel with HTML contentMultiple Labels with different fonts
Single-line text entryTextFieldJTextFieldText(SWT.SINGLE)
Multi-line text entryTextAreaJTextAreaText(SWT.MULTI)
Display an imageN/AJLabelLabel
Display text and imageN/AJLabelCLabel
ToolTip pop-up helpN/AsetToolTip on component, subclass JToolTipsetToolTip on control
Styled text entryN/AJEditorPaneStyledText
Select from list of itemsListJListList
Simple push button with textButtonJButtonButton(SWT.PUSH)
Simple push button with text and/or imageN/AJButtonButton(SWT.PUSH)
Drawing area; possibly for custom controlsCanvasJPanelCanvas
On/off check boxCheckBoxJCheckBoxButton(SWT.CHECK)
Radio selectionCheckBoxGroupButtonGroup and menusGroup and Menu
Select from a drop-down listChoiceJComboBoxCombo, CCombo
Enter text or select from a drop-down listN/AJComboBoxCombo, CCombo
Scrollable areaScrollPaneJScrollPaneCreate Scrollable subclass
Top level windowsDialog, Frame, WindowJDialog, JFrame, JWindowShell with different styles
Generic windowWindowJWindowShell
Frame windowFrameJFrameShell(SWT.SHELL_TRIM)
Dialog windowDialogJDialogShell(SWT.DIALOG_TRIM)
MenuMenuJMenuMenu
MenuItemMenuItemJMenuItemMenuItem
Menu shortcutsGeneric keystrokessame as AWThost dependent mnemonics and accelerators
Pop-up menuPopupMenuJPopupMenuMenu(SWT.POPUP)
Menu barsMenuBarJMenuBarMenu(SWT.BAR)
Display an insertion caretN/ACaretCaret
Web browserN/AJTextPane (HTML 3.2)Browser (via embedded browser)
Embed control in web pageAppletJAppletHost control (ex. OLE)
Generic container of other controlsPanelJPanelComposite
Generic container of other controls with a borderPanel (if drawn manually)JPanel with a BorderComposite(SWT.BORDER)
Generic container of other controls with a border and titleN/AJPanel with a TitledBorderGroup
Radio button (one of set on)CheckboxJRadioButtonButton(SWT.RADIO)
Control extent of radio buttonsCheckboxGroupRadioButtonGroupGroup
Arrow buttonsN/AJButton with imageButton(SWT.ARROW)
Supports int'l text orientationsvia ComponentOrientationsame as AWTMany components support styles for this
Focus TraversalPolicy and Manager objectssame as AWTNext on control
Custom dialogsDialog subclassJDialog subclassDialog subclass
Access to system eventsEventQueue servicessame as AWTDisplay services (less robust than AWT)
System access dialogsFileDialogJColorChooser, JFileChooserColorDialog, DirectoryDialog, FileDialog, FontDialog, PrintDialog
Display simple message dialogN/A (must subclass Dialog)JOptionPane static methodsMessageBox with numerous styles
Display simple prompting dialogN/A (must subclass Dialog)JOptionPane static methodsN/A (classes exist in JFace to do this)
Layout managersBorderLayout, CardLayout, FlowLayout, GridLayout, GridBagLayoutAWT plus BoxLayout, CenterLayout, SpringLayoutFillLayout, FormLayout, GridLayout, RowLayout, StackLayout
Basic drawing controlCanvasJPanelCanvas
Basic drawingGraphics and Graphics2D objects - Basic shapes and text, arbitrary Shapes and Strokes, Bezier, fills, etc.same as AWTGC object - Basic shapes and text
Drawing transformsAffine, compositessame as AWTN/A
Off screen drawingBufferedImage, drawImagesame as AWTImage, drawImage
Double bufferingManualAutomatic or manualManual unless provided by host control
PrintingPrintJob and PrintGraphicssame as AWTdraw to Printer device
Custom colorsColorsame as AWTColor
Custom fontsFont, FontMetricssame as AWTFont
Cursors selectionCursorsame as AWTCursor
Image featuresload from file, create dynamically, extensive editssame as AWTload from file, create dynamically, basic edits
Input automationRobotsame as AWTN/A
Display a tool barN/AJToolBarToolBar, CoolBar
Display a progress barN/AJProgressBarProgressBar
Divide space between areasN/AJSplitPaneSash or SashForm
Display tabbed areasN/AJTabbedPaneTabFolder, CTabFolder
Display tabular infoN/AJTableTable
Format table columnsN/ATableColumnTableColumn
Display hierarchical infoN/AJTreeTree
Select from range of valuesN/AJSliderSlider
Select from discrete range of valuesN/AJSpinnerScale
Access to the base displayToolkit, GraphicsConfiguration, GraphicsDevicesame as AWTDisplay
Add items to the system trayN/AN/ATray
Key: N/A - Not available. In many cases, this feature can be created, with varying degrees of difficulty, by creating custom controls or containers of controls or by other custom programming.
This article provided a comparison between the Eclipse's Standard Windows Toolkit with JFace, and the Java's Swing and Abstract Windows Toolkit GUI tool kits. Through the comparisons provided here, you can decide which GUI tool kit to use for your new applications.
In most cases, the decision is between Swing and SWT combined with JFace. In general, each of these tool kits is complete and powerful enough to build full-function GUIs, but Swing is generally superior to SWT alone (used without JFace). Swing has the advantage of being built into Java technology, is completely portable, and arguably has a better architecture. Swing also has the advantage for advanced graphical applications. SWT has the advantage of being implemented as a native application which increases the performance and native compatibility of SWT-based GUIs.
If you are developing only for one platform, SWT has an advantage in host compatibility, including integration with host features, such as use of ActiveX controls under Windows.

Learn
Get products and technologies
Discuss
Barry Feigenbaum
Barry Feigenbaum, Ph.D., is a member of the IBM Worldwide Accessibility Center, which helps IBM make its products accessible to people with disabilities. He has published several books and articles, holds several patents, and has spoken at industry conferences, such as JavaOne. He has served as an adjunct assistant professor of computer science at the University of Texas at Austin and other schools.

-----
copied from: http://www.ibm.com/developerworks/grid/library/os-swingswt/