Advertisement
Guest User

bla

a guest
May 25th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.46 KB | None | 0 0
  1. public class TP{
  2.  
  3. public static void main(String[] args){
  4.  
  5. // Création de la fenêtre principale
  6. JFrame f = new JFrame(" exercice sur les skieurs");
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13. // JPanel saisie = new JPanel(new FlowLayout());
  14. JPanel gauche = new JPanel(new GridLayout(5,2));
  15. JPanel droit = new JPanel();
  16. droit.setLayout(new BoxLayout(droit, BoxLayout.Y_AXIS));
  17.  
  18.  
  19.  
  20.  
  21. // Création du texte non modifiable pour le nom
  22. JLabel nom = new JLabel("Nom : ");
  23.  
  24.  
  25. // Création du champ de texte du nom
  26. JTextField texte = new JTextField(30);
  27. // texte.setPreferredSize( new Dimension( 100, 24 ) );
  28.  
  29.  
  30.  
  31. // Création du texte non modifiable pour la Catégorie
  32. JLabel categorie = new JLabel("Catégorie : ");
  33.  
  34. // Création de la liste déroulante et du tableau de string pour la catégorie
  35. String[] catego = {"Junior", "Senior", "Veteran"};
  36. JComboBox gradeList = new JComboBox<>(catego);
  37.  
  38.  
  39.  
  40. // Création du texte non modifiable pour le genre
  41. JLabel g = new JLabel("Genre : ");
  42.  
  43. // Création de la liste déroulante pour genre (HOMME/FEMME) et du tableau de string
  44.  
  45. String[] genre = {"homme", "femme"};
  46. JComboBox genr = new JComboBox<>(genre);
  47.  
  48.  
  49.  
  50.  
  51.  
  52. // Création du texte non modifiable pour le temps
  53.  
  54. JLabel resultats = new JLabel("Résultat : ");
  55.  
  56. // Création du Spinner pour le temps
  57. JSpinner tps = new JSpinner();
  58.  
  59.  
  60.  
  61. // Création du bouton d'affichage " Ajouter "
  62.  
  63. JButton ajt = new JButton("Ajouter");
  64.  
  65.  
  66.  
  67. JButton skieurs = new JButton("Afficher tous les skieurs");
  68.  
  69. JButton premier = new JButton("Afficher le premier");
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87. gauche.add(nom);
  88.  
  89. gauche.add(texte);
  90. gauche.add(categorie);
  91. gauche.add(gradeList);
  92. gauche.add(g);
  93. gauche.add(genr);
  94. gauche.add(resultats);
  95. gauche.add(tps);
  96.  
  97.  
  98. droit.add(skieurs);
  99. droit.add(premier);
  100.  
  101. f.add(droit);
  102. f.add(gauche);
  103. f.setVisible(true);
  104. f.setSize(400, 300);
  105. f.setLocationRelativeTo(null);
  106.  
  107.  
  108.  
  109. // nom.setLocationRelativeTo(null);
  110.  
  111.  
  112.  
  113.  
  114.  
  115. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement