DZone Forums
Go Back   DZone Forums > Community > Tools & IDEs > Eclipse
Reload this Page Computing the size of a composite
Notices
Reply
 
LinkBack Thread Tools Display Modes
  (#1 (permalink)) Old
Member
 
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Join Date: Jun 2009
Default Computing the size of a composite - 06-12-2009, 11:03 PM

I have an issue where I am adding a number of labels and fields to a composite dynamically and the problem is that when the UI is rendered the composite that houses these labels and fields is not the right size therefore not all of the fields are visible.

Therefore my question is this... what is the right way to do this? how should I go about setting up the composite, adding the labels and fields and then getting the composite to compute the right size to show all of the labels and fields.

I have tried everything I know which is obviously not enough therefore really need some help from someone.
Reply With Quote
  (#2 (permalink)) Old
Active Contributor
 
Posts: 62
Thanks: 0
Thanked 6 Times in 6 Posts
Join Date: Jun 2009
Default 06-16-2009, 03:19 AM

Hi. jonbuck:

hope this could be helpful.
If you are adding composite dynamically, then you need layout the composite again after you add it.
For example: composite. computeSize(SWT.DEFAULT, SWT.DEFAULT), or you can composite.setSize() directly, then call the composite.layout() method to deploy new layout.


www.eclaxy.com
let's perfect the eclipse!
Reply With Quote
  (#3 (permalink)) Old
Member
 
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Join Date: Jun 2009
Default 06-16-2009, 09:47 AM

Thanks oxygold,

I got the answer from the eclipse newsgroups thanks to Grant Gayed...

Basically once you have finished adding your controls to the composite you need to call the pack method, so composite.pack(), this method causes the receiver to be resized to its prefered size. Once I made this change it worked perfectly but appreciate your thoughts.
Reply With Quote
  (#4 (permalink)) Old
Active Contributor
 
Posts: 62
Thanks: 0
Thanked 6 Times in 6 Posts
Join Date: Jun 2009
Default 06-17-2009, 04:07 AM

that's cool.
anyway, thanks to Grant Gayed...


www.eclaxy.com
let's perfect the eclipse!
Reply With Quote
Reply

Tags
composite, computing size, dynamically, swt

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating an SWT Scrolled Composite alwillms Eclipse 0 02-27-2009 06:04 PM
What is Cloud Computing? weiling Java 9 02-04-2009 07:58 AM
How to set view's size by program powerpiggy Eclipse 0 12-03-2008 01:50 AM
Embed JPanel in a Composite bitrider Eclipse 0 09-24-2008 05:53 AM
fedora eclispe /tmp size amdawi Eclipse 0 04-18-2008 04:28 AM


Copyright 1997-2009, DZone, Inc.
vBulletin Skin developed by: vBStyles.com