Create a Login form and Index form with netbeans ide and inside Login form you can put two labels Name and password with a jTextField1 and jPasswordField1 and two buttons Submit and Cancel
Login
Submit private void jButton1ActionPerformed(java.awt.event.ActionEvent evt)
{
String s=jTextField1.getText();
String s1=jPasswordField1.getText();
Index i=new Index();
if(s.equals("Vikram")&&s1.equals("vikram"))
{
i.setVisible(true);
}
else if(!"Vicky".equals(s))
{
JOptionPane.showMessageDialog(this,"User Name Is Incorrect");
}
else
{
JOptionPane.showMessageDialog(this,"Password Is Incorrect");
}
}
Cancel
    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) 
{
    System.exit(0);
}
Index
Date can be set to the textfield using the below code :
  private void formWindowActivated(java.awt.event.WindowEvent evt) 
{
        Date d=new Date();
        SimpleDateFormat da=new SimpleDateFormat("dd/MM/yyyy");
        jTextField1.setText(da.format(d));
        SimpleDateFormat vi=new SimpleDateFormat("hh:mm:ss");
        jTextField2.setText(vi.format(d));
}
 
 
No comments:
Post a Comment