本文整理汇总了Java中org.eclipse.swt.widgets.Slider.addSelectionListener方法的典型用法代码示例。如果您正苦于以下问题:Java Slider.addSelectionListener方法的具体用法?Java Slider.addSelectionListener怎么用?Java Slider.addSelectionListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.widgets.Slider
的用法示例。
在下文中一共展示了Slider.addSelectionListener方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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);
}
示例4: CompositeTableRow
import org.eclipse.swt.widgets.Slider; //导入方法依赖的package包/类
public CompositeTableRow(CompositeEntry entry,
Table container,
CompositingControl control,
boolean disableOp) {
this.name = entry.getName();
TableItem newItem = new TableItem(container,SWT.DOUBLE_BUFFERED);
TableEditor editor0 = new TableEditor(container);
editor0.horizontalAlignment = SWT.CENTER;
editor0.grabHorizontal = true;
chkActive = new Button(container,SWT.CHECK);
chkActive.setSelection(true);
chkActive.addSelectionListener(control);
editor0.setEditor(chkActive,newItem,0);
TableEditor editor = new TableEditor(container);
editor.horizontalAlignment = SWT.CENTER;
editor.grabHorizontal = true;
panel = new Composite(container, SWT.NONE);
panel.setLayout(new GridLayout(2,true));
slider = new Slider(panel,SWT.HORIZONTAL|SWT.NO_TRIM);
slider.setValues((int)(entry.getWeight()*100), 0, 104, 5, 1, 5);
slider.addSelectionListener(this);
slider.addSelectionListener(control);
spinner = new Spinner(panel,SWT.DOUBLE_BUFFERED);
spinner.setMinimum(0);
spinner.setMaximum(100);
spinner.setSelection((int)(entry.getWeight()*100));
spinner.addSelectionListener(control);
spinner.addSelectionListener(this);
panel.pack();
editor.setEditor(panel,newItem,2);
newItem.setText(1,name);
TableEditor editor2 = new TableEditor(container);
editor2.horizontalAlignment = SWT.CENTER;
editor2.grabHorizontal = true;
editor2.grabVertical = true;
op = new Combo(container,SWT.NONE);
op.add("ADD");
op.add("SUBTRACT");
op.add("MULTIPLY");
op.add("DIVIDE");
op.add("MINIMUM");
op.add("MAXIMUM");
op.select(convertOperationToInt(entry.getOperation()));
op.pack();
op.addSelectionListener(control);
op.setEnabled(!disableOp);
editor2.setEditor(op,newItem,3);
TableEditor editor3 = new TableEditor(container);
editor3.horizontalAlignment = SWT.CENTER;
editor3.grabHorizontal = true;
editor3.grabVertical = true;
chkRed = new Button(container,SWT.CHECK);
chkRed.setSelection(true);
chkRed.pack();
chkRed.addSelectionListener(control);
editor3.setEditor(chkRed,newItem,4);
TableEditor editor4 = new TableEditor(container);
editor4.horizontalAlignment = SWT.CENTER;
editor4.grabHorizontal = true;
editor4.grabVertical = true;
chkGreen = new Button(container,SWT.CHECK);
chkGreen.pack();
chkGreen.setSelection(true);
chkGreen.addSelectionListener(control);
editor4.setEditor(chkGreen,newItem,5);
TableEditor editor5 = new TableEditor(container);
editor5.horizontalAlignment = SWT.CENTER;
editor5.grabHorizontal = true;
editor5.grabVertical = true;
chkBlue = new Button(container,SWT.CHECK);
chkBlue.pack();
chkBlue.setSelection(true);
chkBlue.addSelectionListener(control);
editor5.setEditor(chkBlue,newItem,6);
}