I am building a Java application using netbeans. I have created a jbutton and and want to run a separate jframe by using it. The problem is on the click of jbutton the jframe is coming but the methods are not executing.
The code at jframe is:
public class DroneJFrame extends javax.swing.JFrame {
private int x;
private int y;
private String text;
private int a;
private int b;
private String text1;
private int c;
private int d;
private String text2;
public DroneJFrame() {
        initComponents();
        x= 10;
        y=150;
        a=10;
        b=150;
        c=1000;
        d=150;
        text="Drone";
        text1="Factory";
        text2="Hospital";
        setSize(1070,300);
        this.getContentPane().add(jPanel1);
}
@Override
public void paint(Graphics g) {
    g.setColor(Color.white);
    g.fillRect(0, 0, 1070, 300);
    g.setColor(Color.BLACK);
    g.drawString(text, x, y);
    System.out.println(x + "" + y);
    g.drawString(text1, a, b);
    g.drawString(text2, c, d);
}
public void factory() throws InterruptedException{
    while(true){
        while(a<=getWidth()){
                b=getHeight()/2;
                repaint();
                Thread.sleep(1000000);
            }
        }
    }
public void Hospital() throws InterruptedException{
    while(true){
        while(c<=getWidth()){
                d=getHeight()/2;
                repaint();
                Thread.sleep(1000000);
            }
    }
}
public void start() throws InterruptedException{
    while(true){
        while(x <= getWidth()-50){
                x++;
                y = getHeight()/2;
                repaint();
                Thread.sleep(50);
        }
        JOptionPane.showMessageDialog(null, "Drone Has Been Reached To Hospital");
        while(x >= 0){
                x--;
                y = getHeight()/2;
                repaint();
                Thread.sleep(50);
            }
        break;
        }
    }
public static void main(String args[]) throws InterruptedException {
            DroneJFrame drone = new DroneJFrame();
            drone.start();
            drone.factory();
            drone.Hospital();
            try {
                for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                    if ("Nimbus".equals(info.getName())) {
                        javax.swing.UIManager.setLookAndFeel(info.getClassName());
                        break;
                    }
                }
            } catch (ClassNotFoundException ex) {
                java.util.logging.Logger.getLogger(DroneJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
            } catch (InstantiationException ex) {
                java.util.logging.Logger.getLogger(DroneJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
            } catch (IllegalAccessException ex) {
                java.util.logging.Logger.getLogger(DroneJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
            } catch (javax.swing.UnsupportedLookAndFeelException ex) {
                java.util.logging.Logger.getLogger(DroneJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
            }                
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    }               
            });
}                  
private javax.swing.JPanel jPanel1;                 
}
The code at jbutton is:
private void droneActionPerformed(java.awt.event.ActionEvent evt) {                                      
    DroneJFrame drone = new DroneJFrame();
    drone.setVisible(true);
    drone.setLocation(180,200);
    drone.setDefaultCloseOperation(DroneJFrame.HIDE_ON_CLOSE);
}
I am not getting where is my mistake? Can anyone figure it out. Thanks in advance
 
     
    