botonEliminar.setText("Eliminar");
botonEliminar.setBounds(new Rectangle(237, 15, 100, 20));
//botonEliminar.setIcon(new ImageIcon(getClass().getResource("/imagenes/eliminar.gif")));
botonEliminar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
Cliente c = new Cliente();
c.setIdCliente(Integer.valueOf(textoId.getText()));
Cliente cliente=new Cliente();
for(int i=0;i<ClienteDTO.listaClientes().size();i++ ){
cliente =(Cliente)ClienteDTO.listaClientes().get(i);
if (cliente.getIdCliente().equals(c.getIdCliente()))
break;
}
int opcion = JOptionPane.showConfirmDialog(null,"�Est� seguro que desea eliminar al clientes?");
if(opcion == JOptionPane.YES_OPTION)
{
ClienteDTO.EliminaCliente(c);
cargarTablaClientes();
}
}
});
botonNuevo = new JButton();
//botonNuevo.setIcon(new ImageIcon(getClass().getResource("/imagenes/agregar.gif")));
botonNuevo.setBounds(new Rectangle(10, 15, 100, 20));
botonNuevo.setText("Nuevo");
botonNuevo.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent e)
{
AltaCliente a = new AltaCliente(AbmCliente.this);
AbmCliente.this.removeAll();
AbmCliente.this.add(a);
AbmCliente.this.repaint();
}
});
botonModificar = new JButton();
botonModificar.setText("Modificar");
botonModificar.setBounds(new Rectangle(124,15, 100, 20));
//botonModificar.setIcon(new ImageIcon(getClass().getResource("/imagenes/modificar.gif")));
botonModificar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
Cliente c=new Cliente();
c.setIdCliente(Integer.valueOf(textoId.getText()));
Cliente cliente=new Cliente();
for(int i=0;i<ClienteDTO.listaClientes().size();i++ ){
cliente =(Cliente)ClienteDTO.listaClientes().get(i);
if (cliente.getIdCliente().equals(c.getIdCliente()))
break;
}
ModificarCliente m=new ModificarCliente(AbmCliente.this,cliente);
AbmCliente.this.removeAll();
AbmCliente.this.repaint();