class works correctly in netbeans but does not work in .jar file

0

the entire project was compiled correctly, create an .exe file with launch4j and this message is displayed on launch4j: may 23, 2018 7:43:16 PM components.PnlCategory

pnlCategoria is a JPanel, in netbeans this panel is shown correctly, but when I run the .exe file even if I execute the .jar file, this panel is not shown, here is the class code PnlCategory

    package componentes;
    import java.awt.Color;
    import java.awt.GridLayout;
    import java.sql.ResultSet;
    import javax.swing.JCheckBox;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JSpinner;
    import Clases.BD;
    import java.awt.event.*;
    import java.sql.SQLException;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    import Ventanas_Generales.Menu;
    import static javax.swing.JOptionPane.showMessageDialog;
    import javax.swing.table.DefaultTableModel;
    public class PnlCategoria extends JPanel implements MouseListener{
    BD bd = new BD();
    //variables
    private GridLayout GL;//El panel tiene que estar en forma te tabla
    private JLabel []lbls;
    public JCheckBox []chb1;
    public JSpinner []spnr;
    public JSpinner []spnr2;
    private JPanel pnl;
    private pnlImagen1 []img;
    private blackPanel BPanel; 
    private  DefaultTableModel tm;
    int t1;


    public PnlCategoria(){}

    public PnlCategoria(int t){  
         try {
            System.out.println ("aqui 2"+System.getProperty 
             ("java.class.path"));
    switch(t){
        case 0:
        crearEtiquetas(1);
            this.setSize(900,600);
            this.setLocation(300,120);
            this.setBackground(new Color(255,255,255));
            this.setLayout(new GridLayout(4,4));
            break;

        case 1:
        crearEtiquetas(2);
            this.setSize(900,600);
            this.setLocation(300,120);
            this.setBackground(new Color(255,255,255));
            this.setLayout(new GridLayout(4,4));
            break;

        case 2:
        crearEtiquetas(3);
            this.setSize(900,600);
            this.setLocation(300,120);
            this.setBackground(new Color(255,255,255));
            this.setLayout(new GridLayout(4,4));
            break;

        case 3:
        crearEtiquetas(4);
            this.setSize(900,600);
            this.setLocation(300,120);
            this.setBackground(new Color(255,255,255));
            this.setLayout(new GridLayout(4,4));
            break;

        case 4:
        crearEtiquetas(5);
            this.setSize(900,600);
            this.setLocation(300,120);
            this.setBackground(new Color(255,255,255));
            this.setLayout(new GridLayout(4,4));
            break;

        case 5: 
        crearEtiquetas(6);
            this.setSize(900,600);
            this.setLocation(300,120);
            this.setBackground(new Color(255,255,255));
            this.setLayout(new GridLayout(4,4));
            break;
    }



        } catch (Exception ex) {
            Logger.getLogger(PnlCategoria.class.getName()).log(Level.SEVERE, 
    null, ex);
        }
    }

    public void crearEtiquetas(int id_categoria) throws Exception
    {
        /*Método que crea las etiquetas del menú con el nombre de los 
    productos e imagen de la base de datos (tabla PRODUCTOS).*/
        try {
            ResultSet count = bd.select("SELECT COUNT(*) FROM PRODUCTOS 
     WHERE ID_CATEGORIA =  "+id_categoria+";");
            while(count.next()){t1=count.getInt(1);}img = new 
               pnlImagen1[t1];

         ResultSet nombre = bd.select("SELECT * FROM PRODUCTOS WHERE 
         ID_CATEGORIA = "+id_categoria+";");
    int k=0;
    while(nombre.next())
    {
        img[k] = new pnlImagen1(nombre.getString("nombre"),nombre.getString("imagen"));
        img[k].setName(nombre.getString("nombre"));
        img[k].addMouseListener(this);
        this.add(img[k]);
        img[k].setVisible(true);
        k++;
    }

} catch (SQLException ex) {
    Logger.getLogger(PnlCategoria.class.getName()).log(Level.SEVERE, null, ex);
}
   }

     public PnlCategoria(String s){
     this.setSize(100,100);
     this.setBackground(new Color(25,255,255));
     }

     public void llenaTabla(String nombre) throws Exception
     {  //verificar si el insumo de un producto esta agotado
     ResultSet insumo, limite,resultado;
     String INSUMO;
     boolean agregar = true;
     tm=(DefaultTableModel)Menu.tblArticulos.getModel();
      try {
           insumo = bd.select("select insumo from receta \n" +
                        "where id_receta = (select id_receta \n" +
                        "from productos\n" +
                        "where nombre= '"+nombre+"');");
           while(insumo.next())
           {
              INSUMO=insumo.getString(1);
        limite = bd.select("SELECT disponible from inventario_temporal where 
     nombre = '"+INSUMO+"'");
            while(limite.next())
            {
                System.out.println("llenado tabla,disponible 
      "+limite.getInt(1));
                if(limite.getInt(1)==0){
                    showMessageDialog(null,"Insumo agotado "+INSUMO);
                    agregar=false;
                    nombre="";
                }
                else agregar =true;
             }//while
    }
    System.out.println(agregar);
    if(agregar){

    resultado = bd.select("SELECT * FROM PRODUCTOS WHERE NOMBRE = '"+nombre+"';");
                    while (resultado.next())
                     {
                     tm.addRow(new Object[]{resultado.getString("nombre")});
                     agregar = false;
                     }//while 
    }//if
       } catch (SQLException ex) {
    Logger.getLogger(PnlCategoria.class.getName()).log(Level.SEVERE, null, ex);
}
    }

@Override
public void mouseClicked(MouseEvent me) {
try {
llenaTabla(me.getComponent().getName());
} catch (Exception ex) {
    Logger.getLogger(PnlCategoria.class.getName()).log(Level.SEVERE, null, ex);
}
}

@Override
public void mousePressed(MouseEvent me) {

}

@Override
public void mouseReleased(MouseEvent me) {

}

@Override
public void mouseEntered(MouseEvent me) {

}

@Override
public void mouseExited(MouseEvent me) {
}
}

This panel sent him calling from another class like this

    public class Menu extends javax.swing.JFrame {
    BD bd = new BD();
    Metodos M = new  Metodos();
    Acciones A = new Acciones();

    WhitePanel WP = new WhitePanel();
    int i=0;
    private ResultSet result,Rp;
    private PnlCategoria []pnlC;
    private blackPanel BPanel;
    private  DefaultTableModel tm;
    int id_productos,id_pedidos;
    float total =0;
    private String [] productos;
    public Menu() {

    pnlC = new PnlCategoria[6];
    for (int c=0;c<6;c++){
    pnlC[c] = new PnlCategoria(c); 
    this.add(pnlC[c]);pnlC[c].setVisible(false);
    }
    pnlC[0].setVisible(true);

    this.setSize(1366,768);
    this.setLocationRelativeTo(null);
    setResizable(false);
    setUndecorated(true);
    getContentPane().setBackground(new java.awt.Color(255,255,255));
    initComponents();i++;
   // System.out.println(i+"");
this.setLocationRelativeTo(this);
}
    
asked by Oliveros Carlos 24.05.2018 в 04:07
source

0 answers