Java Technology Home Page
A-Z Index

Java Developer Connection(SM)
Online Training

Downloads, APIs, Documentation
Java Developer Connection
Tutorials, Tech Articles, Training
Online Support
Community Discussion
News & Events from Everywhere
Products from Everywhere
How Java Technology is Used Worldwide
 
Training Index

Fundamentals of Swing: Part I
Magercises

By MageLang Institute

[Short Course | About This Short Course]

These Magercises show how to use the Swing components of the JavaTM platform to interact with Java forms and windows. When you finish these Magercises, you should be comfortable using the Swing component set where you would previously have used AWT components.

Magercise Outline

About Magercises

A Magercise is a flexible exercise that provides varying levels of help according to the student's needs. Some students may complete the magercise using only the information and the task list in the Magercise body; some may want a few hints; (Help) while others may want a step-by-step guide to successful completion (Solution). Since complete solutions are provided in addition to help, students can skip a Magercise (or several) and still be able to complete later Magercises that required the skipped one(s).

The Anatomy of a Magercise

Each Magercise includes a list of any prerequisite Magercises, a list of skeleton code for you to start with, links to necessary API pages, and a text description of the Magercise's educational goal. In addition, buttons link you to the following information:
  • Help : Gives you help or hints on the current Magercise (an annotated solution).For ease of use, the task information is duplicated on the help page with the actual help information indented beneath it.
  • Solution: The <applet> tag and JavaTM source resulting in the expected behavior.
  • API Documentation: A link directly to any necessary online API documentation.

Magercise Design Goals

There are three fundamental magercise types that you may encounter:
"Blank screen"
You are confronted with a "blank screen" and you create the entire desired functionality yourself.
Extension
You extend the functionality of an existing, correctly-working program.
Repair
You repair undesirable behavior in an existing program.

To make learning easier, Magercises, where possible, address only the specific technique being taught in that Magercise. Irrelevant, unrelated, and overly complex materials are avoided.

Where possible, Magercises execute via the web. However, Magercises that must access JavaTM features or library elements that could cause security violations are not executed on the web.

Magercises, Swing: Part I

1. Installing Swing and SwingSet Demonstration

Install Swing and demonstrate the SwingSet examples.

Educational goal(s):

See the different Swing components in action
2. Creating Your First JFC Application

Create a simple application with a Frame and a few Swing buttons.

Educational goal(s):

  • Setup the environment to compile and run Swing programs
  • Examine basic Swing Frame-based application
  • Learn that Swing components can be used just like AWT components
  • Use JDK 1.1 events to respond to button presses
3. Creating Buttons With Icons

Create image buttons with keyboard accelerators.

Educational goal(s):

  • Learn to use an Icon as a JButton label
  • Learn to use keyboard accelerators with buttons
  • Use JDK 1.1 events to respond to button presses
  • Add components to a JFrame
4. Using Toggles

Create a program to demonstrate checkboxes and radio buttons.

Educational goal(s):

  • Learn about the JCheckbox class
  • Learn about the JRadioButton class
  • Learn about using icons with your checkboxes
  • Learn about the JScrollPane class
5. Using Borders

Change the default border around a JButton and create your own dashed border.

Educational goal(s):

  • Learn about the javax.swing.border package
  • Learn to change a button's border
  • Learn to create your own borders
6. Using Menus, Toolbars, and Tool Tips

Setup the menus, toolbar, and toolbar tool tips for a simple text editor.

Educational goal(s):

  • Learn about JMenu, JMenuItem, and JMenuBar
  • Learn how to work with JToolBar and tool tips
  • Learn about the JDialog class
7. Using BoxLayout

Create an application using the BoxLayout layout manager.

Educational goal(s):

  • Learn about the Box class
  • Learn about the BoxLayout class ("glue" and "struts") and how to use it for simple layouts
  • Learn about using animated ImageIcon objects

About This Short Course

Short Course

Copyright © 1998-1999 MageLang Institute. All Rights Reserved.


[ This page was updated: 19-Nov-99 ]

Products & APIs | Developer Connection | Docs & Training | Online Support
Community Discussion | Industry News | Solutions Marketplace | Case Studies
Glossary - Applets - Tutorial - Employment - Business & Licensing - Java Store - Java in the Real World
FAQ | Feedback | Map | A-Z Index
For more information on Java technology
and other software from Sun Microsystems, call:
(800) 786-7638
Outside the U.S. and Canada, dial your country's AT&T Direct Access Number first.
Sun Microsystems, Inc.
Copyright © 1995-99 Sun Microsystems, Inc.
All Rights Reserved. Legal Terms. Privacy Policy.