import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
public class Login extends JFrame implements ActionListener{
JButton jb1;
JLabel jl1,jl2,jl3;
JTextField jt1,jt2;
public Login(){
setSize(500,500);
jb1=new JButton("LogIn");
jl1=new JLabel("");
jl2=new JLabel("\n User Name\n");
jl3=new JLabel("\n Password\n");
jt1=new JTextField(10);
jt2=new JTextField(10);
Container c=getContentPane();
c.setLayout(new FlowLayout());
c.add(jl1);
c.add(jl2);
c.add(jt1);
c.add(jl3);
c.add(jt2);
c.add(jb1);
jb1.addActionListener(this);
}
@Override
public void actionPerformed(ActionEvent e) {
if(jt1.getText().equals("uttam") && jt2.getText().equals("123")){
jl1.setText("LogIN successfuly");
jt2.setText("");
jb1.setText("LogOut");
}
else if(jb1.getText().equals("LogOut")){
jl1.setText("LogOut successfuly");
jb1.setText("LogIn");
}
}
public static void main(String[] args) {
// TODO code application logic here
Login l=new Login();
l.setVisible(true);
}
}
A blog provide anexample with sample code for swing , servlet, jdbc and odbc connection to database, jsp, servlets, taglib, sql server, cassandra and many more. we also provide Apache camel sample code for integration.
Wednesday, November 7, 2012
Create Login form using swing
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment