我是 SWT 的新手
我试图创建滚动条和两个按钮
按钮布局位置不对的问题。
我希望滚动条位于正确的位置,并且按钮靠近滚动条
Composite composite= new Composite(parent, SWT.NONE);
GridLayout layout= new GridLayout(1, false);
layout.marginHeight= 0;
layout.marginWidth= 0;
layout.horizontalSpacing= 0;
layout.verticalSpacing= 0;
composite.setLayout(layout);
fComposite= new Composite(composite, SWT.NONE);
GridData layoutData= new GridData(SWT.FILL, SWT.TOP, true, false);
fComposite.setLayoutData(layoutData);
layout= new GridLayout(1, false);
layout.marginHeight= 0;
layout.marginWidth= 0;
layout.horizontalSpacing= 0;
layout.verticalSpacing= 0;
fComposite.setLayout(layout);
Composite eComposite= new Composite(composite, SWT.NONE);
eComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
FillLayout fillLayout= new FillLayout(SWT.VERTICAL);
fillLayout.marginHeight= 0;
fillLayout.marginWidth= 0;
fillLayout.spacing= 0;
eComposite.setLayout(fillLayout);
Display display = parent.getDisplay();
Shell shell = parent.getShell();
Button button = new Button(fComposite, SWT.RIGHT_TO_LEFT);
button.setText("Left"); //$NON-NLS-1$
button.setImage(display.getSystemImage(SWT.ICON_ERROR));
final Scale scale = new Scale (fComposite, SWT.BORDER);
Rectangle clientArea = fComposite.getClientArea ();
scale.setBounds (clientArea.x, clientArea.y, 200, 64);
scale.setMaximum (4);
scale.setPageIncrement (1);
scale.setSelection(4);
Button rButton = new Button(fZoomerComposite, SWT.RIGHT_TO_LEFT);
rButton.setText("Right"); //$NON-NLS-1$
rButton.setImage(display.getSystemImage(SWT.ICON_INFORMATION));
scale.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
}
});
![current control should move right and need to fix the buttons][1]