Introduction to Spring using Swing

来源:百度文库 编辑:神马文学网 时间:2024/05/01 12:51:32
    Country/region [select]     Terms of use


All of dW -----------------   eServer   Information Mgmt   Lotus   Rational   Tivoli   WebSphere   Workplace -----------------   Autonomic computing   Grid computing   Java technology   Linux   Open source   Power Architecture   SOA & Web services   Web architecture   Wireless   XML -----------------   dW forums ----------------- alphaWorks ----------------- All of IBM    
Home     Products     Services & solutions     Support & downloads     My account
 
developerWorks
In this tutorial:
Before you start
About this tutorial
Prerequisites
Overview of Spring and dependency injection
Environment setup
Creating the to-do list: Basic Swing and Spring application setup
Creating the to-do list: Making a reusable component and showing data in a table
Creating the to-do list: Finishing up with buttons and listeners
The Spring Rich Client Project
Summary
Download
Resources
About the author
Rate this tutorial


developerWorks  >  Java technology  >
Introduction to Spring using Swing
Dependency injection and rich clients

Page 1 of 12 
Document options

Print this page

PDF - A4
189 KB

PDF - Letter
194 KB

Get Adobe® Reader®

Sample code
developerWorks comes to you!

Export content to your iGoogle page and desktop
Rate this tutorial

Help us improve this content
Level: Intermediate
Chad Woolley (thewoolleyman@gmail.com), Software Developer, Ionami
08 Nov 2005
This tutorial introduces you to the Spring framework and the concept of dependency injection (also known as Inversion of Control), in the context of writing a simple Java™ Swing GUI application. You will develop a complete, working application from the ground up. You‘ll also get a taste of the Spring Rich Client Project, a new framework for developing Swing applications under Spring. You‘ll come away with an appreciation of Spring‘s versatility and the ways in which it can ease your development tasks.
Before you start
This tutorial will help you learn the basics of the Spring framework for application development, using Swing, and dependency injection, also known as Inversion of Control (IOC). After a brief overview of Spring and dependency injection, the bulk of the tutorial is hands-on, walking you step-by-step through creating a fully functional Swing application -- a to-do list program -- using Spring. The walk-through includes three options for a build environment, with detailed setup instructions for each one. You‘ll learn the basic use and benefits of the Spring framework in the process. Explanations of other relevant concepts are included along the way. You‘ll also take a few side trips to learn some good programming practices in the context of the tutorial code.
The last section is a brief and high-level review of the Spring Rich Client (RCP) framework, a subproject of the Spring framework that‘s working to provide a platform for developing rich-client Swing applications under Spring. The tutorial does not include step-by-step instructions for using the Spring RCP but is a starting point for obtaining the source code and exploring the project on your own.
The tutorial shows each new piece of code that you need to type. The complete source code is also available (seeDownload). The downloadable source code was created by following along and pasting code directly from the tutorial, so it should be bug-free and identical to what you create as you follow along. Because you‘ll write the GUI application in the Java programming language, it will run on any platform that Java code runs on.
This tutorial is not intended to be a comprehensive overview of the Spring framework or Swing. It does not cover use of Spring to create Web applications or access databases, or more-advanced topics such as Spring‘s support for aspect-oriented programming (AOP). Explore the tutorial‘sResources for books, articles, tutorials, and online references that cover Spring and Swing in greater breadth and detail.


Back to top
The audience for this tutorial is Java developers. It is intended to be accessible to multiple experience levels, and even if you are familiar with one topic you might still learn something about another. Some sections discuss related design patterns and development approaches. Feel free to skim past these if you are uninterested or already familiar with them. The following knowledge and skill levels will be helpful:
Familiarity with the basics of the Java programming language, conventions for Java bean components, and experience with basic application design and development in the Java language.
Basic knowledge of some build environment -- either Eclipse, Apache Ant, or Apache Maven (seeResources). But even if you are unfamiliar with these environments, you can follow the tutorial‘s fairly detailed instructions for using them. If you have problems with one, you can try one or both of the other two.
Basic knowledge of XML syntax -- elements, attributes, and how to maintain a well-formed XML document (seeResources).
Some basic familiarity with theSwing API, although the tutorial attempts to avoid the use of complex Swing code.
You need a computer with a JDK installed (JDK 1.5 is required to run the Rich Client Project demo in the final section) and an Internet connection for downloading the required tools and libraries.
One of the following is required, or you can use your own build environment or IDE:
Apache Ant Version 1.6.1 or higher, available athttp://ant.apache.org
Apache Maven Version 1.0.2 or higher, available athttp://maven.apache.org
Eclipse version 3.0, 3.1, or higher, available athttp://www.eclipse.org
In order to minimize the amount of up-front downloading work required to start the tutorial, both the Ant and Maven build scripts in the tutorial‘s source code provide support for automatically downloading the required dependency JARs (including Spring itself) from public repositories. This feature is built into Maven, and it is provided in the Ant script by the get-dependencies target. To use these features with Eclipse, you must have Ant or Maven installed. You‘ll find more details inEnvironment setup.
You can obtain the correct required JAR versions manually if you prefer. Just refer to the get-dependencies target in the Ant build.xml file (seeListing 1) to find out which JARs and versions are required, as well as the URLs to download them from.


Back to top
Page 1 of 12 

About IBM     Privacy     Contact