change pictures every 2 sec


I stack a bit so if anyone has any ideas it would be helpful. So currently the program is compiling and running but I do not know how to finish it. I am using eclipse. What i want to do is when i start the program to change 4 different pictures in every 2 seconds so if you have any advices do not be shy. Here is the program.

/** Here is the GUI of the program * class name SlideShowGui.java * @author Kiril Anastasov * @date 07/03/2012 */ import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; public class SlideShowGui extends JPanel implements ActionListener { JLabel name, comments, images; JTextField namejtf, commentsjtf, captionjtf; JButton submit; ImageIcon pictures, pictures2, pictures3, pictures4; boolean go = true; SlideShowGui() { name = new JLabel("Name:"); this.add(name); namejtf = new JTextField(15); this.add(namejtf); comments = new JLabel("Comments:"); this.add(comments); commentsjtf = new JTextField(15); this.add(commentsjtf); submit = new JButton("Submit"); this.add(submit); submit.addActionListener(this); pictures = new ImageIcon("galileo1.jpg"); images = new JLabel(pictures); pictures2 = new ImageIcon("galileo2.jpg"); pictures3 = new ImageIcon("galileo3.jpg"); pictures4 = new ImageIcon("galileo4.jpg"); this.add(images); captionjtf = new JTextField(24); this.add(captionjtf); } public void actionPerformed(ActionEvent ae) { } } <hr />/**The driver class of the program. Here is the JFrame * class name TestSlideShow.java * @author Kiril Anastasov * @date 07/03/2012 */ import java.awt.*; import javax.swing.*; public class TestSlideShow { public static void main(String[] args) { JFrame application = new JFrame(); SlideShowGui panel = new SlideShowGui(); application.add(panel); application.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); application.setSize(300,600); application.setLocation(400,100); application.setVisible(true); } }



put Icon / ImageIcons to the Queue, Map, Array, List, Vector

</li> <li>

by starting <a href="http://docs.oracle.com/javase/tutorial/uiswing/misc/timer.html" rel="nofollow">Swing Timer</a> pick up Icon / ImageIcon from the array

</li> <li>

add <a href="http://docs.oracle.com/javase/tutorial/uiswing/components/icon.html" rel="nofollow">Icon / ImageIcons</a> to the <a href="http://docs.oracle.com/javase/tutorial/uiswing/components/label.html" rel="nofollow">JLabel</a>, by using <a href="http://docs.oracle.com/javase/7/docs/api/javax/swing/JLabel.html#setIcon%28javax.swing.Icon%29" rel="nofollow">JLabel#setIcon()</a>

</li> <li>

code related for Swing GUI should be initialized from invokeLater(), more in the <a href="http://docs.oracle.com/javase/tutorial/uiswing/concurrency/initial.html" rel="nofollow">Initial Threads</a>

</li> </ul>


  • How do I prevent arrow key press in JTextField from scrolling JScrollPane?
  • Export Java applet to .jar
  • key listener not working for some reason
  • create images clickable on jpanel
  • How to create vertical TitledBorder in JPanel (javax swing)
  • JButton background images
  • Aligning and Inlining components (or icons) in JTextPane
  • Open a file from the same package
  • FlowLayout ItemsControl in WPF
  • Wait for Swing to finish updating JProgressBar before continuing
  • Does Swing come with Calendar and time field components?
  • Exception in thread “AWT-EventQueue-0” java.lang.NoClassDefFoundError
  • Threads in jMonkey and Nifty?
  • How to trigger a KeyPressed event for unit testing in JAVA
  • java drawing on JPanel with timer/delay
  • Maven repository location is not updated in eclipse
  • Exception in the iconization of JInternalFrame with DefaultDesktopManager
  • Cannot invoke my method on the array type int[]
  • Are there any issues with placing image as background on an extended JFrame?
  • drawing random circles, storing their coorindates in an array
  • How to log in to an HTTPS website with Jsoup?
  • Regarding starting the threads on a condition
  • Problems compiling files using JOGL
  • AJAX Html Editor Extender upload image appearing blank
  • d3 v4 drag and drop with TypeScript
  • Swing - Get new component under mouseReleased
  • JQuery Internet Explorer and ajaxstop
  • Highlight and Bold text in JTextPane
  • Java: can you cast Class into a specific interface?
  • How to access EntityManager inside Entity class in EJB3
  • how to do an event when i swipe from fragment to the other
  • Problems to linebreak with an int in JLabel
  • Opengl-es onTouchEvents problem or a draw problem? [closed]
  • Akka Routing: Reply's send to router ends up as dead letters
  • Cannot Parse HTML Data Using Android / JSOUP
  • JTable with a ScrollPane misbehaving
  • Linking SubReports Without LinkChild/LinkMaster
  • unknown Exception android
  • failed to connect to specific WiFi in android programmatically
  • How can I use threading to 'tick' a timer to be accessed by other threads?