Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8534813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:16:59+00:00 2026-06-11T10:16:59+00:00

I have the following SWT layout: TabItem SashForm Composite (GridLayout) Label (Fill W, Grab

  • 0

I have the following SWT layout:

  • TabItem
    • SashForm
      • Composite (GridLayout)
        • Label (Fill W, Grab H)
        • ScrolledComposite (Fill W/H, Grab H/V)
          • Composite (RowLayout)
      • Composite (GridLayout)
        • Label (Fill W, Grab H)
        • ScrolledComosite (Fill W/H, Grab H/V)
          • Composite (RowLayout)

The general idea is that there are two identical panes side-by-side with adjustable widths via the sash, and inside each panel is a label at the top, and a scrolled composite on the bottom. The scrolled composite will have many (1 – 50) 100×100 composites contained within the wrapped composite.

The problem is that when contained within a sash form, the scrolled composites will not scroll when the internal composite grows due to a large number of children. I do not experience this problem when I abandon the SashForm and use a regular Composite, like so:

  • TabItem
    • Composite (GridLayout)
      • Label
      • ScrolledComposite
        • Composite
      • Label
      • ScrolledComposite
        • Composite

In this way, there is no extra composite container, and everything is in a grid layout. The only problem is that I can’t adjust the width of the panes via a common interface (sash).


I have tried forcing layout using layout(), and setting the minimum size using setMinSize(). I tried swapping RowLayout with a FlowLayout (swing2swt). I am assuming this is a type of layout problem, but I do not have enough SWT experience to sort it out. The layout is perfect except for the scrolling problem.

Source Example

All of the code was auto-generated by WindowBuilder Pro, and can be replicated by building the composite tree I specified. Here is a fragment I am using to populate the wrapped composite:

public void populate(Composite composite, List<Photo> items) {
   composite.setRedraw(false);
   for (Photo photo : photos) {
     PhotoComposite composite = new PhotoComposite(composite, photo, SWT.NONE);
     composite.setSize(100, 100);
   }
   composite.setRedraw(true);
   composite.layout(true);
}

Photo is a simple POJO, and PhotoComposite is a custom composite that takes a Photo as a parameter in the constructor in addition to the traditional Composite and style bits. This code appears to work fine according to my experiments.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T10:17:01+00:00Added an answer on June 11, 2026 at 10:17 am

    It turns out the problem was a misunderstanding of setMinSize(int, int). The following changes to the populate method shown above solved the problem for me:

    public void populate(ScrolledComposite scroll, Composite composite, List<Photo> items) {
       composite.setRedraw(false);
       for (Photo photo : photos) {
         PhotoComposite composite = new PhotoComposite(composite, photo, SWT.NONE);
         composite.setSize(100, 100);
       }
       composite.setRedraw(true);
       composite.layout(true);
    
       scroll.setMinSize(composite.computeSize(scroll.getSize().x, SWT.DEFAULT));
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using GridLayout in my SWT GUI app. I have the following GridData
I have a problem with understanding the following code: import java.awt.Dimension; import java.awt.GridLayout; import
Please have a look at the following code. import java.awt.FlowLayout; import java.awt.GridLayout; import javax.swing.*;
Still looking for a solution I have the following problem: I use SWT GC
I have the following class which implements 3 JPanels. 1 Panel has a label,
Noob question : I have the following Forms layout (please excuse the JRuby syntax).
I want to have the following layout: (i.e. jbutton and jlabel are placed at
I have an annoying problem with Java’s layout managers. I have the following situation:
I have following plist: <?xml version=1.0 encoding=UTF-8?> <!DOCTYPE plist PUBLIC -//Apple//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd>
I have following source. In insertMessage(..), it calls selectMessage to check whether duplicate record

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.