📄 versioninfo.java
字号:
package com.sensevision.reader;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.ICellModifier;
import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.TextCellEditor;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Dialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Item;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.Text;
public class VersionInfo extends Dialog {
protected Shell shell;
/**
* Create the dialog
*
* @param parent
* @param style
*/
public VersionInfo(Shell parent, int style) {
super(parent, style);
}
/**
* Create the dialog
*
* @param parent
*/
public VersionInfo(Shell parent) {
this(parent, SWT.NONE);
}
/**
* Open the dialog
*
* @return the result
*/
public void open() {
createContents();
shell.open();
shell.layout();
Display display = getParent().getDisplay();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
}
/**
* Create contents of the dialog
*/
protected void createContents() {
shell = new Shell(getParent(), SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
shell.setSize(302, 186);
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Point shellSize = shell.getSize();
if (shellSize.y > screenSize.height) {
shellSize.y = screenSize.height;
}
if (shellSize.x > screenSize.width) {
shellSize.x = screenSize.width;
}
shell.setLocation((screenSize.width - shellSize.x) / 2, (screenSize.height - shellSize.y) / 2);
shell.setText("About this Reader");
Image image2 = new Image(shell.getDisplay(), "version.jpg");
final Group group_4 = new Group(shell, SWT.NONE);
group_4.setBackgroundMode(SWT.INHERIT_NONE);
group_4.setBounds(0, 0, 184, 119);
group_4.setBackgroundImage(image2);
final Button button = new Button(shell, SWT.NONE);
button.setText("OK");
button.setBounds(208, 128, 56, 23);
button.addMouseListener(new MouseAdapter() {
public void mouseDown(final MouseEvent e) {
shell.close();
}
});
final Label tagReaderLabel = new Label(shell, SWT.NONE);
tagReaderLabel.setText("Tag Reader");
tagReaderLabel.setBounds(190, 23, 97, 23);
final Label tagReaderLabel_1 = new Label(shell, SWT.NONE);
tagReaderLabel_1.setBounds(190, 52, 97, 23);
tagReaderLabel_1.setText("Version 1.0");
final Label tagReaderLabel_1_1 = new Label(shell, SWT.NONE);
tagReaderLabel_1_1.setBounds(190, 81, 97, 23);
tagReaderLabel_1_1.setText("By SenseVision");
}
public static void main(String[] args) {
Display display = Display.getDefault();
Shell shell1 = new Shell(display, SWT.SHELL_TRIM);
VersionInfo aa = new VersionInfo(shell1, SWT.LEFT);
// aa.open("123");
// aa.createContents("123");
// shell1.layout();
// shell1.setSize(450, 450);
// shell1.open();
// shell1.setBounds(201, 91, 64, 64);
// final Combo combo = comboViewer.getCombo();
// combo.setBounds(317, 80, 129, 286);
// shell1.layout();
// while (!shell1.isDisposed()) {
// if (!display.readAndDispatch())
// display.sleep();
// }
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -