01: package net.sourceforge.tracelog.ui;
02:
03: import net.sourceforge.tracelog.listeners.GenericListener;
04: import net.sourceforge.tracelog.utils.Util;
05:
06: import org.eclipse.swt.SWT;
07: import org.eclipse.swt.events.MouseEvent;
08: import org.eclipse.swt.layout.GridData;
09: 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
23: | SWT.SYSTEM_MODAL);
24: aboutShell.setLayout(new GridLayout());
25:
26: GridLayout gridLayout = new GridLayout();
27: gridLayout.horizontalSpacing = 2;
28: gridLayout.verticalSpacing = 0;
29:
30: GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
31:
32: Composite composite = new Composite(aboutShell, SWT.BORDER);
33: composite.setLayout(gridLayout);
34: composite.setLayoutData(gridData);
35: composite.setBackground(UIUtil.getColorWhite());
36:
37: Label label = new Label(composite, SWT.WRAP);
38: label.setLayoutData(gridData);
39: label.setBackground(UIUtil.getColorWhite());
40:
41: String msg = "";
42:
43: msg += Util.LINE_BREAK + appTitle + " " + appVersion + " By "
44: + authorName;
45:
46: msg += Util.LINE_BREAK
47: + Util.LINE_BREAK
48: + appTitle
49: + " is a free software; you can get the software freely - including source code - "
50: + "by downloading from http://tracelog.sourceforge.net; "
51: + "you can redistribute it and/or modify it under the terms of the "
52: + "GNU General Public License (GPL) as published by the Free Software Foundation.";
53:
54: msg += Util.LINE_BREAK
55: + Util.LINE_BREAK
56: + appTitle
57: + " is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; "
58: + "without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. "
59: + "See the GNU General Public License for more details.";
60:
61: label.setText(msg);
62:
63: Button button = new Button(aboutShell, SWT.PUSH);
64: button.setText("Close");
65: button
66: .setLayoutData(new GridData(
67: GridData.HORIZONTAL_ALIGN_END));
68:
69: button.addMouseListener(new GenericListener() {
70: public void mouseUp(MouseEvent e) {
71: aboutShell.dispose();
72: }
73: });
74:
75: aboutShell.setSize(400, 300);
76: UIUtil.centerAlignedShell(parentShell, aboutShell);
77: aboutShell.open();
78:
79: }
80: }
|