Total members 11894 |It is currently Sun Nov 24, 2024 7:16 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





How to take Username and Password from user in Java
if you can use java netbeans 6 point something.you can do it in design mode.just drag jlabel1 for user name then drag jtextfield ,then drag jpasswordfield for password.and drag a button for action.if you double click in button then created jButton1ActionPerformed. At last you can run this code in JButton1ActionPerformed

Code:
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
//// Action submit button for main form submit//
       
    String user_name
=jTextField1.getText();
        String pasword=jPasswordField1.getText();
    if(user_name==" " || pasword==" ")
{
  JOptionPane.showMessageDialog(null,"Invalid User Name or Password","Error",JOptionPane.ERROR_MESSAGE);
}

if you want file upload as like text file.you can see this code for file chooser 

private JFileChooser fileChooser
;

 try
           
{
            fileChooser = new JFileChooser();
            int result= fileChooser.showOpenDialog(this);                   
            if
(result==JFileChooser.CANCEL_OPTION)
                 {
                   JOptionPane.showMessageDialog(null,"You Cancel it.","Warning",JOptionPane.ERROR_MESSAGE);
                 } 
             else
                 
{
              your work
                
}
catch(
FileNotFoundException exception)
           {
           } 





Author:
Newbie
User avatar Posts: 1
Have thanks: 0 time
Post new topic Reply to topic  [ 1 post ] 

  Related Posts  to : Input username and password in JAVA
 AJAX Login Code getting username and password dynamically .     -  
 Mile200: Removing Username, Password & Login from Header     -  
 Password Security Manager Access File Java     -  
 validate username     -  
 how to encrypt password in jsp     -  
 generate password using php     -  
 php Password protect a page     -  
 Protect page using password in PHP     -  
 simple password Strength checker     -  
 input suggestion using Javascript     -  



Topic Tags

Java Swing
cron





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com