📄 b.java
字号:
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import com.swtdesigner.SWTResourceManager;
public class B extends Shell {
/**
* Launch the application
* @param args
*/
public static void main(String args[]) {
try {
Display display = Display.getDefault();
B shell = new B(display, SWT.SHELL_TRIM);
shell.open();
shell.layout();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* Create the shell
* @param display
* @param style
*/
public B(Display display, int style) {
super(display, style);
createContents();
}
/**
* Create contents of the window
*/
protected void createContents() {
setText("SWT Application");
setSize(500, 375);
final Label label = new Label(this, SWT.NONE);
label.setForeground(SWTResourceManager.getColor(255, 0, 0));
label.setFont(SWTResourceManager.getFont("", 26, SWT.NONE));
label.setAlignment(SWT.CENTER);
label.setText("用户信息储存系统");
label.setBounds(70, 85, 325, 52);
final Button button = new Button(this, SWT.NONE);
button.setText("编辑用户信息");
button.setBounds(284, 218, 133, 33);
final Button button_1 = new Button(this, SWT.NONE);
button_1.setText("退出");
button_1.setBounds(284, 286, 133, 33);
//
}
@Override
protected void checkSubclass() {
// Disable the check that prevents subclassing of SWT components
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -