In the below program i got the message while compile the program.
"note: <program name.java> uses or overrides a deprecated API." OR other are "note: recompile with -Xlint: deprecation for details."
so, how to solve this.
plz, tell me the..............
import java.awt.*;
import java.awt.event.*;
public class RandomColorDialogDemo extends Frame implements ActionListener
{
public static void main(String args[])
{
RandomColorDialogDemo rcdd = new RandomColorDialogDemo();
rcdd.setVisible(true);
rcdd.setSize(200,100);
}
RandomColorDialogDemo()
{
super("Random Color Dialog Demo");
setLayout(new FlowLayout());
Button b = new Button("Random Color Dialog Demo");
b.addActionListener(this);
add(b);
addWindowListener(new WindowAdapter (){
public void windowClosing(WindowEvent we){
System.exit(0);
}
});
}
public void actionPerformed(ActionEvent ae)
{
RandomColorDialog rcd = new RandomColorDialog(this,"Random Color Dialog",true);
rcd.show();
}
}
class RandomColorDialog extends Dialog implements ActionListener
{
RandomColorDialog(Frame parent,String title,boolean mode)
{
super(parent, title, mode);
Panel pc = new Panel();
Canvas canvas = new Canvas();
canvas.setSize(100,100);
int red = (int)(255*Math.random());
int green = (int)(255*Math.random());
int blue = (int)(255*Math.random());
Color color = new Color(red,green,blue);
canvas.setBackground(color);
pc.add(canvas);
add(pc,"center");
Panel ps = new Panel();
Button ok = new Button("OK");
ok.addActionListener(this);
ps.add(ok);
add(ps,"south");
//LAt out componets and set the initial size of this Dialog box
pack();
addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent we){
dispose();
}
});
}
public Insets getInsets()
{
return new Insets(40,20,20,20);
}
public void actionPerformed(ActionEvent ae)
{
dispose();
}
}