I have the program, code as follows,
the problem now is that when i pressed the button, it will wait for 3second 1st, then the image will changed after 3 second.
if(e.getSource() == btn1)//if button1 is press { btn1.setVisible(false);//do 1st (button become invisible) imageLabel6.setVisible(true);//(image become visible) imageLabel7.setVisible(true);//(image become visible) try//do second(wait for 3 second) { Thread.sleep(3000);//wait for 3sec } catch (InterruptedException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } imageLabel7.setIcon(new ImageIcon("D:\\School Stuff\\Year3\\Sem2\\Object O Programming\\eCard\\Citizen.jpg")); imageLabel6.setIcon(new ImageIcon("D:\\School Stuff\\Year3\\Sem2\\Object O Programming\\eCard\\CitizenOpp.jpg")); }//do last (image changed after 3 second)
the problem now is that when i pressed the button, it will wait for 3second 1st, then the image will changed after 3 second.