Convert LayoutManagers to SWT ... [message #462893] |
Thu, 20 October 2005 14:15 |
Eclipse User |
|
|
|
Originally posted by: konrad.my-rho.de
Hi,
is there a possibility to convert LayoutManagers from AWT to SWT? I
wrote my own AWT-Layoutmanager and want to use it in SWT.
In AWT I can set a property object when I add a component to a parent
Panel1.add( ButtonXYZ, new PropertyObject( ... ) );
I can use this property object in my LayoutManager later.
How can I realize this with the a new SWT LayoutManager? How can I set
such an object when I add a new component to a Composite?
Many Thanks
Konrad
|
|
|
Re: Convert LayoutManagers to SWT ... [message #462894 is a reply to message #462893] |
Thu, 20 October 2005 14:31 |
Eclipse User |
|
|
|
Originally posted by: arick.pobox.com
In the book, "The Definitive Guide to SWT an JFaces", they demonstate
porting the AWT BordeLayout class to SWT.
On Thu, 20 Oct 2005 16:15:54 +0200, Konrad Mühler wrote:
> Hi,
>
> is there a possibility to convert LayoutManagers from AWT to SWT? I
> wrote my own AWT-Layoutmanager and want to use it in SWT.
>
> In AWT I can set a property object when I add a component to a parent
>
> Panel1.add( ButtonXYZ, new PropertyObject( ... ) );
>
> I can use this property object in my LayoutManager later.
>
> How can I realize this with the a new SWT LayoutManager? How can I set
> such an object when I add a new component to a Composite?
>
> Many Thanks
> Konrad
|
|
|
|
Re: Convert LayoutManagers to SWT ... [message #462935 is a reply to message #462900] |
Fri, 21 October 2005 08:26 |
Eclipse User |
|
|
|
Originally posted by: konrad.my-rho.de
Daniel Spiewak wrote:
> You can set layout parameters using the Control#setLayoutData(Object) method. As to porting layout managers between AWT and SWT, that's an art more than a science. It is possible to write custom SWT layout managers. In fact, having done both custom AWT and custom SWT layout managers extensively, I'd have to say that it's easier to do SWT layout managers once you get used to it. But there's no magic algorithm to switch between the two paradigms. And unfortunately, SWT layout manager algorithms are a world appart from AWT algorithms. I do have a class I wrote which allows you to write a somewhat generic layout manager (using only Rectangles and Point objects) which then can be used without modification as an AWT layout manager, a SwingWT layout manager, or an SWT layout manager. (I considered adding wxWidgets support as well but unfortunately, SWT and wxWidgets both use a abstract superclass rather than a superinterface for their layout managers). If you're intereste
d, I'll post the class here.
Thank you very much!
I think the setLayoutData-Method is exactly the broken link a was
looking for :-)
|
|
|
Powered by
FUDForum. Page generated in 0.02924 seconds