📄 logoclass.java~13~
字号:
package managersystem.user;
import java.awt.*;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.*;
import managersystem.MainFrm;
import managersystem.user.*;
import javax.swing.border.TitledBorder;
/**
* <p>Title: 企业人力资源管理系统</p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2008</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class LogoClass
extends JDialog {
JPanel panel1 = new JPanel();
JLabel lblUserName = new JLabel();
JLabel lblUserpwd = new JLabel();
JComboBox cobUserName = new JComboBox();
JButton btnOK = new JButton();
JButton btnEsc = new JButton();
JPasswordField txtUserpwd = new JPasswordField();
JLabel lblLoge = new JLabel();
TitledBorder titledBorder1 = new TitledBorder("");
JLabel jLabel1 = new JLabel();
public LogoClass(Frame owner, String title, boolean modal) {
super(owner, title, modal);
try {
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
jbInit();
pack();
}
catch (Exception exception) {
exception.printStackTrace();
}
}
public LogoClass() {
this(new Frame(), "LogoClass", false);
}
private void jbInit() throws Exception {
panel1.setLayout(null);
lblUserName.setFont(new java.awt.Font("Dialog", Font.BOLD, 18));
lblUserName.setText("用户名:");
lblUserName.setBounds(new Rectangle(123, 139, 66, 20));
lblUserpwd.setFont(new java.awt.Font("Dialog", Font.BOLD, 18));
lblUserpwd.setToolTipText("");
lblUserpwd.setText("密 码:");
lblUserpwd.setBounds(new Rectangle(124, 171, 67, 20));
cobUserName.setBounds(new Rectangle(213, 136, 84, 24));
btnOK.setBounds(new Rectangle(123, 209, 71, 25));
btnOK.setFont(new java.awt.Font("Dialog", Font.BOLD, 18));
btnOK.setBorder(titledBorder1);
btnOK.setText("");
btnOK.addActionListener(new LogoClass_btnOK_actionAdapter(this));
btnOK.setIcon(new ImageIcon("image/loginbtnico.gif"));
btnEsc.setBounds(new Rectangle(224, 209, 71, 25));
btnEsc.setFont(new java.awt.Font("Dialog", Font.BOLD, 18));
btnEsc.setBorder(titledBorder1);
btnEsc.setText("");
btnEsc.addActionListener(new LogoClass_btnEsc_actionAdapter(this));
btnEsc.setIcon(new ImageIcon("image/qxbtnico.gif"));
panel1.setPreferredSize(new Dimension(350, 250));
txtUserpwd.setText("");
txtUserpwd.setBounds(new Rectangle(213, 168, 84, 27));
lblLoge.setText("");
lblLoge.setBounds(new Rectangle(0, 0, 400, 112));
jLabel1.setBounds(new Rectangle(27, 141, 80, 80));
jLabel1.setIcon(new ImageIcon("image/loginico.gif"));
getContentPane().add(panel1);
panel1.add(lblLoge);
panel1.add(txtUserpwd);
panel1.add(jLabel1);
panel1.add(lblUserName);
panel1.add(cobUserName);
panel1.add(btnOK);
panel1.add(btnEsc);
panel1.add(lblUserpwd);
this.setUndecorated(true);
DBoperate objD = new DBoperate();
ArrayList array =objD.ArrayName();
for(int i=0;i<array.size();i++){
cobUserName.addItem(array.get(i));
}
lblLoge.setIcon(new ImageIcon("image/Logo1.jpg"));
}
public void btnOK_actionPerformed(ActionEvent e) {
MainFrm frame1 = new MainFrm();
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Dimension frameSize = frame1.getSize();
if (frameSize.height > screenSize.height) {
frameSize.height = screenSize.height;
}
if (frameSize.width > screenSize.width) {
frameSize.width = screenSize.width;
}
frame1.setLocation( (screenSize.width - frameSize.width) / 2,
(screenSize.height - frameSize.height) / 2);
String name = String.valueOf(cobUserName.getItemAt(cobUserName.getSelectedIndex()));
String pwd = String.valueOf(txtUserpwd.getPassword());
Users objU = new Users();
objU.setUserName(name);
objU.setPwd(pwd);
DBoperate objD = new DBoperate();
if(objD.getUserAndpwd(objU)){
frame1.setVisible(true);
this.dispose();
}else{
JOptionPane.showMessageDialog(this,"请输入正确的用户和密码","alert",JOptionPane.CLOSED_OPTION);
}
}
public void btnEsc_actionPerformed(ActionEvent e) {
System.exit(0);
}
}
class LogoClass_btnEsc_actionAdapter
implements ActionListener {
private LogoClass adaptee;
LogoClass_btnEsc_actionAdapter(LogoClass adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.btnEsc_actionPerformed(e);
}
}
class LogoClass_btnOK_actionAdapter
implements ActionListener {
private LogoClass adaptee;
LogoClass_btnOK_actionAdapter(LogoClass adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.btnOK_actionPerformed(e);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -