Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » JFace and composite Layout problem
JFace and composite Layout problem [message #438723] Thu, 01 July 2004 02:54 Go to next message
Eclipse UserFriend
Originally posted by: owen.thomas.salestech.co.nz

I have a simple JFace (that I would like to run standalone) project with
one class

public class test extends ApplicationWindow{}

What I want is a sah_form with a tree viewer on the left and a composite
with a set of objects such as labels, text fields and a button on the
right.

So far so good nothing too complicated.

Now I try to change the layout of the composite to a GridLayout and
eclipse (RC2) keeps complaining.

SashForm sash_form = new SashForm(parent, SWT.HORIZONTAL | SWT.NULL);
TreeViewer tv = new TreeViewer(sash_form);
Composite comp = new Composite(sash_form, SWT.NULL);
GridLayout GridLayout_1 = new GridLayout();
GridLayout_1.numColumns = 2;
comp.setLayout(GridLayout_1);

Cheers

Owen
Re: JFace and composite Layout problem [message #439228 is a reply to message #438723] Wed, 07 July 2004 17:44 Go to previous message
Veronika Irvine is currently offline Veronika IrvineFriend
Messages: 1272
Registered: July 2009
Senior Member
Can you explain what you mean by "eclipse (RC2) keeps complaining"?

You said " change the layout of the composite to a GridLayout" - your code
doesn't show it but was there a different layout on comp before? If yes,
then you must go through each of the children of comp and call
child.setLayoutData(null) before changing the layout of the parent. This is
true even if you have never set layout data on the children (because the
Layout may create "free" layout data objects for each child).


"Owen Thomas" <owen.thomas@salestech.co.nz> wrote in message
news:cbvubf$r1f$1@eclipse.org...
> I have a simple JFace (that I would like to run standalone) project with
> one class
>
> public class test extends ApplicationWindow{}
>
> What I want is a sah_form with a tree viewer on the left and a composite
> with a set of objects such as labels, text fields and a button on the
> right.
>
> So far so good nothing too complicated.
>
> Now I try to change the layout of the composite to a GridLayout and
> eclipse (RC2) keeps complaining.
>
> SashForm sash_form = new SashForm(parent, SWT.HORIZONTAL | SWT.NULL);
> TreeViewer tv = new TreeViewer(sash_form);
> Composite comp = new Composite(sash_form, SWT.NULL);
> GridLayout GridLayout_1 = new GridLayout();
> GridLayout_1.numColumns = 2;
> comp.setLayout(GridLayout_1);
>
> Cheers
>
> Owen
Previous Topic:Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/swt/inter
Next Topic:Reducing GTK line height?
Goto Forum:
  


Current Time: Thu Apr 25 10:55:37 GMT 2024

Powered by FUDForum. Page generated in 0.03435 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top