1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
public class jfSaisie extends JFrame implements ActionListener
{
public jfSaisie()
{
JButton jb=new JButton("clic");
jb.addActionListener(this);
this.add(jb);
}
public static void main(String[] args)
{
jfSaisie jfs=new jfSaisie();
jfs.setVisible(true);
jfs.pack();
}
public void actionPerformed(ActionEvent arg0)
{
for(int i=0;i<1000;i++)
System.out.println("coucou_"+i);
System.out.println("Valeur: "+correspondance("coucou"));
}
public String correspondance(String sMess)
{
String sRes ="";
while(sRes == null || sRes.length() == 0 || sRes.trim().length() == 0)
sRes = (String)JOptionPane.showInputDialog(null,sMess,"Erreur sur le fond",JOptionPane.QUESTION_MESSAGE);
return sRes;
}
} |
Partager