
when i click on the SUBMIT button ON,OFF window is visiable first OFF button is clicking I getting the error :
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at NextPage$2.actionPerformed(NextPage.java:36)
ON button is clicking the application is runing and click on OFF button the application terminated agin click on ON or OFF both are working
my problem is very first time click on OFF button that error came class NextPage extends JFrame { Image m; Thread t; NextPage(final String uname) {
................... ON.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { m = new Image(uname); t = new Thread(m); t.setDaemon(true); t.start(); } });
OFF.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ev) {
t.stop();
}
});
}
}
class LoginDemo extends JFrame { ....... LoginDemo(){ ............ SUBMIT.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) {
String value1 = text1.getText();
String value2 = text2.getText();
try { .............. ................................ else if (value1.equals(uname) && enPassword.equals(pass)) { dispose(); new NextPage(uname); } } }
public class Image implements Runnable { public static void writeImage(BufferedImage img, String fileLocation, String extension) { ........... } public static String createTimeStampStr() throws Exception { ......... } public void randomImage(String uname) throws Exception { ............... while(true){ ........... } } }
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.