Code java
Fermé
sweet koukou
Messages postés
5
Date d'inscription
lundi 1 mars 2010
Statut
Membre
Dernière intervention
3 mars 2010
-
3 mars 2010 à 20:59
HackTrack Messages postés 618 Date d'inscription vendredi 26 juillet 2002 Statut Membre Dernière intervention 13 juillet 2013 - 21 juil. 2012 à 13:14
HackTrack Messages postés 618 Date d'inscription vendredi 26 juillet 2002 Statut Membre Dernière intervention 13 juillet 2013 - 21 juil. 2012 à 13:14
A voir également:
- Code java
- Jeux java itel ✓ - Forum Jeux vidéo
- Java runtime - Télécharger - Langages
- Java apk - Télécharger - Langages
- Code asci - Guide
- Code 80072efe ✓ - Forum Windows
2 réponses
elgammoudi
Messages postés
3
Date d'inscription
mercredi 7 avril 2010
Statut
Membre
Dernière intervention
9 avril 2010
9 avril 2010 à 22:03
9 avril 2010 à 22:03
j'ai le tester et je trouve qu'il ya des erreurs
HackTrack
Messages postés
618
Date d'inscription
vendredi 26 juillet 2002
Statut
Membre
Dernière intervention
13 juillet 2013
972
21 juil. 2012 à 13:14
21 juil. 2012 à 13:14
Salut!
A part une ou deux petites erreurs, c'est tout bon ;-)
Voici ma version.
J'ai un peu allégé la présentation (pas de Box,...) par souci de lisibilité.
;-)
HackTrack
A part une ou deux petites erreurs, c'est tout bon ;-)
Voici ma version.
J'ai un peu allégé la présentation (pas de Box,...) par souci de lisibilité.
package hacktrack.login;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.Box;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
public class LoginDemo extends JFrame {
protected JTextField nomText;
protected JPasswordField pText;
public LoginDemo() {
super("Authentification");
init();
}
private void init() {
setDefaultCloseOperation(EXIT_ON_CLOSE);
nomText = new JTextField(15);
pText = new JPasswordField(15);
JPanel content = new JPanel();
content.setLayout(new GridLayout(0, 2));
content.setPreferredSize(new Dimension(300, 80));
content.add(new JLabel("Login :"));
content.add(nomText);
content.add(new JLabel("Password :"));
content.add(pText);
JButton validateButton = new JButton("Valider");
validateButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent ae) {
login(nomText.getText(), pText.getPassword());
}
});
content.add(validateButton );
JButton cancelButton = new JButton("Annuler");
cancelButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent ae) {
nomText.setText("");
pText.setText("");
}
});
content.add(cancelButton);
getContentPane().add(content);
}
private void login(String username, char[] passwordChars){
String password = "";
for(char c: passwordChars)
password+=c;
JOptionPane.showMessageDialog(null, "Login with ["+username+"/"+password+"]");
}
public static void main(String[] args) {
LoginDemo demo = new LoginDemo();
demo.pack();
demo.setVisible(true);
}
}
;-)
HackTrack
19 juil. 2012 à 20:49