SWT의 TabFolder 아래에 두 개의 확장 막대를 만들었습니다. 그리고 Tab foloder의 레이아웃을 FillLayout (SWT.HORIZONTAL)로 설정했습니다. 그것은 탭 폴더에 두 개의 확장 막대를 보여줍니다. 그러나 탭 폴더를 동일한 레이아웃으로 CTabFolder로 변경했을 때 CTabFolder 아래의 확장 바를 확장하지 않았습니다. 무엇이 문제 일 수 있습니까? 이를위한 매개 변수를 설정해야합니까? TabFolder 및 CTabFolder에 대한 아래 코드를 참조하십시오. TabFolder에 대한CTabFolder 레이아웃 컨트롤이 렌더링되지 않습니다.
코드 : CTabFolder에 대한
public class Snippet223 {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setLayout(new FillLayout());
shell.setText("ExpandBar Example");
final TabFolder folder = new TabFolder(shell, SWT.BORDER);
folder.setLayout(new FillLayout(SWT.HORIZONTAL));
ExpandBar bar = new ExpandBar(folder, SWT.V_SCROLL);
ExpandBar bar1 = new ExpandBar(folder, SWT.V_SCROLL);
Image image = display.getSystemImage(SWT.ICON_QUESTION);
// First item
createContentsForExpandableBar(bar, image);
createContentsForExpandableBar(bar1, image);
shell.setSize(400, 350);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
}
private static void createContentsForExpandableBar(ExpandBar bar,
Image image) {
Composite composite = new Composite(bar, SWT.NONE);
GridLayout layout = new GridLayout();
layout.marginLeft = layout.marginTop = layout.marginRight = layout.marginBottom = 10;
layout.verticalSpacing = 10;
composite.setLayout(layout);
Button button = new Button(composite, SWT.PUSH);
button.setText("SWT.PUSH");
button = new Button(composite, SWT.RADIO);
button.setText("SWT.RADIO");
button = new Button(composite, SWT.CHECK);
button.setText("SWT.CHECK");
button = new Button(composite, SWT.TOGGLE);
button.setText("SWT.TOGGLE");
ExpandItem item0 = new ExpandItem(bar, SWT.NONE, 0);
item0.setText("What is your favorite button");
item0.setHeight(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
item0.setControl(composite);
item0.setImage(image);
}
}
코드 :
public class Snippet223 {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setLayout(new FillLayout());
shell.setText("ExpandBar Example");
final CTabFolder folder = new CTabFolder(shell, SWT.BORDER);
folder.setLayout(new FillLayout(SWT.HORIZONTAL));
ExpandBar bar = new ExpandBar(folder, SWT.V_SCROLL);
ExpandBar bar1 = new ExpandBar(folder, SWT.V_SCROLL);
Image image = display.getSystemImage(SWT.ICON_QUESTION);
// First item
createContentsForExpandableBar(bar, image);
createContentsForExpandableBar(bar1, image);
shell.setSize(400, 350);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
}
private static void createContentsForExpandableBar(ExpandBar bar,
Image image) {
Composite composite = new Composite(bar, SWT.NONE);
GridLayout layout = new GridLayout();
layout.marginLeft = layout.marginTop = layout.marginRight = layout.marginBottom = 10;
layout.verticalSpacing = 10;
composite.setLayout(layout);
Button button = new Button(composite, SWT.PUSH);
button.setText("SWT.PUSH");
button = new Button(composite, SWT.RADIO);
button.setText("SWT.RADIO");
button = new Button(composite, SWT.CHECK);
button.setText("SWT.CHECK");
button = new Button(composite, SWT.TOGGLE);
button.setText("SWT.TOGGLE");
ExpandItem item0 = new ExpandItem(bar, SWT.NONE, 0);
item0.setText("What is your favorite button");
item0.setHeight(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
item0.setControl(composite);
item0.setImage(image);
}
}
확인. 덕분에 나는 그것을 적절하게 만들 것이다 !! – user414967