Advertisement
sfhrzhrzejt

listeParties

Jun 26th, 2019
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. package info1.vue;
  2.  
  3. import javax.swing.*;
  4. import java.awt.*;
  5.  
  6. public class ListeParties extends JFrame {
  7.  
  8. private JButton retour;
  9. private JButton rejoindre;
  10. private JList liste;
  11. private JTextField bonus;
  12.  
  13. public ListeParties(String titre) {
  14. super(titre);
  15.  
  16.  
  17. JPanel general = new JPanel();
  18. general.setLayout(new BorderLayout());
  19. this.getContentPane().add(general);
  20.  
  21. JPanel panelListe = new JPanel();
  22. panelListe.setLayout(new FlowLayout());
  23. JPanel panelBoutons = new JPanel();
  24. panelBoutons.setLayout(new BorderLayout());
  25. retour = new JButton("Retour");
  26. rejoindre = new JButton("Rejoindre");
  27. panelBoutons.add(retour, BorderLayout.WEST);
  28. panelBoutons.add(rejoindre, BorderLayout.EAST);
  29.  
  30. String[] values = {"test","retest","reretest"};
  31. liste = new JList(values);
  32. panelListe.add(liste);
  33. liste.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  34. liste.setLayoutOrientation(JList.HORIZONTAL_WRAP);
  35. liste.setPreferredSize(new Dimension(1000,700));
  36.  
  37. general.add(panelListe, BorderLayout.CENTER);
  38. general.add(panelBoutons, BorderLayout.SOUTH);
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45. this.setPreferredSize(new Dimension(1200, 800));
  46. this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  47. this.pack();
  48. this.setVisible(true);
  49.  
  50. }
  51.  
  52. public static void main(String[] args) {
  53. new ListeParties("Choix d'une partie");
  54.  
  55. }
  56.  
  57.  
  58.  
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement