⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 aboutdialog.java

📁 CD Manager光盘资料管家婆源代码
💻 JAVA
字号:
package com.galaxyworkstation.view;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Dialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;

import com.galaxyworkstation.model.SWTResourceManager;


public class AboutDialog extends Dialog {

	protected Object result;
	protected Shell shell;
	
	private Label label;
	private  Group group;
	private Label cdManagerLabel;

	/**
	 * Create the dialog
	 * @param parent
	 * @param style
	 */
	public AboutDialog(Shell parent, int style) {
		super(parent, style);
	}

	/**
	 * Create the dialog
	 * @param parent
	 */
	public AboutDialog(Shell parent) {
		this(parent, SWT.NONE);
	}

	/**
	 * Open the dialog
	 */
	public Object open() {
		createContents();
		addListener();
		shell.open();
		shell.layout();
		Display display = getParent().getDisplay();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch())
				display.sleep();
		}
		return result;
	}

	/**
	 * Create contents of the dialog
	 * */
	protected void createContents() {
		shell = new Shell(getParent(),  SWT.APPLICATION_MODAL);
		shell.setLayout(new FormLayout());
		shell.setSize(350, 336);
		shell.setLocation((shell.getDisplay().getClientArea().width - shell.getClientArea().width) / 2,
				(shell.getDisplay().getClientArea().height - shell.getClientArea().height) / 2);
		shell.setText("关于 CD Manager");

		label = new Label(shell, SWT.NONE);
		label.setImage(SWTResourceManager.getImage(AboutDialog.class, "../../../image/about.png"));
		final FormData fd_label = new FormData();
		fd_label.right = new FormAttachment(100, 0);
		fd_label.bottom = new FormAttachment(0, 125);
		fd_label.top = new FormAttachment(0, 0);
		fd_label.left = new FormAttachment(0, 0);
		label.setLayoutData(fd_label);

		group = new Group(shell, SWT.NONE);
		final FormData fd_group = new FormData();
		fd_group.top = new FormAttachment(label, 5, SWT.BOTTOM);
		fd_group.right = new FormAttachment(100, -20);
		fd_group.bottom = new FormAttachment(100, -20);
		fd_group.left = new FormAttachment(0, 20);
		group.setLayoutData(fd_group);
		group.setLayout(new FormLayout());

		cdManagerLabel = new Label(group, SWT.NONE);
		cdManagerLabel.setText("CD Manager\n\nVersion 0.99\n\n\nAuthor:\t李 奕  codingliyi@gmail.com\n\t姜 哲  windrain453@gmail.com\n\n(c) Copyright Galaxy Workstation 2007-2008 \nAll rights reserved.");
		final FormData fd_cdManagerLabel = new FormData();
		fd_cdManagerLabel.top = new FormAttachment(0, 10);
		fd_cdManagerLabel.bottom = new FormAttachment(0, 150);
		fd_cdManagerLabel.right = new FormAttachment(0, 290);
		fd_cdManagerLabel.left = new FormAttachment(0, 15);
		cdManagerLabel.setLayoutData(fd_cdManagerLabel);
		
	}
	
	/*************************************************
	 ************Register Listener *******************
	 *************************************************/
	
	private void addListener(){
		
		shell.addMouseListener(listener);
		group.addMouseListener(listener);
		label.addMouseListener(listener);
		cdManagerLabel.addMouseListener(listener);
	}
	
	/*********************************************************
	 ******************* Listener ****************************
	 *********************************************************/
	
	/**
	 * 鼠标单击控件事件
	 */
	private MouseListener listener = new MouseListener(){

		public void mouseDoubleClick(MouseEvent e) {
		}

		public void mouseDown(MouseEvent e) {
		}

		public void mouseUp(MouseEvent e) {
		
			shell.dispose();
		}
		
	};

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -