uses or override a depricated API plz help

S

Sweety

hello,
why the following code shows warning?running card.class shows error.

import java.awt.*;
import java.applet.Applet ;
public class card extends Applet
{
CardLayout layout ;
public void init()
{
layout = new CardLayout() ;
setLayout( layout ) ;
add( new Button( "First" ) ) ;
add( new Button( "Second" ) ) ;
add( new Button( "Third" ) ) ;
add( new Button( "Fourth" ) ) ;
add( new Button( "Fifth" ) ) ;
}
public boolean action( Event evt, Object arg )
{
if ( evt.target instanceof Button )
{
layout.next(this) ;
return true ;
}
return false ;
}
}
thanks,
Sweety.
 
C

Christophe Vanfleteren

Sweety said:
hello,
why the following code shows warning?running card.class shows error.

import java.awt.*;
import java.applet.Applet ;
public class card extends Applet
{
CardLayout layout ;
public void init()
{
layout = new CardLayout() ;
setLayout( layout ) ;
add( new Button( "First" ) ) ;
add( new Button( "Second" ) ) ;
add( new Button( "Third" ) ) ;
add( new Button( "Fourth" ) ) ;
add( new Button( "Fifth" ) ) ;
}
public boolean action( Event evt, Object arg )
{
if ( evt.target instanceof Button )
{
layout.next(this) ;
return true ;
}
return false ;
}
}
thanks,
Sweety.

What warning and what error? Does it compile?
Did you use javac with the -deprecation flag?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top