Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] Launching an swt-app on Mac Os X with Java 1.4.1

> Have you tried launching a simple example that shows a widget in the
> shell, e.g.:
> It is possible that you are launching the SWT application correctly and
> there is something wrong with your layout code.
Well, it is possible. The test-class that I first tried to start on Mac
follows here and I would be grateful if somebody actually sees a
difference that makes it to work fine on win32 and linux, but not on on
the Mac:

public class RafisTest
{
  public static void main(String[] args) {
    Display display = new Display();
    Shell shell =
      new Shell( display, SWT.CLOSE | SWT.TITLE | SWT.MIN | SWT.MAX );
    shell.setSize( 400, 300 );
    shell.setText( "Geiizdeƶppe..." );

    FormLayout layout = new FormLayout();
    layout.marginHeight = 10;
    layout.marginWidth = 10;
    shell.setLayout( layout );

    Button buttonOne = new Button( shell, SWT.DEFAULT );
    buttonOne.setText("luda, buttn one");
    Button buttonTwo = new Button( shell, SWT.DEFAULT );
    buttonTwo.setText("luda, buttn two");

    FormData fdOne = new FormData( 150, 50 );
    fdOne.left = new FormAttachment( 0, 10 );
    fdOne.top = new FormAttachment( 0, 10 );
    buttonOne.setLayoutData(fdOne);

    FormData fdTwo = new FormData( 150, 50 );
    fdTwo.left = new FormAttachment( buttonOne, 10 );
    fdTwo.top = new FormAttachment( buttonOne, 0, SWT.TOP );
    buttonTwo.setLayoutData(fdTwo);

    shell.open();
    while ( !shell.isDisposed() )
    {
      if ( !shell.getDisplay().readAndDispatch() )
      {
        shell.getDisplay().sleep();
      }
    }
    shell.dispose();
  }
}

I guess that I am not the only one having my adventures riding the
swt-train on Mac-tracks. Wouldn't it be worth to update the "how-to run
swt on mac using 1.4.1" in the swt-faq and give detailed descriptions
there?

I'd appreciate it!

: raffael




Back to the top