编写Java Application,建立一个登录窗口,包含输入用户名和口令的文本框以及登录和取消两个按钮

来源:百度知道 编辑:UC知道 时间:2024/05/26 00:53:36
快下课了。。。。。。。。帮帮忙

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;

public class LogOn extends JFrame
{
private JLabel usernameLabel, passwordLabel;
private JTextField usernameText;
private JPasswordField passwordText;
private JButton cancelButton,confButton;

public LogOn ()
{
super("CF Product");
setSize(400,200);
try
{
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

}catch(Exception e) {}
Container container = getContentPane();
container.setBackground(Color.WHITE);
container.setLayout(null);
usernameLabel = new JLabel("用户名:",JLabel.RIGHT);
passwordLabel = new JLabel("密 码:",JLabel.RIGHT);
usernameText = new JTextField(10);
passwordText = new JPasswordField(10);
cancelButton = new JButton(" 退出");
confButton = new JButton("确定");

userna