
Clase Oyente que no escucha
Publicado por Krystneidis (4 intervenciones) el 20/06/2015 18:35:09
PANTALLA MAIN DESPUES DEL LOGIN
PANTALLA REGISTRO DE CLIENTES
Igual anexo el código completo del proyecto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package inventariosuplires;
import java.awt.Container;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
public class FormMainMenu extends JFrame implements ActionListener{
private final JMenuBar Barra1;
private final JMenu Menu1, Menu2, Menu3, Menu4;
private final JMenuItem Item1, Item2, Item3, Item4, Item5, Item6, Item7, Item8;
public FormMainMenu(){
super("Main Menu");
setSize (500,400);
setLayout(null);
Barra1 = new JMenuBar();
setJMenuBar(Barra1);
Menu1 = new JMenu("Clientes");
Barra1.add(Menu1);
Menu2 = new JMenu("Articulo");
Barra1.add(Menu2);
Menu3 = new JMenu("Factura");
Barra1.add(Menu3);
Menu4 = new JMenu("Salir");
Barra1.add(Menu4);
Item1 = new JMenuItem("Registro");
Item1.addActionListener(this);
Menu1.add(Item1);
Item2 = new JMenuItem("Consulta");
Item2.addActionListener(this);
Menu1.add(Item2);
Item3 = new JMenuItem("Eliminar");
Item3.addActionListener(this);
Menu1.add(Item3);
Item4 = new JMenuItem("Registro");
Menu2.add(Item4);
Item5 = new JMenuItem("Consulta");
Menu2.add(Item5);
Item6 = new JMenuItem("Eliminar");
Menu2.add(Item6);
Item7 = new JMenuItem("Nueva");
Menu3.add(Item7);
Item8 = new JMenuItem("Consultar");
Menu3.add(Item8);
}
@Override
public void actionPerformed(ActionEvent e){
//
Container f = this.getContentPane();
FormClientesIng FCM = new FormClientesIng();
FCM.setVisible(true);
dispose();
// Este es el código que quiero me muestre o escuche la clase oyente y lo que sucede es que cuando le doy click al Item 1 == Registro en el menú Clientes me detiene la ejecución
if(e.getSource()==Item1){
getContentPane().add(FCM);
}
}
}
PANTALLA REGISTRO DE CLIENTES
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
package inventariosuplires;
import javax.swing.*;
import java.awt.*;
import java.text.ParseException;
import javax.swing.border.TitledBorder;
import javax.swing.text.MaskFormatter;
enum tipo {V, E, RIF};
public class FormClientesIng extends JPanel{
public JComboBox TipoID;
public JTextField ID;
public JTextField Nombre;
public JTextField Apellido;
public JTextField Direccion;
public JFormattedTextField CodTelefono;
public JTextField Telefono;
public JButton Boton1, Boton2, Boton3;
public FormClientesIng(){
setLayout(new GridLayout(8,3, 10,12));
setVisible(true);
TitledBorder titulo;
titulo = BorderFactory.createTitledBorder("Datos del Cliente");
setBorder(titulo);
JLabel TipoId = new JLabel("Tipo",JLabel.RIGHT);
TipoID = new JComboBox(tipo.values());
add(TipoId);
add(TipoID);
JLabel Id = new JLabel("Cedula o RIF", JLabel.RIGHT);
ID = new JTextField();
add(Id);
add(ID);
JLabel Nombres = new JLabel("Nombre", JLabel.RIGHT);
Nombre = new JTextField();
add(Nombres);
add(Nombre);
JLabel Apellidos = new JLabel("Apellido", JLabel.RIGHT);
Apellido = new JTextField();
add(Apellidos);
add(Apellido);
JLabel Direcciones = new JLabel("Dirección", JLabel.RIGHT);
Direccion = new JTextField();
add(Direcciones);
add(Direccion);
JLabel Codtelefono = new JLabel("COD", JLabel.RIGHT);
MaskFormatter format =null;
try {
format = new MaskFormatter("###");
}
catch(ParseException e){
System.out.println("Solo Digitos 3 digitos sin el cero ");
}
CodTelefono = new JFormattedTextField(format);
add(Codtelefono);
add(CodTelefono);
JLabel Telefonos = new JLabel("Telefonos", JLabel.RIGHT);
Telefono = new JTextField();
add(Telefonos);
add(Telefono);
Boton1 = new JButton ("Registrar");
add(Boton1);
Boton2 = new JButton ("Actualizar");
add(Boton2);
Boton3 = new JButton ("Salir");
add(Boton3);
}
}
Igual anexo el código completo del proyecto
Valora esta pregunta


0