Guest User

Untitled

a guest
Jun 23rd, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. public class MyClass extends JFrame implements ActionListener
  2.  
  3. nextButton.addActionListener(this);
  4. previousButton.addActionListener(this);
  5.  
  6. public void actionPerformed(ActionEvent e)
  7. {
  8. Object o = e.getSource();
  9. if(o == nextButton)
  10. {
  11. currentIndex++;
  12. if(currentIndex == vectorImages.size())
  13. {
  14. currentIndex = 0;
  15. }
  16. //Change the image in the JLabel
  17. label.setIcon(new ImageIcon(vectorImages.get(currentIndex)));
  18. }
  19. else
  20. {
  21. //Iterate backwards
  22. }
  23. }
Add Comment
Please, Sign In to add comment