の中に入れるのに問題があります-ScrolledComposite
の中にGroup
表示されませんGroup
。ScrolledComposite
をスクロールする必要がありLabel
ます。
final private static Group group_netpbmOutput = new Group(shell, SWT.NONE);
final private static ScrolledComposite scroll_netpbmOutput = new ScrolledComposite(group_netpbmOutput, SWT.V_SCROLL | SWT.H_SCROLL);
final private static Label labelImage_netpbmOutput = new Label(scroll_netpbmOutput, SWT.BORDER);
//init Group
group_netpbmOutput.setLayout(new FillLayout());
formData = new FormData(((FormData)group_options.getLayoutData()).width, 200);
formData.top = new FormAttachment(group_options, 50, SWT.BOTTOM);
formData.left = new FormAttachment(group_options, 0, SWT.LEFT);
group_netpbmOutput.setLayoutData(formData);
group_netpbmOutput.setFont(font_group);
group_netpbmOutput.setText("Netpbm output");
//init Label
labelImage_netpbmOutput.setBackgroundImage(new Image(...));
//init ScrollComposite
scroll_netpbmOutput.setLayout(new FillLayout());
scroll_netpbmOutput.setContent(labelImage_netpbmOutput);
編集:バズの答えに対する反応
それは機能しますが...画像は次のように表示されます(「stackoverflow」は1つだけである必要があります):
final private static Group group_netpbmOutput = new Group(shell, SWT.NONE);
final private static ScrolledComposite scroll_netpbmOutput = new ScrolledComposite(group_netpbmOutput, SWT.V_SCROLL | SWT.H_SCROLL);
final private static Label labelImage_netpbmOutput = new Label(scroll_netpbmOutput, SWT.BORDER);
group_netpbmOutput.setLayout(new GridLayout());
formData = new FormData(((FormData)group_options.getLayoutData()).width, 200);
formData.top = new FormAttachment(group_options, 50, SWT.BOTTOM);
formData.left = new FormAttachment(group_options, 0, SWT.LEFT);
group_netpbmOutput.setLayoutData(formData);
group_netpbmOutput.setFont(font_group);
group_netpbmOutput.setText("Netpbm output");
labelImage_netpbmOutput.setBackgroundImage(new Image(...));
scroll_netpbmOutput.setLayout(new GridLayout(1, false));
scroll_netpbmOutput.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
scroll_netpbmOutput.setContent(labelImage_netpbmOutput);
scroll_netpbmOutput.setExpandHorizontal(true);
scroll_netpbmOutput.setExpandVertical(true);
scroll_netpbmOutput.setMinSize(labelImage_netpbmOutput.computeSize(SWT.DEFAULT, SWT.DEFAULT));