The following code compiles with only a "deprecated"
warning under jdk1.2 for Windows98: 

#######################################

import java.awt.*;
import java.io.*;
import java.util.*;

public class problem extends java.applet.Applet {

  Button execute_button;

  TextArea output;

  public void init () {

    this.setLayout (new BorderLayout ());
    Panel p = new Panel ();
    p.setLayout (new FlowLayout (FlowLayout.LEFT));
    execute_button = new Button ("Hello World");
    p.add (execute_button);
    this.add ("North", p);
    output = new TextArea (10, 60);
    this.add ("Center", output);
  }

  public boolean action (Event ev, Object arg) {
    if (ev.target == execute_button) {
      try {
        output.setText (null);
        output.appendText ("Some text\n");
      }
      catch (Exception e) {
        output.appendText (e.getMessage () + "\n");
      }
      return true;
    }
    else
        return false;
  }
}

#######################################

But when I try to compile it under jdk1.2 for Linux
(jdk1.2pre-v1.tar.bz2..bz2), I get the following
errors:

#######################################

problem.java:29: warning: class java.awt.Event in
package java.awt has been deprecated

  public boolean action (Event ev, Object arg) {
                         ^

problem.java:30: variable target not found in class
java.awt.Event

    if (ev.target == execute_button) {
           ^
problem.java:36: function appendText(java.lang.String)
not found in class java.awt.TextArea

        output.appendText (e.getMessage () + "\n");
               ^
problem.java:33: function appendText(java.lang.String)
not found in class java.awt.TextArea

        output.appendText ("Some text\n");
               ^
3 errors
1 warning

#######################################

What am I missing? The downloaded file untar'd OK, and
I am able to compile other code OK. It's almost as if
some of the foundation classes were missing from the
download. These errors result whether I set my
CLASSPATH or not.

Thanks

Glenn Wiens
[EMAIL PROTECTED]

_____________________________________________________________
Do You Yahoo!?
Free instant messaging and more at http://messenger.yahoo.com


----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to