java swt 数据库写的信息管理系统

①登录界面

package xitong;

import org.eclipse.swt.widgets.Display;


public class login {
protected Shell shell;
private Text text;
private Text text_2;


/**
* Launch the application.
* @param args
*/
public static void main(String[] args) {
try {
login window = new login();
window.open();
} catch (Exception e) {
e.printStackTrace();
}
}


/**
* Open the window.
*/
public void open() {
Display display = Display.getDefault();
createContents();
shell.open();
shell.layout();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
}


/**
* Create contents of the window.
*/
protected void createContents() {
shell = new Shell();
Device display = null;
Image image=new Image(display,"H://sublime工作区/pictures/gz.jpg");
shell.setBackgroundImage(image);
shell.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_NORMAL_SHADOW));
shell.setSize(450, 300);
shell.setText("登录界面");
shell.setBackgroundMode(SWT.INHERIT_DEFAULT);

text = new Text(shell, SWT.BORDER);
text.setBounds(164, 85, 73, 26);

text_2 = new Text(shell, SWT.BORDER);
text_2.setEchoChar('*');
text_2.setBounds(164, 156, 73, 26);

Label label = new Label(shell, SWT.NONE);
label.setBounds(82, 88, 76, 20);
label.setText("\u7528\u6237\u540D");

Label label_2 = new Label(shell, SWT.NONE);
label_2.setBounds(82, 162, 76, 20);
label_2.setText("\u5BC6\u7801");

Button button = new Button(shell, SWT.NONE);
button.addMouseListener(new MouseAdapter() {
@Override
public void mouseDown(MouseEvent e) {
    if(text.getText().equals("lct")&&text_2.getText().equals("123")){
    shell.dispose();
    mainscreen window = new mainscreen();
    window.open();
    }
    else{
      MessageBox box=new MessageBox(shell,0); 
          box.setMessage("输入信息无效"); 
          box.open(); 
    }
}
});
button.setBounds(150, 199, 98, 30);
button.setText("\u767B\u5F55");

Label label_3 = new Label(shell, SWT.NONE);
label_3.setBackground(SWTResourceManager.getColor(SWT.COLOR_TITLE_BACKGROUND_GRADIENT));
label_3.setFont(SWTResourceManager.getFont("楷体", 16, SWT.BOLD));
label_3.setBounds(82, 0, 186, 41);
label_3.setText("\u5458\u5DE5\u7BA1\u7406\u7CFB\u7EDF");



}

}

②主界面

package xitong;


import java.sql.Connection;


public class mainscreen {
protected Shell shell,xianshishell,shell1;
protected Table table;
private Text text;
private Text text_1;
private Text text_2;
private Text text_3;
private Text text_4;
private Text text_5;


/**
* Launch the application.
* @param args
*/


/**
* Open the window.
* @wbp.parser.entryPoint
*/
public void open() {
Display display = Display.getDefault();
createContents();
shell.open();
shell.layout();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
}


/**
* Create contents of the window.
*/
protected void createContents() {
shell = new Shell();
shell.setSize(450, 370);
shell.setText("主界面");
xianshishell=new Shell();
xianshishell.setSize(450, 300);
xianshishell.setText("显示界面");
Device display = null;
Image image=new Image(display,"H://sublime工作区/pictures/fj.jpg");
shell.setBackgroundImage(image);

table = new Table(xianshishell, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI);
table.setBounds(0, 0, 465, 253);
table.setHeaderVisible(true);
table.setLinesVisible(true);
Button button_2 = new Button(shell, SWT.NONE);
button_2.setBounds(10, 0, 66, 43);
button_2.setText("\u5F55\u5165");

Button button_3 = new Button(shell, SWT.NONE);
button_3.setBounds(116, 3, 66, 37);
button_3.setText("\u67E5\u8BE2");

Button button_4 = new Button(shell, SWT.NONE);
button_4.setBounds(221, 3, 74, 37);
button_4.setText("\u4FEE\u6539");

Button button_5 = new Button(shell, SWT.NONE);
button_5.setBounds(358, 0, 74, 43);
button_5.setText("\u5220\u9664");

Label label = new Label(shell, SWT.NONE);
label.setText("\u59D3\u540D");
label.setBounds(72, 49, 35, 20);

text = new Text(shell, SWT.BORDER);
text.setBounds(168, 46, 74, 26);

Label label_1 = new Label(shell, SWT.NONE);
label_1.setText("\u7535\u8BDD");
label_1.setBounds(72, 86, 35, 20);

text_1 = new Text(shell, SWT.BORDER);
text_1.setBounds(168, 78, 73, 26);

Label label_2 = new Label(shell, SWT.NONE);
label_2.setText("\u6027\u522B");
label_2.setBounds(72, 129, 35, 20);

Label label_3 = new Label(shell, SWT.NONE);
label_3.setText("\u90E8\u95E8");
label_3.setBounds(72, 167, 35, 20);

Label label_4 = new Label(shell, SWT.NONE);
label_4.setText("\u5DE5\u8D44");
label_4.setBounds(72, 217, 35, 20);

Label label_5 = new Label(shell, SWT.NONE);
label_5.setText("\u51FA\u751F");
label_5.setBounds(72, 262, 35, 20);


text_2 = new Text(shell, SWT.BORDER);
text_2.setBounds(168, 129, 73, 26);

text_3 = new Text(shell, SWT.BORDER);
text_3.setBounds(168, 167, 73, 26);

text_4 = new Text(shell, SWT.BORDER);
text_4.setBounds(168, 211, 73, 26);

text_5 = new Text(shell, SWT.BORDER);
text_5.setBounds(168, 256, 73, 26);

Button button = new Button(shell, SWT.NONE);
button.setBounds(168, 288, 58, 25);
button.setText("\u663E\u793A");

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值