小组作业进度(只做了大概还未加内容)


package zuoye;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Window;
import java.awt.event.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.*;

public class Game {

protected static final Component dlg = null;

public static void main(String[] args) {
// TODO Auto-generated method stub
JFrame frm = new JFrame("游戏助手");
frm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frm.setLayout(null);

final JDialog dlg = new JDialog(frm, "游戏小助手");
dlg.setBounds(445, 220, 200, 150);
dlg.setLayout(null);
dlg.setModal(true);

JLabel userLabel = new JLabel(" 用 户: ");
userLabel.setBounds(40, 20, 80, 30);
JLabel userLabel1 = new JLabel();
userLabel1.setText(" 密 码:");
userLabel1.setBounds(40, 50, 80, 30);

JTextField userText = new JTextField();
userText.setEditable(true);
userText.setHorizontalAlignment(SwingConstants.LEFT);
userText.setColumns(20);
userText.setBounds(110, 20, 120, 30);

JButton obtn = new JButton("登陆");
obtn.setBounds(60, 100, 60, 30);
obtn.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
dlg.setVisible(true);
}
});
frm.add(obtn);


JButton btn = new JButton("选择");
btn.setBounds(50, 50, 100, 30);
btn.addActionListener(new ActionListener(){

@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
dlg.setVisible(false);
}
});
dlg.add(btn);

final JDialog dlg1 = new JDialog(frm, "欢迎注册");
dlg1.setBounds(450, 220, 200, 150);
dlg1.setLayout(null);
dlg1.setModal(true);
JTextField userText1 = new JTextField();
userText1.setEditable(true);
userText1.setHorizontalAlignment(SwingConstants.LEFT);
userText1.setColumns(20);
userText1.setBounds(110, 50, 120, 30);
JButton obtn1 = new JButton("注册");
obtn1.setBounds(160, 100, 60, 30);
obtn1.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
dlg1.setVisible(true);
}
});
frm.add(obtn1);

JButton btn1 = new JButton("游戏");
btn1.setBounds(50, 50, 100, 30);
btn1.addActionListener(new ActionListener(){

@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
dlg1.setVisible(false);
}
});
dlg1.add(btn1);

frm.add(userLabel);
frm.add(userText);
frm.add(userLabel1);
frm.add(userText1);

frm.setBounds(400, 200, 300, 200);
frm.setVisible(true);

}

}

posted @ 2016-05-28 18:32  健忘的大福  阅读(118)  评论(0编辑  收藏  举报