自己做得简单的登录框
来源:互联网 发布:mysql基本命令 编辑:程序博客网 时间:2024/05/22 00:28
package com.chinasoft.java.am;
import java.awt.BorderLayout;
public class denglu extends JFrame {
private JPanel contentPane;
private JPasswordField passwordField_1;
private JTextField textField;
private JLabel label;
private JLabel label_1;
private JRadioButton radioButton;
private JRadioButton radioButton_1;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
denglu frame = new denglu();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public denglu() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//登录整个页面的大小布局
setBounds(100, 100, 450, 300);
contentPane = new JPanel();
contentPane.setToolTipText("\u91CD\u7F6E");
contentPane.setBackground(new Color(51, 153, 204));
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
JButton btnNewButton = new JButton("\u767B\u5F55");//登录按钮
btnNewButton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
if(passwordField_1.getText().equals("a7144772"))
{
new shouyin().setVisible(true);
}else
{
JOptionPane.showMessageDialog(null, "错误", "alert", JOptionPane.ERROR_MESSAGE);
}
//textField.getText();
}
});
btnNewButton.setBounds(278, 158, 70, 33);
JButton button = new JButton("\u91CD\u7F6E");//重置按钮
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
new denglu().setVisible(true);
}
});
button.setBounds(91, 158, 70, 33);
passwordField_1 = new JPasswordField();//密码框
passwordField_1.setBounds(137, 99, 140, 21);//密码框的大小
contentPane.setLayout(null);
contentPane.add(button);
contentPane.add(btnNewButton);
contentPane.add(passwordField_1);
textField = new JTextField();//登录名
textField.setText("售货员");//登录框输入的内容
textField.setBounds(137, 58, 140, 21);//登录名大小
contentPane.add(textField);
textField.setColumns(10);
label = new JLabel("\u767B\u5F55\uFF1A");//登录的字
label.setForeground(Color.ORANGE);
label.setFont(new Font("宋体", Font.PLAIN, 15));
label.setBounds(77, 52, 50, 33);
contentPane.add(label);
label_1 = new JLabel("\u5BC6\u7801\uFF1A");//密码的字
label_1.setForeground(Color.ORANGE);
label_1.setFont(new Font("宋体", Font.PLAIN, 15));
label_1.setBounds(77, 93, 50, 33);
contentPane.add(label_1);
radioButton = new JRadioButton("\u8BB0\u4F4F\u8D26\u6237");
radioButton.setBounds(305, 57, 79, 23);
contentPane.add(radioButton);
radioButton_1 = new JRadioButton("\u8BB0\u4F4F\u5BC6\u7801");
radioButton_1.setBounds(305, 98, 79, 23);
contentPane.add(radioButton_1);
}
}
import java.awt.BorderLayout;
public class denglu extends JFrame {
private JPanel contentPane;
private JPasswordField passwordField_1;
private JTextField textField;
private JLabel label;
private JLabel label_1;
private JRadioButton radioButton;
private JRadioButton radioButton_1;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
denglu frame = new denglu();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public denglu() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//登录整个页面的大小布局
setBounds(100, 100, 450, 300);
contentPane = new JPanel();
contentPane.setToolTipText("\u91CD\u7F6E");
contentPane.setBackground(new Color(51, 153, 204));
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
JButton btnNewButton = new JButton("\u767B\u5F55");//登录按钮
btnNewButton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
if(passwordField_1.getText().equals("a7144772"))
{
new shouyin().setVisible(true);
}else
{
JOptionPane.showMessageDialog(null, "错误", "alert", JOptionPane.ERROR_MESSAGE);
}
//textField.getText();
}
});
btnNewButton.setBounds(278, 158, 70, 33);
JButton button = new JButton("\u91CD\u7F6E");//重置按钮
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
new denglu().setVisible(true);
}
});
button.setBounds(91, 158, 70, 33);
passwordField_1 = new JPasswordField();//密码框
passwordField_1.setBounds(137, 99, 140, 21);//密码框的大小
contentPane.setLayout(null);
contentPane.add(button);
contentPane.add(btnNewButton);
contentPane.add(passwordField_1);
textField = new JTextField();//登录名
textField.setText("售货员");//登录框输入的内容
textField.setBounds(137, 58, 140, 21);//登录名大小
contentPane.add(textField);
textField.setColumns(10);
label = new JLabel("\u767B\u5F55\uFF1A");//登录的字
label.setForeground(Color.ORANGE);
label.setFont(new Font("宋体", Font.PLAIN, 15));
label.setBounds(77, 52, 50, 33);
contentPane.add(label);
label_1 = new JLabel("\u5BC6\u7801\uFF1A");//密码的字
label_1.setForeground(Color.ORANGE);
label_1.setFont(new Font("宋体", Font.PLAIN, 15));
label_1.setBounds(77, 93, 50, 33);
contentPane.add(label_1);
radioButton = new JRadioButton("\u8BB0\u4F4F\u8D26\u6237");
radioButton.setBounds(305, 57, 79, 23);
contentPane.add(radioButton);
radioButton_1 = new JRadioButton("\u8BB0\u4F4F\u5BC6\u7801");
radioButton_1.setBounds(305, 98, 79, 23);
contentPane.add(radioButton_1);
}
}
阅读全文
0 0
- 自己做得简单的登录框
- 自己写的一个简单得shell得菜单
- 让自己做得更好的几句格言
- 做简单的自己,做最好的自己
- 把简单的做得完美,才是真的了不起
- 自己做的一个简单的记事本
- 自己做的最简单的轮播图
- 自己写得C++简单的四则运算小程序
- 自己做的几个Slide简单效果
- 自己做的简单记事本APP
- 自己做的简单选项卡
- jquery做得ajax异步登录
- 期待自己做得越好
- Swing第三刀:做套ERP,要配得上我的登录界面!
- 做更好的自己:不值得你去做的30件事
- 如何做一个及格的养得活自己的程序员
- 简历模版(抛砖引玉)-总觉得自己简历做得不够好的朋友请进来
- 学习oracle 必须得开个博客来做自己的老师。
- day_03_出错处理和环境变量
- laravel上线时,需要做的事
- MyBatis知识七ResultMap描述
- 四面楚歌
- 模式与数据库、数据库中的表的关系:
- 自己做得简单的登录框
- 索引的适用条件
- (续)Windows下配置Apache2_4 & php7.1.7
- HDU 4799 LIKE vs CANDLE 【树形dp】【阅读题】【水题】
- Unicode和中文互转
- 字典序全排列
- ios单例的实现
- Java——IO流的学习【一】 之 File类
- C语言:freopen函数