public void actionPerformed(ActionEvent event) { PanImage1 panImage1 = new PanImage1(); PanImage2 panImage2 = new PanImage2(); PanImage3 panImage3 = new PanImage3(); revalidate(); if (event.getSource() == btnClick) { if (nImg == 0) { nImg = 3; } else { nImg--; } } else if (event.getSource() == btnClick2) { if (nImg == 4) { nImg = 1; } else { nImg++; } } else if (event.getSource() == btnClick3) { System.exit(0); } if (nImg == 1) { add(panImage1); } if (nImg == 2) { add(panImage2); } if (nImg == 3) { add(panImage3); } }
protected void windowClosingEvent(final WindowEvent e) { System.exit(0); }