source: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/swt/AboutDialog.java @ 231

Last change on this file since 231 was 195, checked in by sherbold, 13 years ago

Further work on the SWT GUI prototype.
The GUI is still not finished, however, most features are implemented and the GUI can be used. It may cause some problems, and some features are still missing.

  • Property svn:mime-type set to text/plain
File size: 2.5 KB
Line 
1package de.ugoe.cs.eventbench.swt;
2
3import org.eclipse.swt.program.Program;
4import org.eclipse.swt.widgets.Dialog;
5import org.eclipse.swt.widgets.Display;
6import org.eclipse.swt.widgets.Shell;
7import org.eclipse.swt.widgets.Label;
8import org.eclipse.swt.SWT;
9import org.eclipse.ui.forms.widgets.FormToolkit;
10import org.eclipse.ui.forms.widgets.Hyperlink;
11import org.eclipse.swt.events.MouseAdapter;
12import org.eclipse.swt.events.MouseEvent;
13
14public class AboutDialog extends Dialog {
15
16        protected Object result;
17        protected Shell shlAboutEventbenchconsole;
18        private final FormToolkit formToolkit = new FormToolkit(Display.getDefault());
19
20        /**
21         * Create the dialog.
22         * @param parent
23         * @param style
24         */
25        public AboutDialog(Shell parent, int style) {
26                super(parent, style);
27                setText("SWT Dialog");
28        }
29
30        /**
31         * Open the dialog.
32         * @return the result
33         */
34        public Object open() {
35                createContents();
36                shlAboutEventbenchconsole.open();
37                shlAboutEventbenchconsole.layout();
38                Display display = getParent().getDisplay();
39                while (!shlAboutEventbenchconsole.isDisposed()) {
40                        if (!display.readAndDispatch()) {
41                                display.sleep();
42                        }
43                }
44                return result;
45        }
46
47        /**
48         * Create contents of the dialog.
49         */
50        private void createContents() {
51                shlAboutEventbenchconsole = new Shell(getParent(), SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
52                shlAboutEventbenchconsole.setSize(283, 113);
53                shlAboutEventbenchconsole.setText("About EventBenchConsole");
54               
55                Label lblEventbenchconsole = new Label(shlAboutEventbenchconsole, SWT.CENTER);
56                lblEventbenchconsole.setBounds(10, 10, 267, 15);
57                lblEventbenchconsole.setText("EventBenchConsole");
58               
59                Label lblFurtherInformationAbout = new Label(shlAboutEventbenchconsole, SWT.WRAP);
60                lblFurtherInformationAbout.setBounds(10, 31, 267, 31);
61                lblFurtherInformationAbout.setText("Further information about this software is provided on our homepage.");
62               
63                final Hyperlink hprlnkHttpeventbenchinformatikunigoettingende = formToolkit.createHyperlink(shlAboutEventbenchconsole, "http://eventbench.informatik.uni-goettingen.de", SWT.NONE);
64                hprlnkHttpeventbenchinformatikunigoettingende.addMouseListener(new MouseAdapter() {
65                        @Override
66                        public void mouseDown(MouseEvent e) {
67                                Program.launch(hprlnkHttpeventbenchinformatikunigoettingende.getText());
68                        }
69                });
70                hprlnkHttpeventbenchinformatikunigoettingende.setBounds(10, 68, 267, 17);
71                formToolkit.paintBordersFor(hprlnkHttpeventbenchinformatikunigoettingende);
72                hprlnkHttpeventbenchinformatikunigoettingende.setBackground(null);
73
74        }
75}
Note: See TracBrowser for help on using the repository browser.