package net.sourceforge.tracelog.ui;
import net.sourceforge.tracelog.listeners.GenericListener;
import net.sourceforge.tracelog.utils.Util;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
public class ShellAbout extends AbstractWidget {
ShellAbout() {
super();
}
public void run() {
final Shell aboutShell = new Shell(parentShell, SWT.DIALOG_TRIM | SWT.SYSTEM_MODAL);
aboutShell.setLayout(new GridLayout());
GridLayout gridLayout = new GridLayout();
gridLayout.horizontalSpacing = 2;
gridLayout.verticalSpacing = 0;
GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
Composite composite = new Composite(aboutShell, SWT.BORDER);
composite.setLayout(gridLayout);
composite.setLayoutData(gridData);
composite.setBackground(UIUtil.getColorWhite());
Label label = new Label(composite, SWT.WRAP);
label.setLayoutData(gridData);
label.setBackground(UIUtil.getColorWhite());
String msg = "";
msg += Util.LINE_BREAK + appTitle + " " + appVersion + " By " + authorName;
msg += Util.LINE_BREAK + Util.LINE_BREAK + appTitle + " is a free software; you can get the software freely - including source code - "
+ "by downloading from http://tracelog.sourceforge.net; " + "you can redistribute it and/or modify it under the terms of the "
+ "GNU General Public License (GPL) as published by the Free Software Foundation.";
msg += Util.LINE_BREAK + Util.LINE_BREAK + appTitle + " is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; "
+ "without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. "
+ "See the GNU General Public License for more details.";
label.setText(msg);
Button button = new Button(aboutShell, SWT.PUSH);
button.setText("Close");
button.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
button.addMouseListener(new GenericListener() {
public void mouseUp(MouseEvent e) {
aboutShell.dispose();
}
});
aboutShell.setSize(400, 300);
UIUtil.centerAlignedShell(parentShell, aboutShell);
aboutShell.open();
}
}
|