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
Print Button
 
Training Index

Converting an Applet to an Application


by jGuru

Exercise  API Docs  About This Short Course  Short Course  Exercises

Help is available for each task.



Task 1

Create class ColoredPanesAppl with nothing but a main() method that creates an instance of class ColoredPanesWindow, which you will create in the next task. Show that window.


Use setVisible(true) to make a Frame instance visible.

Task 2

Create class ColoredPanesWindow. Turn the applet init() into the constructor. Set the size to 100 x 100.


As an alternative, you could, of course, simply call the init() method from the constructor.

Task 3

Add window-closing event handling to ColoredPanesWindow so you can close the window.


You can do this with an anonymous class:

    addWindowListener(new WindowAdapter() {
      public void windowClosing(WindowEvent e) {
        setVisible(false);
        dispose();
        System.exit(0);
      }
    });

Copyright 1996-2000 jGuru.com. All Rights Reserved.


Print Button
[ This page was updated: 14-Jul-2000 ]
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-2000 Sun Microsystems, Inc.
All Rights Reserved. Terms of Use. Privacy Policy.