我在这个Composite画布上工作,Composite可以添加和删除其他s.
我对整个布局概念仍处于迷雾中的理解.
当孩子被添加到容器中时,考虑到容器中有一个GridData填充父级的事实,父母是否也应该知道孩子的大小调整?由于shell(顶级父级),因此在容器布置后,子项仍然隐藏.
如果问题太模糊,请不要犹豫,询问更多细节.另外,请尽量不要将我指向SWT文章中的" 理解布局 ".
/**
*
* @author ggrec
*
*/
public class SSCCE
{
// ==================== 2. Instance Fields ============================
private Composite componentContainer;
private int componentCount = 0;
// ==================== 3. Static Methods =============================
public static void main(final String[] args)
{
new SSCCE();
}
// ==================== 4. Constructors ===============================
private SSCCE()
{
final Display display = new Display();
final Shell shell = new Shell(display);
shell.setLayout(new GridLayout(1, false));
createContents(shell);
shell.pack(); …Run Code Online (Sandbox Code Playgroud)