예제 #1
0
  /**
   * Méthode de création du panelInit
   *
   * @return
   */
  private JPanel createPanelInit() {

    JPanel panRight = new JPanel();
    panRight.setLayout(new BoxLayout(panRight, BoxLayout.Y_AXIS));

    butListParty = new JButton("Liste des parties");
    butListParty.addActionListener(this);

    JPanel panCreate = new JPanel();
    panCreate.setLayout(new BoxLayout(panCreate, BoxLayout.X_AXIS));
    textCreate = new JTextField("", 40);
    textCreate.setMaximumSize(textCreate.getPreferredSize());
    butCreateParty = new JButton("Creation de parties ");
    butCreateParty.addActionListener(this);
    SpinnerModel model = new SpinnerNumberModel(3, 2, 8, 1);
    spinNbPlayer = new JSpinner(model);
    spinNbPlayer.setMaximumSize(spinNbPlayer.getPreferredSize());
    panCreate.add(new JLabel("Nouveau nom de partie : "));
    panCreate.add(textCreate);
    panCreate.add(Box.createHorizontalStrut(20));
    panCreate.add(new JLabel("Nombres de joueurs : "));
    panCreate.add(spinNbPlayer);
    panCreate.add(butCreateParty);

    JPanel panJoin = new JPanel();
    panJoin.setLayout(new BoxLayout(panJoin, BoxLayout.X_AXIS));
    textJoin = new JTextField("", 2);
    textJoin.setMaximumSize(textJoin.getPreferredSize());
    butJoinParty = new JButton("Rejoindre la partie ");
    butJoinParty.addActionListener(this);
    panJoin.add(new JLabel("Num Partie : "));
    panJoin.add(textJoin);
    panJoin.add(butJoinParty);

    panRight.add(butListParty);
    panRight.add(panCreate);
    panRight.add(panJoin);
    panRight.add(Box.createVerticalGlue());

    textInfoInit = new JTextArea(20, 100);
    textInfoInit.setLineWrap(true);

    JScrollPane scroll =
        new JScrollPane(
            textInfoInit,
            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    JPanel panAll = new JPanel();
    panAll.setLayout(new BoxLayout(panAll, BoxLayout.X_AXIS));
    panAll.add(scroll);
    panAll.add(panRight);

    return panAll;
  }
예제 #2
0
 void addTextField(JPanel panel, String key, String label) {
   JLabel lab = new JLabel(label);
   lab.setAlignmentX(LEFT_ALIGNMENT);
   panel.add(lab);
   JTextField field = new JTextField();
   field.setText(sketch.configFile.get(key));
   field.setMaximumSize(new Dimension(Integer.MAX_VALUE, field.getPreferredSize().height));
   fields.put(key, field);
   panel.add(field);
 }
예제 #3
0
  /**
   * Méthode de création du panel de Connection
   *
   * @return
   */
  private JPanel createPanelConnect() {

    JPanel panAll = new JPanel(new BorderLayout());

    JPanel panPseudo = new JPanel();
    textPseudo = new JTextField("", 20);
    textPseudo.setMaximumSize(textPseudo.getPreferredSize());
    panPseudo.add(new JLabel("Pseudo: "));
    panPseudo.add(textPseudo);

    JPanel panConn = new JPanel();
    textServerIP = new JTextField("127.0.0.1", 15);
    panConn.add(new JLabel("Server IP: "));
    panConn.add(textServerIP);

    butConnect = new JButton("Connect");
    butConnect.addActionListener(this);

    panAll.add(panPseudo, BorderLayout.NORTH);
    panAll.add(panConn, BorderLayout.CENTER);
    panAll.add(butConnect, BorderLayout.SOUTH);

    return panAll;
  }
예제 #4
0
  /**
   * Méthode de création du panel de Jeu
   *
   * @return
   */
  private JPanel createPanelPlay() {

    JPanel panAll = new JPanel(new BorderLayout());

    textInfoParty = new JTextArea(20, 100);
    textInfoParty.setLineWrap(true);
    JScrollPane scroll =
        new JScrollPane(
            textInfoParty,
            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);

    JPanel panPlay = new JPanel();
    textPlay = new JTextField("", 5);
    textPlay.setMaximumSize(textPlay.getPreferredSize());
    butPlay = new JButton("Jouer");
    butPlay.addActionListener(this);
    panPlay.add(new JLabel("Ordre :  "));
    panPlay.add(textPlay);
    enableOrder(false);
    JPanel panRight = new JPanel(new BorderLayout());
    panRight.add(panPlay, BorderLayout.CENTER);
    panRight.add(butPlay, BorderLayout.SOUTH);

    JPanel panMain = new JPanel();
    panMain.add(scroll);
    panMain.add(panRight);

    butQuit = new JButton("Quitter");
    butQuit.addActionListener(this);

    panAll.add(panMain, BorderLayout.CENTER);
    panAll.add(butQuit, BorderLayout.SOUTH);

    return panAll;
  }