Vous êtes sur la page 1sur 1

import java.awt.*; import java.awt.event.*; import javax.swing.

*; class StartHere extends Frame { public StartHere() { login(); }

public void login() { JPasswordField tf = new JPasswordField(10); tf.setEchoChar('*'); Object[] msg = {"Please enter your PIN: ", tf}; String input=""; int result; do{ tf.selectAll(); tf.requestFocus(); result = JOptionPane.showConfirmDialog(t his, msg, "PIN information", JOptionP ane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE); if(result == JOptionPane.OK_OPTION) { input = tf.getText(); if(!input.equals("praneeth")) { String message1 = "\nYou have entered wrong password\n"+ "Please try again!"; JOptionPane.showMessageDialog(th is, message1, "PIN information", JOptionPane.INFORMATION_ MESSAGE); } } else { System.exit(0); } }while (!input.equals("praneeth")); new ImageS().start(); } public static void main(String[] args){ new StartHere(); } }

Vous aimerez peut-être aussi