KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sourceforge > tracelog > ui > ShellAbout


1 package net.sourceforge.tracelog.ui;
2
3 import net.sourceforge.tracelog.listeners.GenericListener;
4 import net.sourceforge.tracelog.utils.Util;
5
6 import org.eclipse.swt.SWT;
7 import org.eclipse.swt.events.MouseEvent;
8 import org.eclipse.swt.layout.GridData;
9 import org.eclipse.swt.layout.GridLayout;
10 import org.eclipse.swt.widgets.Button;
11 import org.eclipse.swt.widgets.Composite;
12 import org.eclipse.swt.widgets.Label;
13 import org.eclipse.swt.widgets.Shell;
14
15 public class ShellAbout extends AbstractWidget {
16
17     ShellAbout() {
18         super();
19     }
20
21     public void run() {
22         final Shell aboutShell = new Shell(parentShell, SWT.DIALOG_TRIM | SWT.SYSTEM_MODAL);
23         aboutShell.setLayout(new GridLayout());
24
25         GridLayout gridLayout = new GridLayout();
26         gridLayout.horizontalSpacing = 2;
27         gridLayout.verticalSpacing = 0;
28
29         GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
30
31         Composite composite = new Composite(aboutShell, SWT.BORDER);
32         composite.setLayout(gridLayout);
33         composite.setLayoutData(gridData);
34         composite.setBackground(Util.COLOR_WHITE);
35
36         Label label = new Label(composite, SWT.WRAP);
37         label.setLayoutData(gridData);
38         label.setBackground(Util.COLOR_WHITE);
39
40         String JavaDoc msg = "";
41
42         msg += "\n" + appTitle + " " + appVersion + " By " + authorName;
43
44         msg += "\n\n" + appTitle + " is a free software; you can get the software freely - including source code - "
45                 + "by downloading from http://tracelog.sourceforge.net; " + "you can redistribute it and/or modify it under the terms of the "
46                 + "GNU General Public License (GPL) as published by the Free Software Foundation.";
47
48         msg += "\n\n" + appTitle + " is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; "
49                 + "without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. "
50                 + "See the GNU General Public License for more details.";
51
52         label.setText(msg);
53
54         Button button = new Button(aboutShell, SWT.PUSH);
55         button.setText("Close");
56         button.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
57
58         button.addMouseListener(new GenericListener() {
59             public void mouseUp(MouseEvent e) {
60                 aboutShell.dispose();
61             }
62         });
63
64         aboutShell.setSize(400, 300);
65         Util.centerAlignedShell(parentShell, aboutShell);
66         aboutShell.open();
67
68     }
69 }
70
Popular Tags