use of org.eclipse.swt.widgets.Spinner in project eclipse.platform.swt by eclipse.
the class FormLayoutTab method createControlWidgets.
/**
* Creates the control widgets.
*/
@Override
void createControlWidgets() {
/* Controls the margins and spacing of the FormLayout */
Group marginGroup = new Group(controlGroup, SWT.NONE);
marginGroup.setText(LayoutExample.getResourceString("Margins_Spacing"));
marginGroup.setLayout(new GridLayout(2, false));
marginGroup.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
new Label(marginGroup, SWT.NONE).setText("marginWidth");
marginWidth = new Spinner(marginGroup, SWT.BORDER);
marginWidth.setSelection(0);
marginWidth.addSelectionListener(selectionListener);
new Label(marginGroup, SWT.NONE).setText("marginHeight");
marginHeight = new Spinner(marginGroup, SWT.BORDER);
marginHeight.setSelection(0);
marginHeight.addSelectionListener(selectionListener);
new Label(marginGroup, SWT.NONE).setText("marginLeft");
marginLeft = new Spinner(marginGroup, SWT.BORDER);
marginLeft.setSelection(0);
marginLeft.addSelectionListener(selectionListener);
new Label(marginGroup, SWT.NONE).setText("marginRight");
marginRight = new Spinner(marginGroup, SWT.BORDER);
marginRight.setSelection(0);
marginRight.addSelectionListener(selectionListener);
new Label(marginGroup, SWT.NONE).setText("marginTop");
marginTop = new Spinner(marginGroup, SWT.BORDER);
marginTop.setSelection(0);
marginTop.addSelectionListener(selectionListener);
new Label(marginGroup, SWT.NONE).setText("marginBottom");
marginBottom = new Spinner(marginGroup, SWT.BORDER);
marginBottom.setSelection(0);
marginBottom.addSelectionListener(selectionListener);
new Label(marginGroup, SWT.NONE).setText("spacing");
spacing = new Spinner(marginGroup, SWT.BORDER);
spacing.setSelection(0);
spacing.addSelectionListener(selectionListener);
/* Add common controls */
super.createControlWidgets();
}
use of org.eclipse.swt.widgets.Spinner in project eclipse.platform.swt by eclipse.
the class RowLayoutTab method createControlWidgets.
/**
* Creates the control widgets.
*/
@Override
void createControlWidgets() {
/* Controls the type of RowLayout */
Group typeGroup = new Group(controlGroup, SWT.NONE);
typeGroup.setText(LayoutExample.getResourceString("Type"));
typeGroup.setLayout(new GridLayout());
typeGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
horizontal = new Button(typeGroup, SWT.RADIO);
horizontal.setText("SWT.HORIZONTAL");
horizontal.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
horizontal.setSelection(true);
horizontal.addSelectionListener(selectionListener);
vertical = new Button(typeGroup, SWT.RADIO);
vertical.setText("SWT.VERTICAL");
vertical.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
vertical.addSelectionListener(selectionListener);
/* Controls the margins and spacing of the RowLayout */
Group marginGroup = new Group(controlGroup, SWT.NONE);
marginGroup.setText(LayoutExample.getResourceString("Margins_Spacing"));
marginGroup.setLayout(new GridLayout(2, false));
marginGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 2));
new Label(marginGroup, SWT.NONE).setText("marginWidth");
marginWidth = new Spinner(marginGroup, SWT.BORDER);
marginWidth.setSelection(0);
marginWidth.addSelectionListener(selectionListener);
new Label(marginGroup, SWT.NONE).setText("marginHeight");
marginHeight = new Spinner(marginGroup, SWT.BORDER);
marginHeight.setSelection(0);
marginHeight.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
marginHeight.addSelectionListener(selectionListener);
new Label(marginGroup, SWT.NONE).setText("marginLeft");
marginLeft = new Spinner(marginGroup, SWT.BORDER);
marginLeft.setSelection(3);
marginLeft.addSelectionListener(selectionListener);
new Label(marginGroup, SWT.NONE).setText("marginRight");
marginRight = new Spinner(marginGroup, SWT.BORDER);
marginRight.setSelection(3);
marginRight.addSelectionListener(selectionListener);
new Label(marginGroup, SWT.NONE).setText("marginTop");
marginTop = new Spinner(marginGroup, SWT.BORDER);
marginTop.setSelection(3);
marginTop.addSelectionListener(selectionListener);
new Label(marginGroup, SWT.NONE).setText("marginBottom");
marginBottom = new Spinner(marginGroup, SWT.BORDER);
marginBottom.setSelection(3);
marginBottom.addSelectionListener(selectionListener);
new Label(marginGroup, SWT.NONE).setText("spacing");
spacing = new Spinner(marginGroup, SWT.BORDER);
spacing.setSelection(3);
spacing.addSelectionListener(selectionListener);
/* Controls other parameters of the RowLayout */
Group specGroup = new Group(controlGroup, SWT.NONE);
specGroup.setText(LayoutExample.getResourceString("Properties"));
specGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
specGroup.setLayout(new GridLayout());
wrap = new Button(specGroup, SWT.CHECK);
wrap.setText("Wrap");
wrap.setSelection(true);
wrap.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
wrap.addSelectionListener(selectionListener);
pack = new Button(specGroup, SWT.CHECK);
pack.setText("Pack");
pack.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
pack.setSelection(true);
pack.addSelectionListener(selectionListener);
fill = new Button(specGroup, SWT.CHECK);
fill.setText("Fill");
fill.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
fill.addSelectionListener(selectionListener);
justify = new Button(specGroup, SWT.CHECK);
justify.setText("Justify");
justify.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
justify.addSelectionListener(selectionListener);
center = new Button(specGroup, SWT.CHECK);
center.setText("Center");
center.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
center.addSelectionListener(selectionListener);
/* Add common controls */
super.createControlWidgets();
}
use of org.eclipse.swt.widgets.Spinner in project eclipse.platform.swt by eclipse.
the class StackLayoutTab method createControlWidgets.
/**
* Creates the control widgets.
*/
@Override
void createControlWidgets() {
/* Controls the topControl in the StackLayout */
Group columnGroup = new Group(controlGroup, SWT.NONE);
// (LayoutExample.getResourceString ("Top_Control"));
columnGroup.setText("topControl");
columnGroup.setLayout(new GridLayout(3, false));
columnGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
backButton = new Button(columnGroup, SWT.PUSH);
backButton.setText("<<");
backButton.setEnabled(false);
backButton.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false));
backButton.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> setTopControl(currentLayer - 1)));
topControl = new Label(columnGroup, SWT.BORDER);
topControl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
advanceButton = new Button(columnGroup, SWT.PUSH);
advanceButton.setText(">>");
advanceButton.setEnabled(false);
advanceButton.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> setTopControl(currentLayer + 1)));
/* Controls the margins of the StackLayout */
Group marginGroup = new Group(controlGroup, SWT.NONE);
marginGroup.setText(LayoutExample.getResourceString("Margins"));
marginGroup.setLayout(new GridLayout(2, false));
marginGroup.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
new Label(marginGroup, SWT.NONE).setText("marginWidth");
marginWidth = new Spinner(marginGroup, SWT.BORDER);
marginWidth.setSelection(0);
marginWidth.addSelectionListener(selectionListener);
new Label(marginGroup, SWT.NONE).setText("marginHeight");
marginHeight = new Spinner(marginGroup, SWT.BORDER);
marginHeight.setSelection(0);
marginHeight.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
marginHeight.addSelectionListener(selectionListener);
/* Add common controls */
super.createControlWidgets();
}
use of org.eclipse.swt.widgets.Spinner in project eclipse.platform.swt by eclipse.
the class AnimatedGraphicsTab method createToolBar.
/**
* Creates the toolbar controls: play, pause and animation timer.
*
* @param parent A composite
*/
void createToolBar(final Composite parent) {
final Display display = parent.getDisplay();
toolBar = new ToolBar(parent, SWT.FLAT);
Listener toolBarListener = event -> {
switch(event.type) {
case SWT.Selection:
{
if (event.widget == playItem) {
animate = true;
playItem.setEnabled(!animate);
pauseItem.setEnabled(animate);
} else if (event.widget == pauseItem) {
animate = false;
playItem.setEnabled(!animate);
pauseItem.setEnabled(animate);
}
}
break;
}
};
// play tool item
playItem = new ToolItem(toolBar, SWT.PUSH);
// $NON-NLS-1$
playItem.setText(GraphicsExample.getResourceString("Play"));
// $NON-NLS-1$
playItem.setImage(example.loadImage(display, "play.gif"));
playItem.addListener(SWT.Selection, toolBarListener);
// pause tool item
pauseItem = new ToolItem(toolBar, SWT.PUSH);
// $NON-NLS-1$
pauseItem.setText(GraphicsExample.getResourceString("Pause"));
// $NON-NLS-1$
pauseItem.setImage(example.loadImage(display, "pause.gif"));
pauseItem.addListener(SWT.Selection, toolBarListener);
// timer spinner
Composite comp = new Composite(parent, SWT.NONE);
GridLayout gridLayout = new GridLayout(2, false);
comp.setLayout(gridLayout);
Label label = new Label(comp, SWT.CENTER);
// $NON-NLS-1$
label.setText(GraphicsExample.getResourceString("Animation"));
timerSpinner = new Spinner(comp, SWT.BORDER | SWT.WRAP);
timerSpinner.setMaximum(1000);
playItem.setEnabled(false);
animate = true;
timerSpinner.setSelection(getInitialAnimationTime());
}
use of org.eclipse.swt.widgets.Spinner in project eclipse.platform.swt by eclipse.
the class CustomAlphaTab method createControlPanel.
/**
* Creates the widgets used to control the drawing.
*/
@Override
public void createControlPanel(Composite parent) {
super.createControlPanel(parent);
// create drop down combo for choosing clipping
Composite comp;
// create spinner for line width
comp = new Composite(parent, SWT.NONE);
comp.setLayout(new GridLayout(2, false));
new Label(comp, SWT.CENTER).setText(GraphicsExample.getResourceString(// $NON-NLS-1$
"Alpha"));
alphaSpinner = new Spinner(comp, SWT.BORDER | SWT.WRAP);
alphaSpinner.setMinimum(0);
alphaSpinner.setMaximum(255);
alphaSpinner.setSelection(127);
alphaSpinner.addListener(SWT.Selection, event -> example.redraw());
// color menu
ColorMenu cm = new ColorMenu();
cm.setPatternItems(example.checkAdvancedGraphics());
menu = cm.createMenu(parent.getParent(), gb -> {
background = gb;
colorButton.setImage(gb.getThumbNail());
example.redraw();
});
// initialize the background to the 5th item in the menu (blue)
background = (GraphicsBackground) menu.getItem(4).getData();
// color button
comp = new Composite(parent, SWT.NONE);
comp.setLayout(new GridLayout(2, false));
colorButton = new Button(comp, SWT.PUSH);
colorButton.setText(GraphicsExample.getResourceString(// $NON-NLS-1$
"Color"));
colorButton.setImage(background.getThumbNail());
colorButton.addListener(SWT.Selection, event -> {
final Button button = (Button) event.widget;
final Composite parent1 = button.getParent();
Rectangle bounds = button.getBounds();
Point point = parent1.toDisplay(new Point(bounds.x, bounds.y));
menu.setLocation(point.x, point.y + bounds.height);
menu.setVisible(true);
});
}
Aggregations