Package editor

Source Code of editor.EditorPresupuesto

package editor;

import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JDialog;
import javax.swing.JOptionPane;
import javax.swing.JTable;
import javax.swing.table.TableCellEditor;
import vista.GestionPresupuesto;
import vista.ModificarPresupuesto;

  public class EditorPresupuesto extends Editor implements TableCellEditor, ActionListener {

      /**
     *
     */
    private static final long serialVersionUID = 1L;
   
     
    @SuppressWarnings("unchecked")
    private GestionPresupuesto reg;
   
    static JDialog dialog=new JDialog();
      @SuppressWarnings("unchecked")
    public EditorPresupuesto(GestionPresupuesto gestionPresupuesto, int m, int e) {
        super(m,e);

          this.reg=gestionPresupuesto;
      }

      public void actionPerformed(ActionEvent e) {
       
        int option;
            if(columna==mod){
              ModificarPresupuesto m=new ModificarPresupuesto(reg.dtm,this);
          dialog.setContentPane(m.getRootPane());
          dialog.setModal(true);
          dialog.setBounds(200, 100, m.getWidth(), m.getHeight());
          dialog.setVisible(true);
             }
            else {
              option=JOptionPane.showConfirmDialog(null, "�Seguro que desea eliminar el producto?");
                 if (option==JOptionPane.YES_OPTION)
                reg.dtm.removeRow(fila);
                 for (int i=0; i<reg.dtm.getRowCount(); i++){
              reg.dtm.setValueAt(i+1, i, 0);
                      }
            }
          fireEditingStopped();
         
         
      }
     
      public void termino(){
     
      dialog.dispose();
    }
     
    
     public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
              return super.getTableCellEditorComponent(table, value, isSelected, row, column);
              }
  }


TOP

Related Classes of editor.EditorPresupuesto

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.