Donnerstag, Juni 07, 2007

waiting for swt+java3d+mac os

I just don't know the state of development, but when you come across


2007-06-07 01:28:01.528 java[655] [Java CocoaComponent compatibility mode]: Enabled
2007-06-07 01:28:01.528 java[655] [Java CocoaComponent compatibility mode]: Setting timeout for SWT to 0.100000


when trying out a java3d applet on yout SWT eclipse environment on Mac OS, maybe the applet frame stays in background and is waiting for nothing....

My solution for this is just appending a litte Code for a SWT Shell after the

  • new MainFrame(damn hot code, 700, 700);


  • if(System.getProperty("os.name").equalsIgnoreCase("MAC OS X")){

    Display display=Display.getDefault();
    Shell shell=new Shell();

    shell.setLocation(550, 50);
    shell.setLayout(new GridLayout());
    Button b=new Button(shell,SWT.NONE);
    b.setText("close");
    b.addSelectionListener(new SelectionListener(){
    public void widgetDefaultSelected(SelectionEvent e) {
    }
    public void widgetSelected(SelectionEvent e) {
    System.exit(1);
    }
    });
    shell.setSize(shell.computeSize(SWT.DEFAULT, SWT.DEFAULT));
    shell.setVisible(true);

    while (!shell.isDisposed()) {
    if (!display.readAndDispatch())
    display.sleep();
    }
    display.dispose();
    System.exit(0);

    }

    Keine Kommentare: