门禁系统设计(Java)帮忙测试一下~~~

Scofield_zao 2009-06-04 10:34:47
package accesscontrolsystem;
// Enable user to enter security codes specifying access privileges.
import java.awt.*;
import java.awt.event.*;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.swing.*;

class AccessControlSystem extends JFrame
{
private JLabel AccessControlSystemJLabel;
private JPasswordField AccessControlSystemJPasswordField;
public String str_password=new String();
private JButton oneJButton;
private JButton twoJButton;
private JButton threeJButton;
private JButton fourJButton;
private JButton fiveJButton;
private JButton sixJButton;
private JButton sevenJButton;
private JButton eightJButton;
private JButton nineJButton;
private JButton zeroJButton;
private JButton QqJButton;
private JButton WwJButton;
private JButton EeJButton;
private JButton RrJButton;
private JButton TtJButton;
private JButton YyJButton;
private JButton UuJButton;
private JButton IiJButton;
private JButton OoJButton;
private JButton PpJButton;
private JButton AaJButton;
private JButton SsJButton;
private JButton DdJButton;
private JButton FfJButton;
private JButton GgJButton;
private JButton HhJButton;
private JButton JjJButton;
private JButton KkJButton;
private JButton LlJButton;
private JButton ZzJButton;
private JButton XxJButton;
private JButton CcJButton;
private JButton VvJButton;
private JButton BbJButton;
private JButton NnJButton;
private JButton MmJButton;
private JButton clearJButton;
private JButton enterJButton;
private JLabel accessLogJLabel;
private JTextArea accessLogJTextArea;
private JScrollPane accessLogJScrollPane;
public AccessControlSystem()
{
createUserInterface();
}

private void createUserInterface()
{
Container contentPane = getContentPane();
contentPane.setLayout( null );
AccessControlSystemJLabel = new JLabel();
AccessControlSystemJLabel.setBounds( 50, 25, 100,50);

AccessControlSystemJLabel.setText( "PASSWORD:" );
contentPane.add( AccessControlSystemJLabel );
//密码输入文本设置
AccessControlSystemJPasswordField = new JPasswordField();
Font f=new Font("Time New Roman",Font.BOLD,45);
AccessControlSystemJPasswordField.setFont(f);
AccessControlSystemJPasswordField.setBounds(150,25,350,50);
AccessControlSystemJPasswordField.setEditable(false);
contentPane.add(AccessControlSystemJPasswordField );

oneJButton = new JButton();
oneJButton.setBounds( 50, 100, 50, 50 );
oneJButton.setText( "1" );
contentPane.add( oneJButton );
oneJButton.addActionListener(
new ActionListener()
{
public void actionPerformed( ActionEvent event )
{
oneJButtonActionPerformed( event );
}
});
twoJButton = new JButton();
twoJButton.setBounds( 100, 100, 50, 50 );
twoJButton.setText( "2" );
contentPane.add( twoJButton );
twoJButton.addActionListener(
new ActionListener()
{
public void actionPerformed( ActionEvent event )
{
twoJButtonActionPerformed( event );
}
} );
threeJButton = new JButton();
threeJButton.setBounds( 150,100, 50, 50 );
threeJButton.setText( "3" );
contentPane.add( threeJButton );
threeJButton.addActionListener(

new ActionListener()
{
public void actionPerformed( ActionEvent event )
{
threeJButtonActionPerformed( event );
}
} );
fourJButton = new JButton();
fourJButton.setBounds( 200, 100, 50, 50 );
fourJButton.setText( "4" );
contentPane.add( fourJButton );
fourJButton.addActionListener(
new ActionListener()
{
public void actionPerformed( ActionEvent event )
{
fourJButtonActionPerformed( event );
}
} );
fiveJButton = new JButton();
fiveJButton.setBounds( 250, 100, 50, 50 );
fiveJButton.setText( "5" );
contentPane.add( fiveJButton );
fiveJButton.addActionListener(
new ActionListener()
{
public void actionPerformed( ActionEvent event )
{
fiveJButtonActionPerformed( event );
}
});
sixJButton = new JButton();
sixJButton.setBounds( 300, 100, 50, 50 );
sixJButton.setText( "6" );
contentPane.add( sixJButton );
sixJButton.addActionListener(
new ActionListener()
{
public void actionPerformed( ActionEvent event )
{
sixJButtonActionPerformed( event );
}
} );
sevenJButton = new JButton();
sevenJButton.setBounds(350, 100, 50, 50 );
sevenJButton.setText( "7" );
contentPane.add( sevenJButton );
sevenJButton.addActionListener(
new ActionListener()
{
public void actionPerformed( ActionEvent event )
{
sevenJButtonActionPerformed( event );
}
} );
eightJButton = new JButton();
eightJButton.setBounds( 400, 100, 50, 50 );
eightJButton.setText( "8" );
contentPane.add( eightJButton );
eightJButton.addActionListener(
new ActionListener()
{
public void actionPerformed( ActionEvent event )
{
eightJButtonActionPerformed( event );
}
} );
nineJButton = new JButton();
nineJButton.setBounds( 450, 100, 50, 50 );
nineJButton.setText( "9" );
contentPane.add( nineJButton );
nineJButton.addActionListener(
new ActionListener()
{
public void actionPerformed( ActionEvent event )
{
nineJButtonActionPerformed( event );
}
} );
zeroJButton = new JButton();
zeroJButton.setBounds( 500, 100, 50, 50 );
zeroJButton.setText( "0" );
contentPane.add( zeroJButton );
zeroJButton.addActionListener(
new ActionListener()
{
public void actionPerformed( ActionEvent event )
{
zeroJButtonActionPerformed( event );
}
} );
...全文
170 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
dai198879 2009-09-16
  • 打赏
  • 举报
回复
哥哥 你也忒强了嘛~~这个咋看呀~~还是顶了 慢慢研究哦
小宝z 2009-06-30
  • 打赏
  • 举报
回复
眼花缭乱啊。
读读代码正好练眼神了。呵呵
weifengqingxiao 2009-06-30
  • 打赏
  • 举报
回复
看过就要支持...
网络科技 2009-06-30
  • 打赏
  • 举报
回复
代码最好要说明下,只看代码就能马上理解你的用意,应该不多,高人除外.
reeves101 2009-06-27
  • 打赏
  • 举报
回复
代码没注释,想玩死你自己呀.
Scofield_zao 2009-06-04
  • 打赏
  • 举报
回复
     accessLogJLabel = new JLabel();
accessLogJLabel.setBounds( 50, 350, 80, 25 );
accessLogJLabel.setText( "ACCESS LOG:" );
contentPane.add( accessLogJLabel );
accessLogJTextArea = new JTextArea();
accessLogJScrollPane = new JScrollPane( accessLogJTextArea );
accessLogJScrollPane.setBounds( 50, 375, 500, 100 );
contentPane.add( accessLogJScrollPane );
setTitle( "AccseeControlSystem" ); // set window's title
setSize( 620, 535 );
// set window's size
setVisible( true ); // display window
} // end method createUserInterface

private void oneJButtonActionPerformed( ActionEvent event )
{
str_password=str_password+"1";
AccessControlSystemJPasswordField.setText(str_password);
}
private void twoJButtonActionPerformed( ActionEvent event )
{
str_password=str_password+"2";
AccessControlSystemJPasswordField.setText(str_password);
}
private void threeJButtonActionPerformed( ActionEvent event )
{
str_password=str_password+"3";
AccessControlSystemJPasswordField.setText(str_password);
}
private void fourJButtonActionPerformed( ActionEvent event )
{
str_password=str_password+"4";
AccessControlSystemJPasswordField.setText(str_password);
}
private void fiveJButtonActionPerformed( ActionEvent event )
{
str_password=str_password+"5";
AccessControlSystemJPasswordField.setText(str_password);
}
private void sixJButtonActionPerformed( ActionEvent event )
{
str_password=str_password+"6";
AccessControlSystemJPasswordField.setText(str_password);
}
private void sevenJButtonActionPerformed( ActionEvent event )
{
str_password=str_password+"7";
AccessControlSystemJPasswordField.setText(str_password);
}
private void eightJButtonActionPerformed( ActionEvent event )
{
str_password=str_password+"8";
AccessControlSystemJPasswordField.setText(str_password);
}
private void nineJButtonActionPerformed( ActionEvent event )
{
str_password=str_password+"9";
AccessControlSystemJPasswordField.setText(str_password);
}
private void QJButtonActionPerformed( ActionEvent event )
{
str_password=str_password+"Q";
AccessControlSystemJPasswordField.setText(str_password);
}
private void WJButtonActionPerformed( ActionEvent event )
{
str_password=str_password+"W";
AccessControlSystemJPasswordField.setText(str_password);
}
private void EJButtonActionPerformed( ActionEvent event )
{
str_password=str_password+"E";
AccessControlSystemJPasswordField.setText(str_password);
}
private void RJButtonActionPerformed( ActionEvent event )
{
str_password=str_password+"R";
AccessControlSystemJPasswordField.setText(str_password);
}
private void TJButtonActionPerformed( ActionEvent event )
{
str_password=str_password+"T";
AccessControlSystemJPasswordField.setText(str_password);
}
private void YJButtonActionPerformed( ActionEvent event )
{
str_password=str_password+"Y";
AccessControlSystemJPasswordField.setText(str_password);
}
private void UJButtonActionPerformed( ActionEvent event )
{
str_password=str_password+"U";
AccessControlSystemJPasswordField.setText(str_password);
}
private void IJButtonActionPerformed( ActionEvent event )
{
str_password=str_password+"I";
AccessControlSystemJPasswordField.setText(str_password);
}
private void OJButtonActionPerformed( ActionEvent event )
{
str_password=str_password+"O";
AccessControlSystemJPasswordField.setText(str_password);
}
private void PJButtonActionPerformed( ActionEvent event )
{
str_password=str_password+"P";
AccessControlSystemJPasswordField.setText(str_password);
}
private void AJButtonActionPerformed( ActionEvent event )
{
str_password=str_password+"A";
AccessControlSystemJPasswordField.setText(str_password);
}
private void SJButtonActionPerformed( ActionEvent event )
{
str_password=str_password+"S";
AccessControlSystemJPasswordField.setText(str_password);
}
private void DJButtonActionPerformed( ActionEvent event )
{
str_password=str_password+"D";
AccessControlSystemJPasswordField.setText(str_password);
}
private void FJButtonActionPerformed( ActionEvent event )
{
str_password=str_password+"F";
AccessControlSystemJPasswordField.setText(str_password);
}
private void GJButtonActionPerformed( ActionEvent event )
{
str_password=str_password+"G";
AccessControlSystemJPasswordField.setText(str_password);
}
private void HJButtonActionPerformed( ActionEvent event )
{
str_password=str_password+"H";
AccessControlSystemJPasswordField.setText(str_password);
}
private void JJButtonActionPerformed( ActionEvent event )
{
str_password=str_password+"J";
AccessControlSystemJPasswordField.setText(str_password);
}
private void KJButtonActionPerformed( ActionEvent event )
{
str_password=str_password+"K";
AccessControlSystemJPasswordField.setText(str_password);
}
private void LJButtonActionPerformed( ActionEvent event )
{

str_password=str_password+"L";
AccessControlSystemJPasswordField.setText(str_password);
}
private void ZJButtonActionPerformed( ActionEvent event )
{
str_password=str_password+"Z";
AccessControlSystemJPasswordField.setText(str_password);
}
private void XJButtonActionPerformed( ActionEvent event )
{
str_password=str_password+"X";
AccessControlSystemJPasswordField.setText(str_password);
}
private void CJButtonActionPerformed( ActionEvent event )
{
str_password=str_password+"C";
AccessControlSystemJPasswordField.setText(str_password);
}
private void VJButtonActionPerformed( ActionEvent event )
{
str_password=str_password+"V";
AccessControlSystemJPasswordField.setText(str_password);
}
private void BJButtonActionPerformed( ActionEvent event )
{
str_password=str_password+"B";
AccessControlSystemJPasswordField.setText(str_password);
}
private void NJButtonActionPerformed( ActionEvent event )
{
str_password=str_password+"N";
AccessControlSystemJPasswordField.setText(str_password);
}
private void MJButtonActionPerformed( ActionEvent event )
{
str_password=str_password+"";
AccessControlSystemJPasswordField.setText(str_password);
}
private void zeroJButtonActionPerformed( ActionEvent event )
{
str_password=str_password+"0";
AccessControlSystemJPasswordField.setText(str_password);
}
private void clearJButtonActionPerformed( ActionEvent event )
{
str_password="";
AccessControlSystemJPasswordField.setText(str_password);
accessLogJTextArea.setText("");
}
Scofield_zao 2009-06-04
  • 打赏
  • 举报
回复

KkJButton = new JButton();
KkJButton.setBounds( 125, 250, 50, 50 );
KkJButton.setText( "K" );
contentPane.add( KkJButton );
KkJButton.addActionListener(
new ActionListener()
{
public void actionPerformed( ActionEvent event )
{
KJButtonActionPerformed( event );
}
});
LlJButton = new JButton();
LlJButton.setBounds( 175, 250, 50, 50 );
LlJButton.setText( "L" );
contentPane.add( LlJButton );
LlJButton.addActionListener(
new ActionListener()
{
public void actionPerformed( ActionEvent event )
{
LJButtonActionPerformed( event );
}
});
ZzJButton = new JButton();
ZzJButton.setBounds( 225, 250, 50, 50 );
ZzJButton.setText( "Z" );
contentPane.add( ZzJButton );
ZzJButton.addActionListener(
new ActionListener()
{
public void actionPerformed( ActionEvent event )
{
ZJButtonActionPerformed( event );
}
});
XxJButton = new JButton();
XxJButton.setBounds( 275, 250, 50, 50 );
XxJButton.setText( "X" );
contentPane.add( XxJButton );
XxJButton.addActionListener(
new ActionListener()
{
public void actionPerformed( ActionEvent event )
{
XJButtonActionPerformed( event );
}
});
CcJButton = new JButton();
CcJButton.setBounds( 325, 250, 50, 50 );
CcJButton.setText( "C" );
contentPane.add( CcJButton );
CcJButton.addActionListener(
new ActionListener()
{
public void actionPerformed( ActionEvent event )
{
CJButtonActionPerformed( event );
}
});
VvJButton = new JButton();
VvJButton.setBounds( 375, 250, 50, 50 );
VvJButton.setText( "V" );
contentPane.add( VvJButton );
VvJButton.addActionListener(
new ActionListener()
{
public void actionPerformed( ActionEvent event )
{
VJButtonActionPerformed( event );
}
});
BbJButton = new JButton();
BbJButton.setBounds( 425, 250, 50, 50 );
BbJButton.setText( "B" );
contentPane.add( BbJButton );
BbJButton.addActionListener(
new ActionListener()
{
public void actionPerformed( ActionEvent event )
{
BJButtonActionPerformed( event );
}
});
NnJButton = new JButton();
NnJButton.setBounds( 200, 300, 50, 50 );
NnJButton.setText( "N" );
contentPane.add( NnJButton );
NnJButton.addActionListener(
new ActionListener()
{
public void actionPerformed( ActionEvent event )
{
NJButtonActionPerformed( event );
}
});
MmJButton = new JButton();
MmJButton.setBounds( 250, 300, 50, 50 );
MmJButton.setText( "M" );
contentPane.add( MmJButton );
MmJButton.addActionListener(
new ActionListener()
{
public void actionPerformed( ActionEvent event )
{
MJButtonActionPerformed( event );
}
});
// set up clearJButton
clearJButton = new JButton();
clearJButton.setBounds( 300, 300, 50, 50 );
clearJButton.setText( "CE" );
contentPane.add( clearJButton );
clearJButton.addActionListener(
new ActionListener()
{
public void actionPerformed( ActionEvent event )
{
clearJButtonActionPerformed( event );
}
} );
//**模仿其它按钮,建立enterJButton,显示为"#"
enterJButton = new JButton();
enterJButton.setBounds(350,300,50,50);
enterJButton.setText("#");
contentPane.add( enterJButton );
enterJButton.addActionListener(
new ActionListener()
{
public void actionPerformed( ActionEvent event )
{
enterJButtonActionPerformed( event );
}
} );
Scofield_zao 2009-06-04
  • 打赏
  • 举报
回复

QqJButton = new JButton();
QqJButton.setBounds( 75, 150, 50, 50 );
QqJButton.setText( "Q" );
contentPane.add( QqJButton );
QqJButton.addActionListener(
new ActionListener()
{
public void actionPerformed( ActionEvent event )
{
QJButtonActionPerformed( event );
}
});
WwJButton = new JButton();
WwJButton.setBounds( 125, 150, 50, 50 );
WwJButton.setText( "W" );
contentPane.add( WwJButton );
WwJButton.addActionListener(
new ActionListener()
{
public void actionPerformed( ActionEvent event )
{
WJButtonActionPerformed( event );
}
});
EeJButton = new JButton();
EeJButton.setBounds( 175, 150, 50, 50 );
EeJButton.setText( "E" );
contentPane.add( EeJButton );
EeJButton.addActionListener(
new ActionListener()
{
public void actionPerformed( ActionEvent event )
{
EJButtonActionPerformed( event );
}
});
RrJButton = new JButton();
RrJButton.setBounds( 225, 150, 50, 50 );
RrJButton.setText( "R" );
contentPane.add( RrJButton );
RrJButton.addActionListener(
new ActionListener()
{
public void actionPerformed( ActionEvent event )
{
RJButtonActionPerformed( event );
}
});
TtJButton = new JButton();
TtJButton.setBounds( 275, 150, 50, 50 );
TtJButton.setText( "T" );
contentPane.add( TtJButton );
TtJButton.addActionListener(
new ActionListener()
{
public void actionPerformed( ActionEvent event )
{
TJButtonActionPerformed( event );
}
});
YyJButton = new JButton();
YyJButton.setBounds( 325, 150, 50, 50 );
YyJButton.setText( "Y" );
contentPane.add( YyJButton );
YyJButton.addActionListener(
new ActionListener()
{
public void actionPerformed( ActionEvent event )
{
YJButtonActionPerformed( event );
}
});
UuJButton = new JButton();
UuJButton.setBounds( 375, 150, 50, 50 );
UuJButton.setText( "U" );
contentPane.add( UuJButton );
UuJButton.addActionListener(
new ActionListener()
{
public void actionPerformed( ActionEvent event )
{
UJButtonActionPerformed( event );
}
});
IiJButton = new JButton();
IiJButton.setBounds( 425, 150, 50, 50 );
IiJButton.setText( "I" );
contentPane.add( IiJButton );
IiJButton.addActionListener(
new ActionListener()
{
public void actionPerformed( ActionEvent event )
{
IJButtonActionPerformed( event );
}
});
OoJButton = new JButton();
OoJButton.setBounds( 475, 150, 50, 50 );
OoJButton.setText( "O" );
contentPane.add( OoJButton );
OoJButton.addActionListener(
new ActionListener()
{
public void actionPerformed( ActionEvent event )
{
OJButtonActionPerformed( event );
}
});
PpJButton = new JButton();
PpJButton.setBounds( 100, 200, 50, 50 );
PpJButton.setText( "P" );
contentPane.add( PpJButton );
PpJButton.addActionListener(
new ActionListener()
{
public void actionPerformed( ActionEvent event )
{
PJButtonActionPerformed( event );
}
});
AaJButton = new JButton();
AaJButton.setBounds( 150, 200, 50, 50 );
AaJButton.setText( "A" );
contentPane.add( AaJButton );
AaJButton.addActionListener(
new ActionListener()
{
public void actionPerformed( ActionEvent event )
{
AJButtonActionPerformed( event );
}
});
SsJButton = new JButton();
SsJButton.setBounds( 200, 200, 50, 50 );
SsJButton.setText( "S" );
contentPane.add( SsJButton );
SsJButton.addActionListener(
new ActionListener()
{
public void actionPerformed( ActionEvent event )
{
SJButtonActionPerformed( event );
}
});
DdJButton = new JButton();
DdJButton.setBounds( 250, 200, 50, 50 );
DdJButton.setText( "D" );
contentPane.add( DdJButton );
DdJButton.addActionListener(
new ActionListener()
{
public void actionPerformed( ActionEvent event )
{
DJButtonActionPerformed( event );
}
});
FfJButton = new JButton();
FfJButton.setBounds( 300, 200, 50, 50 );
FfJButton.setText( "F" );
contentPane.add( FfJButton );
FfJButton.addActionListener(
new ActionListener()
{
public void actionPerformed( ActionEvent event )
{
FJButtonActionPerformed( event );
}
});
GgJButton = new JButton();
GgJButton.setBounds( 350, 200, 50, 50 );
GgJButton.setText( "G" );
contentPane.add( GgJButton );
GgJButton.addActionListener(
new ActionListener()
{
public void actionPerformed( ActionEvent event )
{
GJButtonActionPerformed( event );
}
});
HhJButton = new JButton();
HhJButton.setBounds( 400, 200, 50, 50 );
HhJButton.setText( "Q" );
contentPane.add( HhJButton );
HhJButton.addActionListener(
new ActionListener()
{
public void actionPerformed( ActionEvent event )
{
HJButtonActionPerformed( event );
}
});
JjJButton = new JButton();
JjJButton.setBounds( 450, 200, 50, 50 );
JjJButton.setText( "J" );
contentPane.add( JjJButton );
JjJButton.addActionListener(
new ActionListener()
{
public void actionPerformed( ActionEvent event )
{
JJButtonActionPerformed( event );
}
});
一洽客服系统 2009-06-04
  • 打赏
  • 举报
回复
你这也太~,,,,打个jar包放资源里在给个链接不好吗

62,614

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧