Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » simple swing example fails within eclipse project
simple swing example fails within eclipse project [message #1368518] Tue, 20 May 2014 06:48 Go to next message
Antje Janosch is currently offline Antje JanoschFriend
Messages: 5
Registered: January 2014
Junior Member
Hello,

I'm working on MacOS (10.6.Cool, with Java 1.6.0_65 and Eclipse Indigo (3.7.2)
I have a plugin-project. As I wanted to test some GUI, I tried to execute the following code:

import javax.swing.*;

public class TestFrame {

    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 produces the following error message:

2014-05-20 08:45:28.859 java[5523:903] [Java CocoaComponent compatibility mode]: Enabled
2014-05-20 08:45:28.861 java[5523:903] [Java CocoaComponent compatibility mode]: Setting timeout for SWT to 0.100000
true
2014-05-20 08:45:30.329 java[5523:903] *** __NSAutoreleaseNoPool(): Object 0x1132afe40 of class __NSCFDate autoreleased with no pool in place - just leaking
2014-05-20 08:45:30.329 java[5523:903] *** __NSAutoreleaseNoPool(): Object 0x113226270 of class NSCFTimer autoreleased with no pool in place - just leaking
2014-05-20 08:45:30.345 java[5523:903] *** __NSAutoreleaseNoPool(): Object 0x10063cc80 of class __NSCFDate autoreleased with no pool in place - just leaking
2014-05-20 08:45:30.345 java[5523:903] *** __NSAutoreleaseNoPool(): Object 0x10063d680 of class NSCFTimer autoreleased with no pool in place - just leaking
2014-05-20 08:45:30.364 java[5523:903] *** __NSAutoreleaseNoPool(): Object 0x10f469230 of class __NSCFDate autoreleased with no pool in place - just leaking
2014-05-20 08:45:30.364 java[5523:903] *** __NSAutoreleaseNoPool(): Object 0x10f46b510 of class NSCFTimer autoreleased with no pool in place - just leaking


If I place the same code into a fresh Java project within the same workspace, no error message appears and the frame shows up.

Can anybody help me troubleshooting?
I hope, this is the right place for this questions. If not, let me know!

Re: simple swing example fails within eclipse project [message #1375825 is a reply to message #1368518] Fri, 23 May 2014 06:25 Go to previous messageGo to next message
Antje Janosch is currently offline Antje JanoschFriend
Messages: 5
Registered: January 2014
Junior Member
Nobody has any idea? Or is it the wrong place for this kind of questions?
Any recommendation for a better place?
I really would like to troubleshoot this...
Re: simple swing example fails within eclipse project [message #1742590 is a reply to message #1375825] Mon, 05 September 2016 15:58 Go to previous message
Norman Paterson is currently offline Norman PatersonFriend
Messages: 2
Registered: August 2016
Junior Member
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).
Previous Topic:Text based adventure game executable, HELP!
Next Topic:Caused by: java.lang.ClassNotFoundException: org.eclipse.xtext.common.types.util.FeatureOverridesSer
Goto Forum:
  


Current Time: Mon Jun 24 15:22:24 GMT 2019

Powered by FUDForum. Page generated in 0.02508 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top