Search in sources :

Example 11 with MouseEvent

use of org.eclipse.swt.events.MouseEvent in project translationstudio8 by heartsome.

the class LicenseManageDialog method createActiveComp.

private void createActiveComp(Composite parent) {
    Group licenseIdGroup = new Group(parent, SWT.NONE);
    licenseIdGroup.setText(Messages.getString("license.LicenseManageDialog.licenseIdGroup"));
    GridData dataLicenseIdGroup = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
    dataLicenseIdGroup.heightHint = 110;
    licenseIdGroup.setLayoutData(dataLicenseIdGroup);
    GridLayout layoutGroup = new GridLayout(2, false);
    layoutGroup.marginLeft = 5;
    layoutGroup.marginHeight = 10;
    licenseIdGroup.setLayout(layoutGroup);
    Label label = new Label(licenseIdGroup, SWT.NONE);
    label.setText(Messages.getString("license.LicenseManageDialog.licenseIdLabel"));
    createIdInputComp(licenseIdGroup);
    Composite compLink = new Composite(licenseIdGroup, SWT.NONE);
    RowLayout layoutLink = new RowLayout();
    layoutLink.marginTop = 20;
    layoutLink.marginRight = 0;
    layoutLink.marginLeft = 0;
    layoutLink.marginBottom = 10;
    compLink.setLayout(layoutLink);
    GridData linkData = new GridData(GridData.FILL_HORIZONTAL);
    linkData.horizontalSpan = 2;
    compLink.setLayoutData(linkData);
    Label label1 = new Label(compLink, SWT.NONE);
    label1.setText(Messages.getString("license.LicenseManageDialog.label1"));
    if (!"L".equals(System.getProperty("TSEdition"))) {
        Label link1 = new Label(compLink, SWT.NONE);
        link1.setText(Messages.getString("license.LicenseManageDialog.link1"));
        link1.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLUE));
        link1.setCursor(cursor);
        link1.addMouseListener(new MouseListener() {

            public void mouseUp(MouseEvent e) {
            }

            public void mouseDown(MouseEvent e) {
                Program.launch(Messages.getString("license.LicenseManageDialog.urlr8buy") + "&PRODUCT=" + ProtectionFactory.getProduct() + "&PLATFORM=" + ProtectionFactory.getPlatform());
            }

            public void mouseDoubleClick(MouseEvent e) {
            }
        });
        Label label2 = new Label(compLink, SWT.NONE);
        label2.setText(Messages.getString("license.LicenseManageDialog.label2"));
    }
    Label link2 = new Label(compLink, SWT.NONE);
    link2.setText(Messages.getString("license.LicenseManageDialog.link2"));
    link2.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLUE));
    link2.setCursor(cursor);
    link2.addMouseListener(new MouseListener() {

        public void mouseUp(MouseEvent e) {
        }

        public void mouseDown(MouseEvent e) {
            Program.launch(Messages.getString("license.LicenseManageDialog.urlr8trial") + "&PRODUCT=" + ProtectionFactory.getProduct() + "&PLATFORM=" + ProtectionFactory.getPlatform());
        }

        public void mouseDoubleClick(MouseEvent e) {
        }
    });
    Label label3 = new Label(compLink, SWT.NONE);
    label3.setText(Messages.getString("license.LicenseManageDialog.label3"));
}
Also used : Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) MouseListener(org.eclipse.swt.events.MouseListener) MouseEvent(org.eclipse.swt.events.MouseEvent) Composite(org.eclipse.swt.widgets.Composite) RowLayout(org.eclipse.swt.layout.RowLayout) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label)

Example 12 with MouseEvent

use of org.eclipse.swt.events.MouseEvent in project translationstudio8 by heartsome.

the class OfflineActiveDialog method createDialogArea.

@Override
protected Control createDialogArea(Composite parent) {
    Composite tparent = (Composite) super.createDialogArea(parent);
    GridLayout layout = new GridLayout();
    layout.marginWidth = 10;
    layout.marginTop = 10;
    tparent.setLayout(layout);
    GridDataFactory.fillDefaults().grab(true, true).applyTo(tparent);
    Composite compNav = new Composite(tparent, SWT.NONE);
    GridLayout navLayout = new GridLayout();
    compNav.setLayout(navLayout);
    createNavigation(compNav);
    Group groupLicenseId = new Group(tparent, SWT.NONE);
    groupLicenseId.setText(Messages.getString("license.OfflineActiveDialog.licenseIdGroup"));
    GridDataFactory.fillDefaults().grab(true, true).applyTo(groupLicenseId);
    GridLayout layoutGroup = new GridLayout(2, false);
    layoutGroup.marginLeft = 5;
    layoutGroup.marginHeight = 100;
    groupLicenseId.setLayout(layoutGroup);
    Label label = new Label(groupLicenseId, SWT.NONE);
    label.setText(Messages.getString("license.LicenseManageDialog.licenseIdLabel"));
    createIdInputComp(groupLicenseId);
    Composite compLink = new Composite(groupLicenseId, SWT.NONE);
    RowLayout layoutLink = new RowLayout();
    layoutLink.marginTop = 20;
    layoutLink.marginRight = 0;
    layoutLink.marginLeft = 0;
    layoutLink.marginBottom = 10;
    compLink.setLayout(layoutLink);
    GridData linkData = new GridData(GridData.FILL_HORIZONTAL);
    linkData.horizontalSpan = 2;
    compLink.setLayoutData(linkData);
    Label label1 = new Label(compLink, SWT.NONE);
    label1.setText(Messages.getString("license.LicenseManageDialog.label1"));
    if (!"L".equals(System.getProperty("TSEdition"))) {
        Label link1 = new Label(compLink, SWT.NONE);
        link1.setText(Messages.getString("license.LicenseManageDialog.link1"));
        link1.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLUE));
        link1.setCursor(cursor);
        link1.addMouseListener(new MouseListener() {

            public void mouseUp(MouseEvent e) {
            }

            public void mouseDown(MouseEvent e) {
                Program.launch(Messages.getString("license.LicenseManageDialog.urlr8buy") + "&PRODUCT=" + ProtectionFactory.getProduct() + "&PLATFORM=" + ProtectionFactory.getPlatform());
            }

            public void mouseDoubleClick(MouseEvent e) {
            }
        });
    } else {
        Label link2 = new Label(compLink, SWT.NONE);
        link2.setText(Messages.getString("license.LicenseManageDialog.link2"));
        link2.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLUE));
        link2.setCursor(cursor);
        link2.addMouseListener(new MouseListener() {

            public void mouseUp(MouseEvent e) {
            }

            public void mouseDown(MouseEvent e) {
                Program.launch(Messages.getString("license.LicenseManageDialog.urlr8trial") + "&PRODUCT=" + ProtectionFactory.getProduct() + "&PLATFORM=" + ProtectionFactory.getPlatform());
            }

            public void mouseDoubleClick(MouseEvent e) {
            }
        });
    }
    Label label3 = new Label(compLink, SWT.NONE);
    label3.setText(Messages.getString("license.LicenseManageDialog.label3"));
    return tparent;
}
Also used : Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) MouseListener(org.eclipse.swt.events.MouseListener) MouseEvent(org.eclipse.swt.events.MouseEvent) Composite(org.eclipse.swt.widgets.Composite) RowLayout(org.eclipse.swt.layout.RowLayout) Label(org.eclipse.swt.widgets.Label) GridData(org.eclipse.swt.layout.GridData)

Example 13 with MouseEvent

use of org.eclipse.swt.events.MouseEvent in project otertool by wuntee.

the class LoadApkFromDeviceDialog method createContents.

/**
	 * Create contents of the dialog.
	 */
private void createContents() {
    shlSelectApk = new Shell(getParent(), SWT.DIALOG_TRIM | SWT.RESIZE);
    shlSelectApk.setSize(592, 486);
    shlSelectApk.setText("Select APK");
    shlSelectApk.setLayout(new GridLayout(1, false));
    table = new Table(shlSelectApk, SWT.BORDER | SWT.FULL_SELECTION);
    table.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseDoubleClick(MouseEvent arg0) {
            result = (PackageBean) table.getSelection()[0].getData(PACKAGE_BEAN);
            shlSelectApk.close();
        }
    });
    table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    table.setBounds(0, 0, 3, 19);
    table.setHeaderVisible(true);
    table.setLinesVisible(true);
    final TableColumn tblclmnApk = new TableColumn(table, SWT.NONE);
    tblclmnApk.setWidth(240);
    tblclmnApk.setText("APK");
    final TableColumn tblclmnPackage = new TableColumn(table, SWT.NONE);
    tblclmnPackage.setWidth(338);
    tblclmnPackage.setText("Package");
    final String[] keys = { PACKAGE_BEAN };
    GuiWorkshop.addColumnSorter(table, tblclmnApk, 0, keys);
    GuiWorkshop.addColumnSorter(table, tblclmnPackage, 1, keys);
    Composite composite = new Composite(shlSelectApk, SWT.NONE);
    composite.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    composite.setBounds(0, 0, 64, 64);
    GridLayout gl_composite = new GridLayout(2, false);
    gl_composite.verticalSpacing = 0;
    gl_composite.marginWidth = 0;
    gl_composite.marginHeight = 0;
    gl_composite.horizontalSpacing = 0;
    composite.setLayout(gl_composite);
    Button btnLoad = new Button(composite, SWT.NONE);
    btnLoad.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent arg0) {
            if (table.getSelection().length == 0) {
                GuiWorkshop.messageError(shlSelectApk, "Please Select an APK to load.");
            } else {
                result = (PackageBean) table.getSelection()[0].getData(PACKAGE_BEAN);
                shlSelectApk.close();
            }
        }
    });
    btnLoad.setText("Load");
    Button btnCancel = new Button(composite, SWT.NONE);
    btnCancel.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent arg0) {
            result = null;
            shlSelectApk.close();
        }
    });
    btnCancel.setText("Cancel");
}
Also used : Table(org.eclipse.swt.widgets.Table) MouseEvent(org.eclipse.swt.events.MouseEvent) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) MouseAdapter(org.eclipse.swt.events.MouseAdapter) TableColumn(org.eclipse.swt.widgets.TableColumn) Shell(org.eclipse.swt.widgets.Shell) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) PackageBean(com.wuntee.oter.packagemanager.PackageBean) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent)

Example 14 with MouseEvent

use of org.eclipse.swt.events.MouseEvent in project yyl_example by Relucent.

the class HelloCanvasArrow method open.

public void open() {
    final Display display = Display.getDefault();
    final Shell shell = new Shell();
    shell.setLayout(new FillLayout());
    final Canvas canvas = new Canvas(shell, SWT.NONE);
    canvas.setCursor(SWTResourceManager.getCursor(SWT.CURSOR_ARROW));
    canvas.addMouseListener(new MouseListener() {

        public void mouseDoubleClick(MouseEvent arg0) {
        }

        public void mouseDown(MouseEvent e) {
            p[0] = e.x;
            p[1] = e.y;
            b = true;
        }

        public void mouseUp(MouseEvent arg0) {
            if (b) {
                int[] tp = new int[4];
                tp[0] = p[0];
                tp[1] = p[0];
                tp[2] = p[0];
                tp[3] = p[3];
            }
            b = false;
        }
    });
    canvas.addMouseMoveListener(new MouseMoveListener() {

        public void mouseMove(MouseEvent e) {
            p[2] = e.x;
            p[3] = e.y;
            canvas.redraw();
        }
    });
    canvas.addPaintListener(new PaintListener() {

        public void paintControl(PaintEvent paintevent) {
            if (b) {
                paintArrow(paintevent.gc, new Point(p[0], p[1]), new Point(p[2], p[3]));
            }
        }
    });
    shell.setText("test");
    shell.setSize(300, 300);
    shell.layout();
    shell.open();
    while (!shell.isDisposed()) if (!display.readAndDispatch())
        display.sleep();
}
Also used : MouseMoveListener(org.eclipse.swt.events.MouseMoveListener) Shell(org.eclipse.swt.widgets.Shell) MouseListener(org.eclipse.swt.events.MouseListener) MouseEvent(org.eclipse.swt.events.MouseEvent) PaintEvent(org.eclipse.swt.events.PaintEvent) PaintListener(org.eclipse.swt.events.PaintListener) Canvas(org.eclipse.swt.widgets.Canvas) FillLayout(org.eclipse.swt.layout.FillLayout) Point(org.eclipse.swt.graphics.Point) Display(org.eclipse.swt.widgets.Display)

Example 15 with MouseEvent

use of org.eclipse.swt.events.MouseEvent in project tdi-studio-se by Talend.

the class ReviewComponentDialog method createRatingComp.

private void createRatingComp(Composite parent) {
    initImages();
    final Composite rateBtnComp = new Composite(parent, SWT.NONE);
    final GridLayout rateLayout = new GridLayout();
    rateLayout.numColumns = 5;
    rateBtnComp.setLayout(rateLayout);
    rateBtnComp.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    for (int i = 0; i < 5; i++) {
        final Button rateButton = new Button(rateBtnComp, SWT.NONE);
        rateButton.setLayoutData(new GridData(30, SWT.DEFAULT));
        rateButton.setImage(imageMap.get(1));
        rateButton.setData(0);
        rateBtnMap.put(i, rateButton);
        rateButton.addMouseTrackListener(new MouseTrackListener() {

            public void mouseHover(MouseEvent e) {
                handleMouseHover(rateButton);
            }

            public void mouseExit(MouseEvent e) {
                handleMouseExit(rateButton);
            }

            public void mouseEnter(MouseEvent e) {
            }
        });
        rateButton.addMouseListener(new MouseListener() {

            public void mouseUp(MouseEvent e) {
            }

            public void mouseDown(MouseEvent e) {
                handleMouseDown(rateButton);
                checkInput();
            }

            public void mouseDoubleClick(MouseEvent e) {
            }
        });
    }
    rateLabel = new Label(parent, SWT.NONE);
    rateLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    rateLabel.setText("Please select your rating*");
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) MouseEvent(org.eclipse.swt.events.MouseEvent) MouseListener(org.eclipse.swt.events.MouseListener) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) MouseTrackListener(org.eclipse.swt.events.MouseTrackListener) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) Point(org.eclipse.swt.graphics.Point)

Aggregations

MouseEvent (org.eclipse.swt.events.MouseEvent)75 MouseAdapter (org.eclipse.swt.events.MouseAdapter)39 GridData (org.eclipse.swt.layout.GridData)30 SelectionEvent (org.eclipse.swt.events.SelectionEvent)29 MouseListener (org.eclipse.swt.events.MouseListener)25 Point (org.eclipse.swt.graphics.Point)25 KeyEvent (org.eclipse.swt.events.KeyEvent)22 Composite (org.eclipse.swt.widgets.Composite)22 GridLayout (org.eclipse.swt.layout.GridLayout)21 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)18 Button (org.eclipse.swt.widgets.Button)15 FocusEvent (org.eclipse.swt.events.FocusEvent)14 PaintEvent (org.eclipse.swt.events.PaintEvent)12 Text (org.eclipse.swt.widgets.Text)12 KeyListener (org.eclipse.swt.events.KeyListener)11 ModifyEvent (org.eclipse.swt.events.ModifyEvent)11 ModifyListener (org.eclipse.swt.events.ModifyListener)11 TraverseEvent (org.eclipse.swt.events.TraverseEvent)11 Event (org.eclipse.swt.widgets.Event)11 Label (org.eclipse.swt.widgets.Label)11