Hi,
I have an Eclipse plugin that displays a view. What I want to do is display n images in the view in a single row with a centered label under each image. I want to view to be scrollable. I also want each image to be re-sized when the dimensions of the view (ScrolledComposite? Composite?) change so it utilizes the available vertical and horizontal client area.
I have implemented the following in the createViewPart method (declarations and error checking has been omitted):
public void createPartControl(Composite parent) { ScrolledComposite myScrolledComposite = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); myComposite = new Composite(myScrolledComposite, SWT.NONE); myScrolledComposite.setContent(myComposite); }
What's the best approach from this point forward?
- Should I subclass Composite and have that class draw a given image on itself and center a label under the image?
- What layout manager should I use to center the label under the image?
- Should the "parent" parameter of my subclass be "myComposite"?
- Which layout manager should I use with "myComposite"?
- When it comes to resizing the images, do I calculate the available width and height by using the getBounds of "myComposite" - my subclassed composite's getBounds?
Thanks for your assistance.