Ver Mensaje Individual
  #2 (permalink)  
Antiguo 17/09/2015, 11:23
Avatar de Profesor_Falken
Profesor_Falken
 
Fecha de Ingreso: agosto-2014
Ubicación: Mountain View
Mensajes: 1.323
Antigüedad: 9 años, 9 meses
Puntos: 182
Respuesta: No pasa el if

Buenas,

Tienes creada una variable de instancia llamada 'boton' que nunca inicializas.
En su lugar crear una variable local llamada tambien 'boton' y la inicializas y aniades al Jframe.
Por tanto, cuando llegas al actionPerformed, la variable de instancia 'boton' vale null porque nunca le has asignado un valor.

En resumen, para que funcione como quieres solo tienes que cambiar la linea:
Código Java:
Ver original
  1. JButton boton = new JButton("Siguiente Frame");

Por esta:
Código Java:
Ver original
  1. this.boton = new JButton("Siguiente Frame");

Un saludo
__________________
If to err is human, then programmers are the most human of us