Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MyClass extends JFrame implements ActionListener
- nextButton.addActionListener(this);
- previousButton.addActionListener(this);
- public void actionPerformed(ActionEvent e)
- {
- Object o = e.getSource();
- if(o == nextButton)
- {
- currentIndex++;
- if(currentIndex == vectorImages.size())
- {
- currentIndex = 0;
- }
- //Change the image in the JLabel
- label.setIcon(new ImageIcon(vectorImages.get(currentIndex)));
- }
- else
- {
- //Iterate backwards
- }
- }
Add Comment
Please, Sign In to add comment