[
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
|
Windows gives a free resize event on shell.open and the Mac does not.
There is a bug report against this:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=4409
By moving the shell.setSize() call to be after the layout data has been
specified, your example works 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.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.setSize( 400, 300 ); //!!!!!!
shell.open();
while ( !shell.isDisposed() )
{
if ( !shell.getDisplay().readAndDispatch() )
{
shell.getDisplay().sleep();
}
}
shell.dispose();
}
}
"Raffael Heinzer" <heinzer@xxxxxxxxx>
Sent by: platform-swt-dev-admin@xxxxxxxxxxx
10/15/2003 08:14 AM
Please respond to platform-swt-dev
To: <platform-swt-dev@xxxxxxxxxxx>
cc:
Subject: 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
_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/platform-swt-dev