Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: javax.swing.JButton cannot be..
Publicado por Jessica (3 intervenciones) el 28/10/2018 20:41:08
Me aparece este error: Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: javax.swing.JButton cannot be cast to buscaminasinterfaz.Boton
al hacer esto:
Mi clase Boton es:
Me podrían decir por qué me aparece?
al hacer esto:
1
Boton b = (Boton) e.getSource();
Mi clase Boton es:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package buscaminasinterfaz;
import javax.swing.JButton;
import buscaminasinterfaz.Casilla;
public class Boton extends JButton{
public int x;
public int y;
public Casilla casilla;
public Boton(){
this.setSize(35,35);
}
}
Me podrían decir por qué me aparece?
Valora esta pregunta


0