import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Logon //implements ActionListener
{
public Logon()
{
JFrame f=new JFrame("登陆界面");//建立一个标题为"登陆界面"的窗体
Container contentPane=f.getContentPane();//建立一个虚拟容器Container对象
Icon icon=new ImageIcon("logo.jpg");
JLabel ic=new JLabel(icon);
JLabel jlb1=new JLabel("用户名:");
JTextField txt1=new JTextField(15);
JLabel jlb2=new JLabel("密码:");
JTextField txt2=new JTextField(15);
JButton b1=new JButton("登陆");
JButton b2=new JButton("取消");
contentPane.setLayout(new FlowLayout());
contentPane.add(ic);
contentPane.add(jlb1);
contentPane.add(txt1);
contentPane.add(jlb2);
contentPane.add(txt2);
contentPane.add(b1);
contentPane.add(b2);
f.setSize(500,300);
f.validate();
f.show();
f.setVisible(true);
}
public static void main(String args[])
{
new Logon();
}
}