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
| import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
public class Test extends JFrame {
String[] genre = {" Masculin ", " Feminin "};
public Test(){
this.setTitle("Deplacement");
this.setSize(500, 300);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setLocationRelativeTo(null);
this.getContentPane().setLayout(new FlowLayout());
add(new JLabel("Nom:"));
add(new JTextField(10));
add(new JLabel("Prénom:"));
add(new JTextField(12));
add(new JLabel(" Sexe:"));
add(new JComboBox(genre));
this.setVisible(true);
}
public static void main(String[] main){
Test fen = new Test();
}
} |
Partager