Ver Mensaje Individual
  #4 (permalink)  
Antiguo 04/08/2011, 10:40
sterlingdiazd
 
Fecha de Ingreso: junio-2009
Mensajes: 88
Antigüedad: 14 años, 10 meses
Puntos: 4
Respuesta: Metodo getSelectedRow() no retorna la fila seleccionada

Este esta es la parte que No funciona bien. Es en el Editar Evento.

Código Java:
Ver original
  1. //PANEL EVENTOS
  2.        
  3.         JPanel panel_Eventos = new JPanel();
  4.         tabbedPane.addTab("Eventos", new ImageIcon("C:\\Documents and Settings\\BlackCrystal\u2122\\Escritorio\\Indigo\\workspace\\ProyectoFinal\\src\\images\\Icono_Eventos.png"), panel_Eventos, null);
  5.         panel_Eventos.setLayout(null);
  6.        
  7.             //DATOS EVENTOS
  8.        
  9.             JPanel Datos_Eventos = new JPanel();
  10.             Datos_Eventos.setBounds(10, 10, 770, 70);
  11.             Datos_Eventos.setBorder(new TitledBorder(null, "Mantenimiento de Eventos", TitledBorder.LEADING, TitledBorder.TOP, null, null));
  12.             panel_Eventos.add(Datos_Eventos);
  13.             Datos_Eventos.setLayout(new FlowLayout(FlowLayout.CENTER, 12, 5));
  14.        
  15.             JLabel lblNombre_Eventos = new JLabel("Nombre");
  16.             Datos_Eventos.add(lblNombre_Eventos);
  17.        
  18.             txtNombre_Eventos = new JTextField();
  19.             txtNombre_Eventos.setColumns(10);
  20.             Datos_Eventos.add(txtNombre_Eventos);
  21.        
  22.             JLabel lblFecha_Eventos = new JLabel("Fecha");
  23.             Datos_Eventos.add(lblFecha_Eventos);
  24.            
  25.             txtFecha_Eventos = new JTextField();
  26.             txtFecha_Eventos.setColumns(10);
  27.             Datos_Eventos.add(txtFecha_Eventos);
  28.            
  29.             JLabel lblLugar_Eventos = new JLabel("Lugar");
  30.             Datos_Eventos.add(lblLugar_Eventos);
  31.            
  32.             txtLugar_Eventos = new JTextField();
  33.             txtLugar_Eventos.setColumns(10);
  34.             Datos_Eventos.add(txtLugar_Eventos);
  35.            
  36.             //FUNCIONALIDADES EVENTOS
  37.        
  38.             JPanel Funcionalidades_Eventos = new JPanel();
  39.             Funcionalidades_Eventos.setBorder(new TitledBorder(null, "Funcionalidades", TitledBorder.LEADING, TitledBorder.TOP, null, null));
  40.             Funcionalidades_Eventos.setLayout(null);
  41.             Funcionalidades_Eventos.setBounds(202, 90, 385, 100);
  42.             panel_Eventos.add(Funcionalidades_Eventos);
  43.        
  44.                 //  INSERTAR EVENTO
  45.                
  46.                 JButton btnInsertar_Eventos = new JButton("");
  47.                 btnInsertar_Eventos.addActionListener(new ActionListener() {
  48.                     public void actionPerformed(ActionEvent arg0) {
  49.                        
  50.                         modelo_Evento.insertar(new Evento(txtNombre_Eventos.getText(),txtFecha_Eventos.getText(), txtLugar_Eventos.getText() ));
  51.                        
  52.                         JOptionPane.showMessageDialog( new DialogoInicioSesion( new Vista() ),
  53.                                 "Evento agregado satisfactoriamente." +
  54.                                 "\nCuando desee modificar un evento," +
  55.                                 "\nseleccionelo y dele click a editar.",   
  56.                                 "Evento Agregado", JOptionPane.INFORMATION_MESSAGE);
  57.                        
  58.                     }
  59.                 });
  60.                 btnInsertar_Eventos.setIcon(new ImageIcon("C:\\Documents and Settings\\BlackCrystal\u2122\\Escritorio\\Indigo\\workspace\\ProyectoFinal\\src\\images\\Icono_Insertar.png"));
  61.                 btnInsertar_Eventos.setToolTipText("Insertar");
  62.                 btnInsertar_Eventos.setBounds(10, 25, 65, 63);
  63.                 Funcionalidades_Eventos.add(btnInsertar_Eventos);
  64.            
  65.                 //  EDITAR EVENTO
  66.                
  67.                 JButton btnEditar_Eventos = new JButton("");
  68.                 btnEditar_Eventos.addActionListener(new ActionListener() {
  69.                     public void actionPerformed(ActionEvent e) {
  70.                    
  71.                         filaSeleccionadaEvento = tablaEventos.getSelectionModel().getLeadSelectionIndex();
  72.                         System.out.println( tablaEventos.getSelectionModel().getLeadSelectionIndex() );
  73.                         txtNombre_Eventos.setText(  modelo_Evento.eventos.get(filaSeleccionadaEvento).getNombre_Evento() );
  74.                         txtFecha_Eventos.setText(   modelo_Evento.eventos.get(filaSeleccionadaEvento).getFecha_Evento() );
  75.                         txtLugar_Eventos.setText(   modelo_Evento.eventos.get(filaSeleccionadaEvento).getUbicacion_Evento() );
  76.                        
  77.                         JOptionPane.showMessageDialog( new DialogoInicioSesion( new Vista() ),
  78.                         "Los datos del evento que desea editar" +
  79.                         "\nestan en los campos superiores de la pantalla." +
  80.                         "\nCuando haya concluido haga click en Modificar.",
  81.                         "Edicion de Evento", JOptionPane.INFORMATION_MESSAGE);
  82.                     }
  83.                 });
  84.                 btnEditar_Eventos.setIcon(new ImageIcon("C:\\Documents and Settings\\BlackCrystal\u2122\\Escritorio\\Indigo\\workspace\\ProyectoFinal\\src\\images\\Icono_Editar.png"));
  85.                 btnEditar_Eventos.setBounds(85, 25, 65, 63);
  86.                 Funcionalidades_Eventos.add(btnEditar_Eventos);