java完成系统登录程序package com.hg;
import java.util.Scanner;
public class Test {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int failCount = 0;
String userName = "";
String pwd = "";
while(true){
while(true){
System.out.print("请输入用户名java系统登录程序代码:");
scanner = new Scanner(System.in);
userName = scanner.nextLine();
if(!"".equals(userName)){
break;
}
}
while(true){
System.out.print("请输入密码java系统登录程序代码:");
scanner = new Scanner(System.in);
pwd = scanner.nextLine();
if(!"".equals(pwd)){
break;
}
}
if("mldn".endsWith(userName)"hello".endsWith(pwd)){
System.out.println("登录成功java系统登录程序代码!");
break;
}else{
【java系统登录程序代码 java实现登录功能怎么做】System.out.println("用户名或密码错误java系统登录程序代码!");
failCount++;
}
if(failCount = 3){
System.out.println("您已经连续3次输入错误 。系统退出 。");
break;
}
}
}
}
用Java编写注册登录程序什么都不说了 直接给你代码吧
package com.moliying.ui;
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.List;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.BufferedWriter;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.Arrays;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
public class Login {
private JFrame frame = new JFrame("登录");
private Container c = frame.getContentPane();
private JTextField username = new JTextField();
private JPasswordField password = new JPasswordField();
private JButton ok = new JButton("确定");
private JButton cancel = new JButton("取消");
public Login() {
frame.setSize(300, 200);
frame.setBounds(450, 300, 300, 200);
c.setLayout(new BorderLayout());
initFrame();
frame.setVisible(true);
}
private void initFrame() {
// 顶部
JPanel titlePanel = new JPanel();
titlePanel.setLayout(new FlowLayout());
titlePanel.add(new JLabel("系统管理员登录"));
c.add(titlePanel, "North");
// 中部表单
JPanel fieldPanel = new JPanel();
fieldPanel.setLayout(null);
JLabel a1 = new JLabel("用户名:");
a1.setBounds(50, 20, 50, 20);
JLabel a2 = new JLabel("密码:");
a2.setBounds(50, 60, 50, 20);
fieldPanel.add(a1);
fieldPanel.add(a2);
username.setBounds(110, 20, 120, 20);
password.setBounds(110, 60, 120, 20);
fieldPanel.add(username);
fieldPanel.add(password);
c.add(fieldPanel, "Center");
// 底部按钮
JPanel buttonPanel = new JPanel();
buttonPanel.setLayout(new FlowLayout());
buttonPanel.add(ok);
buttonPanel.add(cancel);
c.add(buttonPanel, "South");
ok.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
System.out.println(username.getText().toString());
}
});
cancel.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
frame.setVisible(false);
}
});
}
public static void main(String[] args) {
//new Login();
String ss = "abbabbbaabbbccba";
System.out.println(ss.split("b").length);
}
}
登陆界面的java代码怎么写?概述
推荐阅读
- 女人适合用什么电视墙壁画,女人适合用什么电视墙壁画呢
- linux替换字符命令,linux切换字符界面的命令
- 电子竞技打游戏有用吗贴吧,玩电子竞技
- 三星手机怎么自动充电视频,三星自动充电器怎么用
- python查找函数帮助 python查找函数用法
- 电信机顶盒怎么连接路由器,电信机顶盒怎么连接路由器看电视直播
- html5怎么让div并排,html将div并列排
- c语言int函数精度 c语言中int函数的用法
- 安卓连苹果手机蓝牙耳机,安卓使用苹果蓝牙耳机