
Hi friends i need simple login form coding using two labels,two textfields and two buttons in netbeans without using database connection. . if you know that logic please tell that...

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
class Login extends JFrame{
JButton ok,cancel;
JLabel label1,label2;
final JTextField text1,text2;
Login(){
setTitle("Login Form");
setLayout(null);
label1 = new JLabel();
label1.setText("Username:");
text1 = new JTextField(15);
label2 = new JLabel();
label2.setText("Password:");
text2 = new JPasswordField(15);
ok=new JButton("OK");
cancel=new JButton("Cancel");
label1.setBounds(350,100,100,20);
text1.setBounds(450,100,200,20);
label2.setBounds(350,130,100,20);
text2.setBounds(450,130,200,20);
ok.setBounds(350,160,100,20);
cancel.setBounds(450,160,100,20);
add(label1);
add(text1);
add(label2);
add(text2);
add(ok);
add(cancel);
setVisible(true);
setSize(1024,768);
}
public static void main(String arg[]){
new Login();
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.