Total members 11890 |It is currently Thu Apr 25, 2024 1:01 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
 Mile200: Removing Username, Password & Login from Header     -  
 AJAX Login Code getting username and password dynamically .     -  
 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-Output Operations     -  



Topic Tags

Java Swing






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