[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] Application using SWT won't accept focus on Mac OS X

Hello,

I've started experimenting with SWT to use in place of Swing on Mac OS 
X, but I've run into a problem right at the beginning.  

When I run a small example program such as some of the snipits or the 
ImageAnalyzer example the application will not accept focus nor any 
mouse interaction (other than the window control buttons).

The application compiles fine and it runs, but I don't get an icon in 
the Dock and clicking on the application window does not bring the 
application to the front.

A small example that performs that way is ...

import org.eclipse.swt.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.layout.*;
import java.util.ResourceBundle;

public class Main {
    public static void main (String [] args) {
        Display display = new Display ();
        Shell shell = new Main ().open (display);
        while (!shell.isDisposed ()) {
            if (!display.readAndDispatch ()) display.sleep ();
        }
        display.dispose ();
    }
    public Shell open (Display display) {
        Shell shell = new Shell (display);
        shell.setLayout(new FillLayout());
        Label label = new Label (shell, SWT.CENTER);
        label.setText ("Hello world");
        shell.pack ();
        shell.open ();
        return shell;
    }
}

I'm using the 1.4.1_01 developer preview version of Java on Mac OS X 
10.2.6.

Does anyone have any thoughts about what is going on?

Thanks.
Andy.