Error while running

when i run a program

import java.awt.*;

public class GetFrameExample extends java.applet.Applet {

TextArea frameLog = new TextArea(10, 60);

Dialog dialog;

/** Builds the interface. */

public void init() {

add(frameLog);

add(new Button("Create Dialog"));

}

/** Creates a dialog in response to button press. */

public boolean action(Event evt, Object what) {

if (evt.target instanceof Button) {

dialog = new GetFrameDialog(this, getFrame(this), false);

dialog.resize(360, 120);

dialog.setBackground(Color.green);

dialog.setVisible(true);

//dialog.show();

//return true;

}

return super.action(evt, what);

}

public static Frame getFrame(Component comp) {

for (Component c = comp; c != null; c = c.getParent()) {

if (c instanceof Frame) {

return (Frame) c;

}

}

return null;

}

/** Enters frame information into the log. */

public void logFrame(String s) {

frameLog.appendText(s);

}

/** Finds the frame for the mouse-down target component. */

public boolean mouseDown(Event evt, int x, int y) {

Frame frame = getFrame((Component)evt.target);

logFrame("In applet, x = " + x + ", y = " + y

+ ", frame: " + frame.getClass() + "\n");

return true;

}

public void paint(Graphics g) {

g.setColor(Color.blue);

g.fillRect(0, 0, size().width, size().height);

}

}

class GetFrameDialog extends Dialog {

Button myButton;

GetFrameExample controller;

GetFrameDialog(GetFrameExample d, Frame f, boolean modal) {

super(f, modal);

setLayout(new FlowLayout());

controller = d;

myButton = new Button("Destroy Dialog");

add(myButton);

myButton.setBackground(Color.lightGray);

}

/** Destroys the dialog if a WINDOW_DESTROY event is received. */

public boolean handleEvent(Event evt) {

if (evt.id == Event.WINDOW_DESTROY) {

this.dispose();

return true;

}

return super.handleEvent(evt);

}

/** Dismisses this dialog when the dismiss button is pressed. */

public boolean action(Event evt, Object what) {

if (evt.target instanceof Button) {

this.dispose();

return true;

}

return super.action(evt, what);

}

/** Finds the frame for the mouse-down target component. */

public boolean mouseDown(Event evt, int x, int y) {

Frame frame = GetFrameExample.getFrame((Component)evt.target);

controller.logFrame("In dialog, x = " + x + ", y = " + y

+ ", frame: " + frame.getClass() + "\n");

return true;

}

}

this shows the error as

Note: C:\JAVA\MyPrograms\GetFrameExample.java uses or overrides a deprecated API.

Note: Recompile with -Xlint:deprecation for details.

Please help me to solve this.

Saumya

[2976 byte] By [SaumyaSama] at [2007-11-26 18:08:16]
# 1

Do what it says -- recompile with the argument -Xlint:deprecation to get more details.

Then see what deprecated stuff you're using.

Then you can choose to either ignore the warning (it's not an error), or fix it. If you check the API docs with the info you get from the recompile, it may say what you should use instead.

paulcwa at 2007-7-9 5:39:54 > top of Java-index,Java Essentials,Java Programming...
# 2
most of the methods use for TextArea and Component are Deprecated... read the javadoc to see the new methods to use
suparenoa at 2007-7-9 5:39:54 > top of Java-index,Java Essentials,Java Programming...