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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
|
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.Vector;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
public class SaisieNomForm extends JFrame {
protected static SaisieNomForm SNF=null;
public static Container conteneur=null;
JPanel jp;
JButton jB;
JButton jBtest;
private JTextField jtxt;
public static SaisieNomForm HSW;
protected SaisieNomForm(){
setLocation(200,50);
setSize(new Dimension(200, 200));
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setTitle("Saisir nom");
conteneur=this.getContentPane();
conteneur.setLayout(null);
conteneur.setBackground(new Color(255,255,255));
JTextField jtxt = new JTextField("Votre Nom");
jtxt.setPreferredSize(new Dimension (80, 20));
jtxt.setBounds(40,50,120,20);
this.conteneur.add(jtxt);
jB=new JButton();
jBtest=new JButton();
jB.setText("OK");
jB.setBounds(40,110,120,20);
jBtest.setBounds(300,110,120,20);
jB.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent ev){
Partie(ev);
}
}
);
this.conteneur.add(jB);
this.conteneur.add(jBtest);
}
public void Partie(ActionEvent ev){
//DiceGame.getInstance().commencer(jtxt.getText());
RollForm.Getinstance().show();
SNF.setVisible(false);
}
public static SaisieNomForm Getinstance(){
if(SNF==null)
{SNF = new SaisieNomForm();
System.out.println("RoulerForm Getinstance()");
}
return SNF;
}
}
[quote][/quote] |
Partager