Newsgroup: it.comp.java
Titolo: Errore....aiuto...!!!

nel compilare con JAVAC il mio file
finder.java, riscontro questo errore, chi mi puņ aiutare...??
Scusate ma sono alle prime armi.
********************************************************************************
finder.java:831: warning: action(java.awt.Event,java.lang.Object) in
java.awd.Component
has been deprecated
public boolean action(Event event, Object obj)
********************************************************************************
*
Grazie a chi potrą aiutarmi.
Andrea



stai usando un metodo il cui uso e' sconsigliato (perche' obsoleto)
devi usare l'interfaccia ActionListener
ti allego un esempietto che postai tempo fa' (spero ti sia utile)
************************************
/*
 * DemoScacchiera.java (applet) - version 1.0
 * Copyright (C) 2000 Andrea Medeghini
 * 
http://digilander.iol.it/schiele
 */
import  java.applet.*;
import  java.awt.*;
import  java.awt.event.*;
public class DemoScacchiera extends Applet implements ActionListener
{
	private Scacchiera s;
	private Button r;
	private Button b;
	public DemoScacchiera() { super(); }
	public void start()
	{
		int w = getSize().width;
		int h = getSize().height;
		s = new Scacchiera(50,Color.black);
		b = new Button("black");
		r = new Button("red");
		TextField t = new TextField("50");
		s.setSize(w,h - 20);
		r.setSize(40,20);
		b.setSize(40,20);
		t.setSize(w - 80,20);
		GridBagLayout l = new GridBagLayout();
		GridBagConstraints c = new GridBagConstraints();
		setLayout(l);
		c.fill = GridBagConstraints.HORIZONTAL;
		c.gridwidth = GridBagConstraints.REMAINDER;
		l.setConstraints(s,c);
		c.gridwidth = 1;
		l.setConstraints(b,c);
		l.setConstraints(r,c);
		c.gridwidth = GridBagConstraints.REMAINDER;
		l.setConstraints(t,c);
		add(s);
		add(b);
		add(r);
		add(t);
		setSize(getPreferredSize());
		r.addActionListener(this);
		b.addActionListener(this);
		t.addActionListener(this);
		b.setEnabled(false);
	}
	public void actionPerformed(ActionEvent e)
	{
		if ((e.getActionCommand()).compareTo("red") == 0)
		{
			s.setColor(Color.red);
			b.setEnabled(true);
			r.setEnabled(false);
		}
	else if ((e.getActionCommand()).compareTo("black") == 0)
		{
			s.setColor(Color.black);
			r.setEnabled(true);
			b.setEnabled(false);
		}
		else
		{
			try
			{
s.setNumber(Integer.parseInt(e.getActionCommand()));
			}
			catch (NumberFormatException i)
			{
				System.out.println(i);
			}
		}
	}
}
class Scacchiera extends Canvas
{
	private int n = 50;
	private Color c = Color.black;
	public Scacchiera(int i,Color q)
	{
		super();
		n = i;
		c = q;
	}
	public void update(Graphics g)
	{
		paint(g);
	}
	public void paint(Graphics g)
	{
		g.setPaintMode();
		int w = getSize().width;
		int h = getSize().height;
		int dw = (int)Math.ceil(((double)w) / n);
		int dh = (int)Math.ceil(((double)h) / n);
		int y;
		int x;
		y = 0;
		for (int i = 0; i < n; i++)
		{
			x = 0;
			for (int j = 0; j < n; j++)
			{
		g.setColor((((i + j) % 2) == 0) ? Color.white : c);
				g.fillRect(x,y,dw,dh);
				x += dw;
			}
			y += dh;
		}
	}
	public void setNumber(int i)
	{
	       n = i;
	       repaint();
	}
	public int getNumber()
	{
	       return(n);
	}
	public void setColor(Color q)
	{
	       c = q;
	       repaint();
	}
	public Color getColor()
	{
	       return(c);
	}
}
***************************
<HTML>
<BODY>
<CENTER>
<APPLET code="DemoScacchiera" width="300" height="320"></APPLET>
</CENTER>
</BODY>
</HTML>
**************************
ciao_O
Andrea
Andrea
http://digilander.iol.it/schiele