本文整理汇总了Java中org.eclipse.swt.widgets.Slider.setLayoutData方法的典型用法代码示例。如果您正苦于以下问题:Java Slider.setLayoutData方法的具体用法?Java Slider.setLayoutData怎么用?Java Slider.setLayoutData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.widgets.Slider
的用法示例。
在下文中一共展示了Slider.setLayoutData方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: FrameView
import org.eclipse.swt.widgets.Slider; //导入方法依赖的package包/类
FrameView(Composite parent) {
super(parent, SWT.NONE);
GridLayout layout = new GridLayout();
setLayout(layout);
setBackground(ColorConstants.white);
header = new Label(this, SWT.BORDER);
header.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
FontManager.setFont(header, Constants.MESSAGE_FONT_SIZE);
viewer = new FrameViewer(this);
slider = new Slider(this, SWT.HORIZONTAL | SWT.BORDER);
slider.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
slider.setMinimum(1);
slider.setMaximum(1);
slider.setIncrement(1);
slider.addSelectionListener(new SelectionAdapter() {
int sel = slider.getSelection();
@Override
public void widgetSelected(SelectionEvent e) {
if(slider.getSelection() != sel) {
model.setStep(slider.getSelection()-1);
sel = slider.getSelection();
PandionJUI.navigateToLine(model.getSourceFile(), model.getStepLine());
// slider.setToolTipText(slider.getSelection() + "/" + slider.getMaximum());
}
}
});
slider.setVisible(false);
}
示例2: createDialogArea
import org.eclipse.swt.widgets.Slider; //导入方法依赖的package包/类
/**
* Create contents of the dialog.
* @param parent
*/
@Override protected Control createDialogArea(Composite parent) {
Composite container = (Composite) super.createDialogArea(parent);
container.setLayout(new GridLayout(5, false));
Label gl = new Label(container, 0);
gl.setText("Gamma correction: ");
gammaSlider = new Slider(container, SWT.HORIZONTAL);
gammaSlider.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
gammaSlider.setIncrement(1);
gammaSlider.setValues(1, 1, 100, 1, 1, 1);
gammaSlider.setSelection(50);
gammaSlider.addSelectionListener(new SelectionAdapter() {
@Override public void widgetSelected(SelectionEvent e) {
updateGammaValue();
}
});
gammaValueLabel = new Label(container, 0);
applyGammaBtn = new Button(container, SWT.PUSH);
applyGammaBtn.setText("Apply");
defaultGammaBtn = new Button(container, SWT.PUSH);
defaultGammaBtn.setText("Default");
// defaultGammaBtn.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, false, 1, 1));
updateSliderValueFromGamma();
addListener();
return container;
}
示例3: placeComponents
import org.eclipse.swt.widgets.Slider; //导入方法依赖的package包/类
protected void placeComponents( int style )
{
GridLayout gl = new GridLayout( 1, false );
gl.marginBottom = 0;
gl.marginHeight = 0;
gl.marginLeft = 0;
gl.marginRight = 0;
gl.marginTop = 0;
gl.marginWidth = 0;
this.setLayout( gl );
slider = new Slider( this, style );
GridData gd = new GridData( GridData.FILL_BOTH );
slider.setLayoutData( gd );
}
示例4: copySettingsIfSliderHasLayoutData
import org.eclipse.swt.widgets.Slider; //导入方法依赖的package包/类
@Test
public void copySettingsIfSliderHasLayoutData() {
FlatScrollBar scrollBar = createScrollBar();
Rectangle expected = new Rectangle( 10, 20, 30, 40 );
scrollBar.setBounds( expected );
MouseWheelSupport mouseWheelSupport = new MouseWheelSupport( scrollBar );
mouseWheelSupport.create();
Slider slider = ( Slider )mouseWheelSupport.getControl();
slider.setLayoutData( new FormData() );
scrollBar.setBounds( new Rectangle( 50, 60, 70, 80 ) );
mouseWheelSupport.copySettings();
assertThat( slider.getBounds() ).isEqualTo( expected );
}
示例5: createPartControl
import org.eclipse.swt.widgets.Slider; //导入方法依赖的package包/类
private void createPartControl(Composite parent)
{
GridLayout containerLayout = new GridLayout();
containerLayout.marginWidth = 0;
containerLayout.marginHeight = 0;
GridData containerData = new GridData();
containerData.horizontalAlignment = GridData.FILL;
containerData.verticalAlignment = GridData.FILL;
containerData.grabExcessHorizontalSpace = true;
containerData.grabExcessVerticalSpace = true;
Composite container = new Composite(parent, SWT.NONE);
container.setLayout(containerLayout);
container.setLayoutData(containerData);
GridData sliderData = new GridData();
sliderData.horizontalAlignment = GridData.FILL;
sliderData.verticalAlignment = GridData.FILL;
sliderData.grabExcessHorizontalSpace = true;
sliderData.grabExcessVerticalSpace = true;
slider = new Slider(container, SWT.HORIZONTAL);
slider.setLayoutData(sliderData);
slider.setEnabled(false);
sliderListener = new TimeSliderListener();
slider.addListener(SWT.Selection, sliderListener);
}
示例6: TreeViewControls
import org.eclipse.swt.widgets.Slider; //导入方法依赖的package包/类
public TreeViewControls(Composite parent) {
super(parent, SWT.NONE);
GridLayout layout = new GridLayout(5, false);
layout.marginWidth = layout.marginHeight = 2;
layout.verticalSpacing = layout.horizontalSpacing = 4;
setLayout(layout);
Label filterLabel = new Label(this, SWT.NONE);
filterLabel.setText("Filter by class or id:");
filterLabel.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, true));
mFilterText = new Text(this, SWT.LEFT | SWT.SINGLE);
mFilterText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
mFilterText.addModifyListener(mFilterTextModifyListener);
mFilterText.setText(HierarchyViewerDirector.getDirector().getFilterText());
Label smallZoomLabel = new Label(this, SWT.NONE);
smallZoomLabel.setText(" 20%");
smallZoomLabel
.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, true));
mZoomSlider = new Slider(this, SWT.HORIZONTAL);
GridData zoomSliderGridData = new GridData(GridData.CENTER, GridData.CENTER, false, false);
zoomSliderGridData.widthHint = 190;
mZoomSlider.setLayoutData(zoomSliderGridData);
mZoomSlider.setMinimum((int) (TreeViewModel.MIN_ZOOM * 10));
mZoomSlider.setMaximum((int) (TreeViewModel.MAX_ZOOM * 10 + 1));
mZoomSlider.setThumb(1);
mZoomSlider.setSelection((int) Math.round(TreeViewModel.getModel().getZoom() * 10));
mZoomSlider.addSelectionListener(mZoomSliderSelectionListener);
Label largeZoomLabel = new Label(this, SWT.NONE);
largeZoomLabel
.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, true));
largeZoomLabel.setText("200%");
addDisposeListener(mDisposeListener);
TreeViewModel.getModel().addTreeChangeListener(this);
}
示例7: open
import org.eclipse.swt.widgets.Slider; //导入方法依赖的package包/类
public void open() {
Shell parent = getParent();
GridLayout layout = new org.eclipse.swt.layout.GridLayout(1, false);
this.getParent().setLayout(layout);
this.getParent().setText("Replay control");
GridData gData = new GridData(SWT.FILL, SWT.FILL, true, false);
slider = new Slider(parent, SWT.HORIZONTAL);
Rectangle clientArea = parent.getClientArea();
slider.setBounds(clientArea.x + 10, clientArea.y + 10, 200, 32);
max = replayBodyProvider.getReplayStatesCount();
slider.setValues(0, 0, max, 1, 1, 1);
slider.setLayoutData(gData);
label = new Label(parent, SWT.BORDER);
gData = new GridData(SWT.FILL, SWT.FILL, true, false);
label.setLayoutData(gData);
if (max == 0) {
label.setText("nothing to replay");
} else {
label.setText(slider.getSelection() + 1 + "/" + max + "steps");
}
Button button = new Button(parent, SWT.NONE);
gData = new GridData(SWT.LEAD, SWT.FILL, false, false);
button.setLayoutData(gData);
button.setText("Play");
slider.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
switch (event.detail) {
case SWT.HOME:
case SWT.DRAG:
case SWT.END:
case SWT.ARROW_DOWN:
case SWT.ARROW_UP:
case SWT.PAGE_DOWN:
case SWT.PAGE_UP:
replayBodyProvider.setReplayToState(slider.getSelection());
label.setText(slider.getSelection() + 1 + "/" + max + "steps");
break;
}
}
});
button.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
replayBodyProvider.replay(slider.getSelection());
}
});
parent.open();
while (!parent.isDisposed()) {
if (!parent.getDisplay().readAndDispatch()) {
parent.getDisplay().sleep();
}
}
}