管理员页面Java代码 java管理员界面( 二 )


{
if(e.getKeyCode()==KeyEvent.VK_ENTER)
{
jb1.doClick();
}
}});
panel1.add(jLabel_name);
panel1.add(jTextField_name);
panel2.add(jLabel_password);
panel2.add(jPasswordField);
panel3.add(jb1);
panel3.add(jb2);
panel4.add(jLabel_title);
panel_all.setLayout(new GridLayout(4,1));
panel_all.add(panel4);
panel_all.add(panel1);
panel_all.add(panel2);
panel_all.add(panel3);
panel_all.setOpaque(false);
jf.setLayout(new BorderLayout());
jf.add(panel_all);
jb1.addMouseListener(new MouseAdapter(){
public void mouseClicked(MouseEvent me){
// if(lc.validate(jTextField_name.getText().trim(),new String(jPasswordField.getPassword()).trim())){
//doLogin();
//new MainFrame();
//}
//else
//JOptionPane.showMessageDialog(null, "Password doesn't match account,please try again!");
}
});
jb2.addMouseListener(new MouseAdapter(){
public void mouseClicked(MouseEvent me){
System.exit(0);
}
});
jf.setVisible(true);
jf.repaint();
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
/* public void doLogin(){
cid=jTextField_name.getText().trim();
passwd=jPasswordField.getText().trim();
String sql = "select *from customer where "+"cid='"+cid+"' and password='"+passwd+"'";
if (DB.connectDB()) {
if (DB.query(sql)){
System.out.print("登陆成功");
jf.dispose();
new MainFrame(cid);
return;
} else {
System.out.print("登陆失败");
return;
}
}
}
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
new Login();
}
}
图书系统对象数组java代码管理员登录代码怎么写?首先 , 对象数组:
人类:
public class Person {
//定义Person类的属性
public int age;
public String name;
//构造方法
public Person(int age,String name){
this.age = age;
this.name = name;
}
}
测试类:
public class Test {
public static void main(String[] args) {
//实例化一个对象数组
Person[] p = new Person[3]; //{new Person(23,"孙港"),new Person(24,"王悦"),new Person(25,"王芳")}
p[0] = new Person(32,"sg");
p[1] = new Person(24,"王悦");
p[2] = new Person(25,"王芳");
//循环输出对象数组
for(int i = 0;ip.length;i++){
System.out.println("age属性是:"+p[i].age+",name属性是:"+p[i].name);
}
}
}
只是把传入的参数变成了传数组 。希望可以帮到你!
登录界面的java代码,分别有教师登录,管理员登录,学生登录 , 右边是用户名和密码,见图 。分三个包,自己建个包 , 导进去就ok了,数据库是access的 。
package 登录;
import java.awt.EventQueue;
public class Cilent {
private JFrame frame;
private JTextField textField;
private JPasswordField passwordField;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Cilent window = new Cilent();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Cilent() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setTitle("登陆界面");
frame.setBounds(100, 100, 450, 300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(null);

推荐阅读