Getting started with Eclipse and Swing

The May 2003 issue of Personal Computer World includes the first part of my tutorial on Eclipse and Swing. Note that all the files you need to get going are on the CD, including Eclipse itself and the complete official Sun Java SDK. From this page you can:

Download the example files
This is the complete project, although the second part of the tutorial won't appear in PCW until the June issue

View the Installation Instructions

Discuss the project in PCW Visual Programming Hands On Feedback Forum

Quick FAQ

Q. Where can I find more information on Eclipse?

A. The source for all things Eclipse is

Q. Where can I find more information on Java?

A. Start at Sun's Java site

Q. Why have you got three classes in the project, when frankly it could easily be implemented as a single class?

A. The project is intended to give you ideas about how to build a more significant Java project.

Q. Why have you used absolute positioning instead of a proper layout manager?

A. The July PCW will include a discussion of layout and an example of using a layout manager to achieve consistent layout across different platforms and screen resolutions.

Q. I'd like to see more/less Java content in PCW

A. Please give me feedback, either via email or through the Forum. Obviously space is limited, and software development is a huge topic, but we're guided by readers as to the sort of thing you'd like covered.

Installing the example project

Note: This might work on Windows 98, but Windows 2000 or XP is highly recommended. Eclipse is also available for other platforms, but the PCW CD includes only Windows installers.

1. Install the JDK from the May 2003 PCW CD

2. Install Eclipse, by copying the directory Software\Eclipse from the CD to your hard drive. For example, C:\Eclipse.

3. Run Eclipse. If you need to locate a Java runtime, point it at the location of the JDK, for example: C:\J2sdk1.4.1_01

4. Unpack the files in to a folder on your hard drive, say c:\pcwSwing

5. In Eclipse, choose File - Import - Existing Project into Workspace. When prompted to browse for the contents, find c:\pcwSwing and click OK.

6. From the Eclipse Window menu, choose Open Perspective - Java

7. Click the Run icon, or from the Run menu choose Run... You will be prompted to create a launch configuration.

8. In the launch configuration wizard, choose Java Application and click New.

9. The wizard will likely find the PCWSwing project automatically. If it does not, select PcwSwing for the project and pcwSwing.Application for the Main class. Click Apply and then Run.

10. All going well, the tutorial application will now run. Have fun exploring Eclipse

Tim Anderson
March 2003

Back to PCW index