|  | 
|  | 
| 
| Re: simple swing example fails within eclipse project [message #1742590 is a reply to message #1375825] | Mon, 05 September 2016 11:58  |  | 
| Eclipse User  |  |  |  |  | Antje - 
 I know your post is old and probably long dead, but I am following in your footsteps. I have just created a HelloWorldSwing application, using almost identical code to you, and it worked.  The code I have is:
 
 
 import javax.swing.*;
public class Main {
	/**
	 * @param args
	 */
	public static void main(String[] args) {
        javax.swing.SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                createAndShowGUI();
            }
            private void createAndShowGUI() {
                JFrame frame = new JFrame("Test");
                System.out.println(SwingUtilities.isEventDispatchThread());
                frame.getContentPane().add(new JButton("hello"));
                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                frame.pack();
                frame.setVisible(true);
            }
        });
	}
}
 This is running in Eclipse Indigo on Mac OS X 10.6.8 with Java 1.6 (ie the Mac standard Java).
 |  |  |  | 
Powered by 
FUDForum. Page generated in 0.07443 seconds