Using Swing with Code Warrior


Java 2 on MacOS

At the time this was written, MRJ (Apple's runtime environment for Java) does not support the Java 2 standard. The MetroWorks compiler will compile Java 2 code, but it will generate an error when you attempt to run it on the Mac.

The method parseDouble() is therefore not supported. You can accomplish the same thing by replacing:

   double age = Double.parseDouble(ageString);

with

   double age = Double.valueOf(ageString).doubleValue();

 

Swing on MacOS

The swing package is supported by MRJ. To get it to work you will need to add the library swingall.jar. It should be in the directory:

   CodeWarrior Pro 5:Metroworks CodeWarrior:Java Support:Libraries. 

Make sure your project is open in IDE and click and drag swingall.jar to your project window (the XXXX.mcp window, where XXXX is the name of your project.).


 

Back to the Lab


Back to the Table of Contents

Back to the Introduction


Copyright 2000 by Prentice Hall. All rights reserved.