下面列出了org.eclipse.swt.widgets.Scale#setPageIncrement ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private void renderTransparency(final Shell shell) {
Group group = new Group(shell, SWT.NONE);
group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 6, 1));
group.setLayout(new GridLayout(1, false));
group.setText("Transparency");
final Scale transparencySlider = new Scale(group, SWT.HORIZONTAL);
transparencySlider.setMinimum(20);
transparencySlider.setMaximum(100);
transparencySlider.setPageIncrement(90);
transparencySlider.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
transparencySlider.setSelection(100);
transparencySlider.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event event) {
shell.setAlpha(255 * transparencySlider.getSelection() / 100);
}
});
}
private void createRankGroup(Composite parent) {
Composite prioGroup = new Composite(parent, SWT.NONE);
prioGroup.setLayout(new GridLayout(2, false));
Label minRankLabel = new Label(prioGroup, SWT.NONE);
minRankLabel.setText(getMessage("property.minRank") + System.getProperty("line.separator")
+ getMessage("property.minRank.line2"));
minRankLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
minRankSlider = new Scale(prioGroup, SWT.DROP_DOWN | SWT.READ_ONLY);
minRankSlider.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, true, false));
minRankSlider.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
int rank = minRankSlider.getSelection();
getCurrentProps().getFilterSettings().setMinRank(rank);
updateRankValueLabel();
}
});
minRankSlider.setMinimum(BugRanker.VISIBLE_RANK_MIN);
minRankSlider.setMaximum(BugRanker.VISIBLE_RANK_MAX);
minRankSlider.setSelection(getCurrentProps().getFilterSettings().getMinRank());
minRankSlider.setIncrement(1);
minRankSlider.setPageIncrement(5);
Label dummyLabel = new Label(prioGroup, SWT.NONE);
dummyLabel.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false));
rankValueLabel = new Label(prioGroup, SWT.NONE);
rankValueLabel.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, false));
updateRankValueLabel();
}
/**
* Create the composite.
* @param parent
* @param style
*/
public LegendPageBar(Composite parent, int style) {
super(parent, style);
setLayout(new GridLayout(2, false));
lblLegend = new Label(this, SWT.NONE);
lblLegend.setText("Legend ");
btnEnableLegend = new Button(this, SWT.CHECK);
btnEnableLegend.setText("Enable Legend");
Label lblBackgroundColor = new Label(this, SWT.NONE);
GridData gd_lblBackgroundColor = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_lblBackgroundColor.widthHint = 150;
lblBackgroundColor.setLayoutData(gd_lblBackgroundColor);
lblBackgroundColor.setText("Background Color");
labelColorShow = new Label(this, SWT.BORDER);
GridData gd_labelColorShow = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_labelColorShow.widthHint = 100;
labelColorShow.setLayoutData(gd_labelColorShow);
labelColorShow.setText(" ");
labelColorShow.setBackground(PageSupport.getColor(parent, 0));
labelColorShow.addMouseListener(this);
Label lblOutline = new Label(this, SWT.NONE);
lblOutline.setText("Outline Style");
comboOutline = new Combo(this, SWT.READ_ONLY);
comboOutline.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1));
comboOutline.add("None");
comboOutline.add("Dashed");
comboOutline.add("Dash Dotted");
comboOutline.add("Dotted");
comboOutline.add("Solid");
comboOutline.select(0);
lblMaxPercent = new Label(this, SWT.NONE);
lblMaxPercent.setText("Max. Percent");
scale = new Scale(this, SWT.NONE);
scale.setIncrement(2);
GridData gd_scale = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_scale.widthHint = 309;
scale.setLayoutData(gd_scale);
scale.setPageIncrement(2);
scale.setMaximum(50);
scale.setSelection(10);
scale.addSelectionListener(this);
Label lblPosition = new Label(this, SWT.NONE);
lblPosition.setText("Position");
comboPosition = new Combo(this, SWT.READ_ONLY);
comboPosition.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1));
comboPosition.add("Right");
comboPosition.add("Left");
comboPosition.add("Below");
comboPosition.add("Top");
comboPosition.select(0);
loadSettings();
}
/**
* Create the composite.
* @param parent
* @param style
*/
public LegendPagePie(Composite parent, int style) {
super(parent, style);
setLayout(new GridLayout(2, false));
lblLegend = new Label(this, SWT.NONE);
lblLegend.setText("Legend");
btnEnableLegend = new Button(this, SWT.CHECK);
btnEnableLegend.setText("Enable Legend");
Label lblBackgroundColor = new Label(this, SWT.NONE);
GridData gd_lblBackgroundColor = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_lblBackgroundColor.widthHint = 150;
lblBackgroundColor.setLayoutData(gd_lblBackgroundColor);
lblBackgroundColor.setText("Background Color");
labelColorShow = new Label(this, SWT.BORDER);
GridData gd_labelColorShow = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_labelColorShow.widthHint = 100;
labelColorShow.setLayoutData(gd_labelColorShow);
labelColorShow.setText(" ");
labelColorShow.setBackground(PageSupport.getColor(parent, 0));
labelColorShow.addMouseListener(this);
Label lblOutline = new Label(this, SWT.NONE);
lblOutline.setText("Outline Style");
comboOutline = new Combo(this, SWT.READ_ONLY);
comboOutline.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1));
comboOutline.add("None");
comboOutline.add("Dashed");
comboOutline.add("Dash Dotted");
comboOutline.add("Dotted");
comboOutline.add("Solid");
comboOutline.select(0);
lblMaxPercent = new Label(this, SWT.NONE);
lblMaxPercent.setText("Max. Percent");
scale = new Scale(this, SWT.NONE);
scale.setIncrement(2);
GridData gd_scale = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_scale.widthHint = 309;
scale.setLayoutData(gd_scale);
scale.setPageIncrement(2);
scale.setMaximum(50);
scale.setSelection(10);
scale.addSelectionListener(this);
Label lblPosition = new Label(this, SWT.NONE);
lblPosition.setText("Position");
comboPosition = new Combo(this, SWT.READ_ONLY);
comboPosition.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1));
comboPosition.add("Right");
comboPosition.add("Left");
comboPosition.add("Below");
comboPosition.add("Top");
comboPosition.select(0);
loadSettings();
}