try


setVisible(false);

// if statement to see network status..
// if the net status is true

...
new netProgram();