Search in sources :

Example 26 with Spinner

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();
}
Also used : Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) Spinner(org.eclipse.swt.widgets.Spinner) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label)

Example 27 with Spinner

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();
}
Also used : Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) Spinner(org.eclipse.swt.widgets.Spinner) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label)

Example 28 with Spinner

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();
}
Also used : TableEditor(org.eclipse.swt.custom.TableEditor) TableItem(org.eclipse.swt.widgets.TableItem) Text(org.eclipse.swt.widgets.Text) StackLayout(org.eclipse.swt.custom.StackLayout) Button(org.eclipse.swt.widgets.Button) Spinner(org.eclipse.swt.widgets.Spinner) Group(org.eclipse.swt.widgets.Group) MouseListener(org.eclipse.swt.events.MouseListener) Composite(org.eclipse.swt.widgets.Composite) SWT(org.eclipse.swt.SWT) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) CCombo(org.eclipse.swt.custom.CCombo) Control(org.eclipse.swt.widgets.Control) SelectionListener(org.eclipse.swt.events.SelectionListener) GridLayout(org.eclipse.swt.layout.GridLayout) Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) Spinner(org.eclipse.swt.widgets.Spinner) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label)

Example 29 with Spinner

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());
}
Also used : RowLayout(org.eclipse.swt.layout.RowLayout) Composite(org.eclipse.swt.widgets.Composite) Listener(org.eclipse.swt.widgets.Listener) SWT(org.eclipse.swt.SWT) ToolBar(org.eclipse.swt.widgets.ToolBar) Spinner(org.eclipse.swt.widgets.Spinner) Display(org.eclipse.swt.widgets.Display) ToolItem(org.eclipse.swt.widgets.ToolItem) Label(org.eclipse.swt.widgets.Label) GridLayout(org.eclipse.swt.layout.GridLayout) GridLayout(org.eclipse.swt.layout.GridLayout) Listener(org.eclipse.swt.widgets.Listener) Composite(org.eclipse.swt.widgets.Composite) Spinner(org.eclipse.swt.widgets.Spinner) ToolBar(org.eclipse.swt.widgets.ToolBar) Label(org.eclipse.swt.widgets.Label) ToolItem(org.eclipse.swt.widgets.ToolItem) Display(org.eclipse.swt.widgets.Display)

Example 30 with Spinner

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);
    });
}
Also used : Transform(org.eclipse.swt.graphics.Transform) Path(org.eclipse.swt.graphics.Path) Button(org.eclipse.swt.widgets.Button) Device(org.eclipse.swt.graphics.Device) Pattern(org.eclipse.swt.graphics.Pattern) Rectangle(org.eclipse.swt.graphics.Rectangle) Spinner(org.eclipse.swt.widgets.Spinner) GC(org.eclipse.swt.graphics.GC) Point(org.eclipse.swt.graphics.Point) Composite(org.eclipse.swt.widgets.Composite) SWT(org.eclipse.swt.SWT) Menu(org.eclipse.swt.widgets.Menu) Label(org.eclipse.swt.widgets.Label) GridLayout(org.eclipse.swt.layout.GridLayout) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) Spinner(org.eclipse.swt.widgets.Spinner) Label(org.eclipse.swt.widgets.Label) Rectangle(org.eclipse.swt.graphics.Rectangle) Point(org.eclipse.swt.graphics.Point)

Aggregations

Spinner (org.eclipse.swt.widgets.Spinner)70 GridLayout (org.eclipse.swt.layout.GridLayout)54 Label (org.eclipse.swt.widgets.Label)54 Button (org.eclipse.swt.widgets.Button)53 Composite (org.eclipse.swt.widgets.Composite)52 GridData (org.eclipse.swt.layout.GridData)51 Group (org.eclipse.swt.widgets.Group)32 SelectionEvent (org.eclipse.swt.events.SelectionEvent)25 Text (org.eclipse.swt.widgets.Text)24 Combo (org.eclipse.swt.widgets.Combo)20 SelectionListener (org.eclipse.swt.events.SelectionListener)19 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)18 SWT (org.eclipse.swt.SWT)16 ModifyListener (org.eclipse.swt.events.ModifyListener)14 ModifyEvent (org.eclipse.swt.events.ModifyEvent)11 Point (org.eclipse.swt.graphics.Point)11 Control (org.eclipse.swt.widgets.Control)10 CoreException (org.eclipse.core.runtime.CoreException)6 ILaunchConfiguration (org.eclipse.debug.core.ILaunchConfiguration)6 ILaunchConfigurationWorkingCopy (org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)6