Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / November 2005

Tip: Looking for answers? Try searching our database.

Replacement requested for depricated coding.

Thread view: 
bherbst65@hotmail.com - 16 Nov 2005 23:24 GMT
Hi All,

This snip has been depreciated. And the warning displayed  is below
that.
Imports  are shown:

import java.awt.*;
import java.net.URL;
import java.net.MalformedURLException;
................. snip below

public boolean action(Event evt, Object arg) {
   if (evt.target instanceof Button) {
     LinkTo((String)arg);
     return true;
   }
   else return false;
 }

1 warning found:
File: C:\Documents and Settings\R
Herbst\Desktop\BlueJProjects\BookMarkingURLS\BookMrkingURLs.java
[line:
43]
Warning: [deprecation] action(java.awt.Event,java.lang.Object) in
java.awt.Component has been deprecated

TIA,
Bob
Bjorn Abelli - 17 Nov 2005 00:14 GMT
<bherbst65@hotmail.com> wrote...

> This snip has been depreciated. And the warning
> displayed  is below that.

> 1 warning found:
> File: C:\Documents and Settings\R
> Herbst\Desktop\BlueJProjects\BookMarkingURLS\BookMrkingURLs.java
> [line: 43]
> Warning: [deprecation] action(java.awt.Event,java.lang.Object) in
> java.awt.Component has been deprecated

So, we'll read the message:

 - the method "action" in "java.awt.Component" has been deprecated.

Let's see what the docs says about it:

http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Component.html#action(java.awt.
Event,%20java.lang.Object)%20

or
http://tinyurl.com/e3kfc

"Deprecated. As of JDK version 1.1, should register this component as
ActionListener on component which fires action events."

So, what you should do is to let your component implement the interface
ActionListener, and put the code from "action" into another method, called
"actionPerformed" instead.

http://java.sun.com/j2se/1.5.0/docs/api/java/awt/event/ActionListener.html#actio
nPerformed(java.awt.event.ActionEvent)%20

or
http://tinyurl.com/bggrj

// Bjorn A


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.