import javaawt;
import javaawtevent;
import javaxswing;
public class Test_Login extends javaxswingJFrame {
private JPanel jPanel1;
private JButton bntLogin;
private JButton bntCannel;
private JPasswordField pwd;
private JTextField username;
private JLabel jLabel2;
private JLabel jLabel1;
public static void main(String[] args) {
Test_Login inst = new Test_Login();
instsetLocationRelativeTo(null);
instsetVisible(true);
}
public Test_Login() {
super();
initGUI();
}
private void initGUI() {
try {
setDefaultCloseOperation(WindowConstantsDISPOSE_ON_CLOSE);
{
jPanel1 = new JPanel();
getContentPane()add(jPanel1, BorderLayoutCENTER);
jPanel1setLayout(null);
{
jLabel1 = new JLabel();
jPanel1add(jLabel1);
jLabel1setText("用户名");
jLabel1setBounds(45, 30, 75, 25);
}
{
jLabel2 = new JLabel();
jPanel1add(jLabel2);
jLabel2setText("密码");
jLabel2setBounds(45, 75, 55, 15);
}
{
username = new JTextField();
jPanel1add(username);
usernamesetBounds(100, 30, 140, 25);
}
{
pwd = new JPasswordField();
jPanel1add(pwd);
pwdsetBounds(100, 70, 140, 25);
}
{
bntLogin = new JButton();
jPanel1add(bntLogin);
bntLoginsetText("登陆");
bntLoginsetBounds(40, 120, 60, 30);
bntLoginaddMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
if (usernamegetText()equals("lisong")
&& pwdgetText()equals("lisong")) {
JOptionPaneshowMessageDialog(Test_Loginthis,
"登录成功");
} else {
JOptionPaneshowMessageDialog(Test_Loginthis,
"登录失败");
}
}
});
bntCannel = new JButton();
jPanel1add(bntCannel);
bntCannelsetText("取消");
bntCannelsetBounds(180, 120, 60, 30);
bntCanneladdMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
Systemexit(0);
}
});
}
}
pack();
setSize(300, 215);
} catch (Exception e) {
eprintStackTrace();
}
}
}
以上就是关于问问企业Java开发者,java语言的各种界面编程组件:swing、awt、swt、jsf、jface都用哪种比较多,如果有高全部的内容,包括:问问企业Java开发者,java语言的各种界面编程组件:swing、awt、swt、jsf、jface都用哪种比较多,如果有高、Java程序设计的开发工具有些什么、向Web开发进军 Eclipse发展浅析等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)