展开全部
应用的还是62616964757a686964616fe58685e5aeb931333262383535web的啊..
我给你写了个应用的哈
你在C盘建个test.txt文件
里面写
username:用户名(这里可以随便写哈)
password:同上哈
注意是要换行的哦。。
比如
username:tiger
password:tiger
然后你建个Login的类
然后把下面的代码弄进去
运行就是了
注意登陆的时候你文件里面设定的什么用户名和密码就输入什么哈
输入错误就会提示输入错误的
import java.io.BufferedReader;
import java.io.FileReader;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
/**
*
* @author thinkpad
*/
public class Login extends javax.swing.JFrame {
/** Creates new form Login */
private static String username;
private static String password;
public Login() {
initComponents();
try {
BufferedReader br = new BufferedReader(new FileReader("C:\\test.txt"));
username = br.readLine().split("\\:")[1];
password = br.readLine().split("\\:")[1];
System.out.println(username + password);
} catch(Exception e) {
e.printStackTrace();
}
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
//
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jTextField1