![](https://csdnimg.cn/release/download_crawler_static/87139367/bg4.jpg)
______________________________________________________________________________________________________________
imgLabel.add(getJlUsername());
imgLabel.add(getTxtUsername());
imgLabel.add(getJlPwd());
imgLabel.add(getTxtPassword());
imgLabel.add(getJbOk());
imgLabel.add(getJbCancel());
cantainer.add(imgLabel,BorderLayout.NORTH);
((JPanel)cantainer).setOpaque(false); //注意这里,将
内容面板设为透明。这样LayeredPane面板中的背景才能显示出来。
this.setSize(img.getIconWidth(),img.getIconHeight());
myEvent();
this.setVisible(true);
this.setResizable(true);
}
private void myEvent(){
jbCancel.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
Login.this.dispose();
}
});
jbOk.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
Connection conn=null;
Statement stm=null;
ResultSet st=null;
try
{
Class.forName("com.mysql.jdbc.Driver");
conn=DriverManager.getConnection("jdbc:mysql://localho
st:3306/library","sa","123456");
stm=conn.createStatement();
String sql="select * from user";
//String sql1="select psw from user";
st=stm.executeQuery(sql);
// st1=stm.executeQuery(sql1);
if(st.next())