private void MoveSellerActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_MoveSellerActionPerformed
    JButton button = (JButton) evt.getSource();

    if (button.getName().equals("toRight")) {
      sellerdb.moveSellerItem(AvSel, LsSel);
    } else if (button.getName().equals("toLeft")) {
      sellerdb.moveSellerItem(LsSel, AvSel);
    }
  } // GEN-LAST:event_MoveSellerActionPerformed
Esempio n. 2
0
  public void mousePressed(MouseEvent e) {
    if (e.getButton() != MouseEvent.BUTTON3) return;

    JButton bouton = (JButton) e.getSource();
    i = champMine.getLingeBouton(bouton.getName());
    j = champMine.getColonneBouton(bouton.getName());

    if (champMine.estCaseNormale(i, j)) champMine.setMarquerMine(i, j);
    else if (champMine.estMarqueeMine(i, j)) champMine.setMarquerDoute(i, j);
    else if (champMine.estMarqueeDoute(i, j)) champMine.setMarquerNormale(i, j);

    barreUtil.updateDrapeaux(champMine.nbDrapeaux, champMine.nbMines);
  } // mousePressed()
  @Override
  public void actionPerformed(ActionEvent ae) {
    pakkaNappi.setEnabled(true);
    avoPakkaNappi.setEnabled(true);

    for (JButton nappi : vuoro.getPelaaja().getKorttiNapit()) {
      if (nappi.getName() == null) {
        avoPakkaNappi.setText(pokeri.pakanPaallimmainen.toString());

        Kortti kortti = pokeri.koneKaantaaKortin(vuoro.getKasi());

        nappi.setText(kortti.toString());

        KorttienMaalaaja.maalaaNappi(pokeri, kortti, nappi);

        nappi.setName("painettu");
        nappi.doClick();

        break;
      }
    }
    vuoro.seuraava();

    NappiHallinto.piilotaMuidenPelaajienNapit(pokeri, vuoro);

    lopetaPeliLopussa(pokeri, frame, avoPakkaNappi, pakkaNappi);

    KoneToiminta.luoJaPainaaKoneNappia(pokeri, frame, vuoro, avoPakkaNappi, pakkaNappi);

    if (!frame.getTitle().equals("Piilopokeri")) {
      frame.dispose();
    }
  }
Esempio n. 4
0
  @Override
  public void actionPerformed(ActionEvent e) {
    JButton clicked = (JButton) e.getSource();
    String label = clicked.getName();

    toolbarListener.modeSelected(label);
  }
Esempio n. 5
0
  /**
   * Action performed on various action links(buttons).
   *
   * @param e the action.
   */
  public void actionPerformed(ActionEvent e) {
    JButton src = (JButton) e.getSource();

    if (src instanceof SIPCommButton) {
      // Load image
      int index = Integer.parseInt(src.getName());
      BufferedImage image = AvatarStackManager.loadImage(index);

      // Set the new image
      setNewImage(image);
    } else if (src.getName().equals("chooseButton")) {
      // Open the image picker
      Image currentImage = this.avatarImage.getAvatar();

      ImagePickerDialog dialog = new ImagePickerDialog(96, 96);

      byte[] bimage = dialog.showDialog(currentImage);

      if (bimage == null) return;

      // New image
      BufferedImage image = ImageUtils.getBufferedImage(new ImageIcon(bimage).getImage());

      // Store image
      if (this.nextImageIndex == MAX_STORED_IMAGES) {
        // No more place to store images
        // Pop the first element (index 0)
        AvatarStackManager.popFirstImage(MAX_STORED_IMAGES);

        this.nextImageIndex = MAX_STORED_IMAGES - 1;
      }

      // Store the new image on hard drive
      AvatarStackManager.storeImage(image, this.nextImageIndex);

      // Inform protocols about the new image
      setNewImage(image);
    } else if (src.getName().equals("removeButton")) {
      // Removes the current photo.
      setNewImage(null);
    } else if (src.getName().equals("clearButton")) {
      clearRecentImages();
    }

    setVisible(false);
  }
Esempio n. 6
0
  /**
   * Handles the <tt>ActionEvent</tt> which occurred when user clicks the Search button.
   *
   * @param e the <tt>ActionEvent</tt> that notified us of the button click
   */
  public void actionPerformed(ActionEvent e) {
    JButton button = (JButton) e.getSource();
    String buttonName = button.getName();

    if (buttonName.equalsIgnoreCase("search")) {
      historyWindow.showHistoryByKeyword(searchTextField.getText());
    }
  }
Esempio n. 7
0
 @Override
 public void actionPerformed(ActionEvent arg0) {
   JButton but = (JButton) arg0.getSource();
   if (but.getName().equals("start")) {
     buttonselected = "start";
   } else if (but.getName().equals("end")) {
     buttonselected = "end";
   }
   JDialog dia = new JDialog();
   dia.setTitle("Kalendar");
   dia.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
   dia.addWindowListener(this);
   cal = new JCalendar();
   dia.add(cal);
   dia.pack();
   dia.setVisible(true);
 }
Esempio n. 8
0
 public void actionPerformed(ActionEvent event) {
   JButton button = (JButton) event.getSource();
   String location = button.getName().substring(8);
   int row = Integer.parseInt(location.substring(0, 1));
   int column = Integer.parseInt(location.substring(1, 2));
   model.markBoard(row, column);
   button.setText(model.checkSpot(row, column));
   checkForWin(row, column);
 }
Esempio n. 9
0
  /**
   * Handles the <tt>ActionEvent</tt>. In order to change the status message with the new one calls
   * the <tt>PublishStatusMessageThread</tt>.
   *
   * @param e the event that notified us of the action
   */
  public void actionPerformed(ActionEvent e) {
    JButton button = (JButton) e.getSource();
    String name = button.getName();

    if (name.equals("ok")) {
      new PublishStatusMessageThread(messageTextField.getText()).start();
    }

    this.dispose();
  }
Esempio n. 10
0
  public void mouseReleased(MouseEvent e) {
    if (e.getButton() != MouseEvent.BUTTON1) return;
    if (!estDessus) return;

    JButton bouton = (JButton) e.getSource();
    i = champMine.getLingeBouton(bouton.getName());
    j = champMine.getColonneBouton(bouton.getName());

    if (champMine.getNbCasesDecouvertes() == 0) {
      champMine.creerGrille(i, j);
      champMine.mettreAJourVoisinage();
    }

    if (champMine.estMarqueeMine(i, j)) return;
    if (champMine.estUneMine(i, j)) {
      partiePerdue(i, j);
    }
    champMine.setDecouverte(i, j);
    barreUtil.updateDrapeaux(champMine.nbDrapeaux, champMine.nbMines);
  } // mouseReleased()
Esempio n. 11
0
 @Override
 public void actionPerformed(ActionEvent e) {
   JButton source = (JButton) e.getSource();
   Comparator<Band> comparator =
       new Comparator<Band>() {
         @Override
         public int compare(Band o1, Band o2) {
           return o1.getName().compareTo(o2.getName());
         }
       };
   if (source.equals(newAuthorButton)) {
     String returned =
         JOptionPane.showInputDialog(null, "Input:", source.getName(), JOptionPane.PLAIN_MESSAGE);
     if (returned != null) {
       Band tmp = new Band(returned, this.type);
       if (Collections.binarySearch(this.bands, tmp, comparator) < 0) {
         this.addRow(tmp);
       }
     }
   } else if (source.equals(selectAuthorButton)) {
     if (bands.size() == 0) {
       return;
     }
     Object arr[] = bands.toArray();
     Object returned =
         JOptionPane.showInputDialog(
             source,
             "Select one from following box",
             source.getName(),
             JOptionPane.QUESTION_MESSAGE,
             null,
             arr,
             arr[0]);
     if (returned != null) {
       Band tmp = (Band) returned;
       this.addRow(tmp);
     }
   }
   MabisLogger.getLogger().log(Level.INFO, "Action called by clicking at {0}", source.getName());
 }
  /**
   * Handles the <tt>ActionEvent</tt> triggered when one of the buttons is clicked. When "Login"
   * button is choosen installs a new account from the user input and logs in.
   *
   * @param evt the action event that has just occurred.
   */
  public void actionPerformed(ActionEvent evt) {
    JButton button = (JButton) evt.getSource();
    String buttonName = button.getName();

    if (buttonName.equals("ok")) {
      GuiActivator.getUIService()
          .getConferenceChatManager()
          .joinChatRoom(
              chatRoom, idValue.getText(), new String(passwdField.getPassword()).getBytes());
    }

    this.dispose();
  }
Esempio n. 13
0
 public static HashMap<String, JButton> getButtonsFromContainer(Container c) {
   HashMap<String, JButton> map = new HashMap<String, JButton>();
   int count = 0;
   while (c.getComponentCount() > count) {
     Component comp = c.getComponent(count++);
     if (comp.getClass().isAssignableFrom(JButton.class)) {
       String newName = getNameBeforeDots(comp.getName());
       comp.setName(newName);
       map.put(comp.getName(), (JButton) comp);
       return map;
     } else if (comp instanceof Container) {
       HashMap<String, JButton> recursiveMap = getButtonsFromContainer((Container) comp);
       if (recursiveMap.size() > 0) {
         for (JButton w : recursiveMap.values()) {
           String newName = getNameBeforeDots(w.getName());
           comp.setName(newName);
           map.put(w.getName(), w);
         }
       }
     }
   }
   return map;
 }
Esempio n. 14
0
  void deferredResultFinished(Object o) {
    String name = deferredStatus;
    deferredStatus = null;

    configureNavigationButtons(parent.getWizard(), prev, next, finish);

    if (name.startsWith(DEFERRED_FAILED)) {
      // Cancel clicked after a deferred failure
      if (o instanceof ActionEvent) {
        JButton button = (JButton) ((ActionEvent) o).getSource();
        name = button.getName();
        if (NAME_CANCEL.equals(name)) {
          processCancel(o instanceof ActionEvent ? (ActionEvent) o : null, false);
          return;
        }
      }
      // in failed state, so we always reload the current step's screen
      String currentStep = parent.getCurrentStep();
      parent.navigateTo(currentStep);
      return;
    }

    switch (name) {
      case NAME_NEXT:
        processNextProceed(o);
        break;
        // else ignore, we don't know it
      case NAME_PREV:
        processPrevProceed(o);
        break;
      case NAME_CANCEL:
        processCancel(o instanceof ActionEvent ? (ActionEvent) o : null, false);
        break;
      case NAME_FINISH:
        // allowFinish on the "down" click of the finish button
        processFinishProceed(o);
        break;
      case NAME_CLOSE:
        // the "up" click of the finish button: wizard.finish was a deferred result
        Window dlg = getWindow();
        dlg.setVisible(false);
        dlg.dispose();
        break;
      default:
        break;
    }

    parent.updateProblem();
  }
  /**
   * Handles the <tt>ActionEvent</tt>. In order to rename the contact invokes the <code>
   * renameMetaContact</code> method of the current <tt>MetaContactListService</tt>.
   */
  public void actionPerformed(ActionEvent e) {
    JButton button = (JButton) e.getSource();
    String name = button.getName();

    if (name.equals("rename")) {
      if (metaContact != null) {
        new Thread() {
          public void run() {
            clist.renameMetaContact(metaContact, renameContactPanel.getNewName());
          }
        }.start();
      }
    }
    this.dispose();
  }
Esempio n. 16
0
  /** Called when one of the tiles is clicked */
  @Override
  public void actionPerformed(ActionEvent e) {

    JButton clickedButton = (JButton) e.getSource();

    if (clickedButton.getText().equals("Start New Game")) {

      startNewGame();

    } else if (clickedButton.getText().equals("Enter Manual Setup")) {

      game.setManualSetup(!game.getManualSetup());
      gui.setSetupText("Exit Manual Setup");

    } else if (clickedButton.getText().equals("Exit Manual Setup")) {

      game.setManualSetup(!game.getManualSetup());
      gui.setSetupText("Enter Manual Setup");

    } else if (clickedButton.getText().equals("Change Tile Colors")) {

      gui.editColors();

    } else {

      // Tile was clicked

      int row = clickedButton.getName().charAt(0) - '0';
      int col = clickedButton.getName().charAt(1) - '0';

      try {
        game.toggle(row, col);
        gui.updateUI(game.getLights());
        gui.setMoveLabel("Moves: " + game.getMoveCount());
      } catch (IllegalArgumentException e1) {

      }
      if (game.isWon()) {
        gui.displayWinMessage();
      }
    }
  }
Esempio n. 17
0
 @Override
 public void actionPerformed(ActionEvent e) {
   // check which JButton that was pressed and take action
   JButton pressed = (JButton) e.getSource();
   switch (pressed.getName()) {
     case "newGame":
       runNewGame();
       break;
     case "addGame":
       saveNewGame();
       break;
     case "clear":
       clearBoard();
       break;
     case "solve":
       solveGame();
       break;
     case "load":
       runSavedGame();
       break;
     case "save":
       saveGame();
       break;
     case "high":
       setHighscoreList();
       break;
     case "restart":
       restartGame();
       break;
     case "abort":
       abortGame();
       break;
     case "help":
       help();
       break;
     case "quit":
       close();
       break;
   }
 }
Esempio n. 18
0
  /**
   * Handles the <tt>ActionEvent</tt> triggered when one of the buttons is clicked. When "Login"
   * button is chosen installs a new account from the user input and logs in.
   *
   * @param evt the action event that has just occurred.
   */
  public void actionPerformed(ActionEvent evt) {
    JButton button = (JButton) evt.getSource();
    String buttonName = button.getName();

    if ("ok".equals(buttonName)) {
      if (uinValue instanceof JLabel) userName = ((JLabel) uinValue).getText();
      else if (uinValue instanceof JTextField) userName = ((JTextField) uinValue).getText();

      password = passwdField.getPassword();
      isRememberPassword = rememberPassCheckBox.isSelected();
    } else {
      isCanceled = true;
    }

    // release the caller that opened the window
    buttonClicked = true;
    synchronized (lock) {
      lock.notify();
    }

    this.dispose();
  }
Esempio n. 19
0
  public void actionPerformed(ActionEvent event) {

    JButton button = (JButton) event.getSource();

    String name = button.getName();

    if (NAME_CANCEL.equals(name)) {
      processCancel(event, true);
      return;
    }

    // probably an error status
    if (deferredStatus != null) {
      deferredResultFinished(event);
      return;
    }

    if (null != name)
      switch (name) {
        case NAME_NEXT:
          processNext();
          break;
        case NAME_PREV:
          processPrev();
          break;
        case NAME_FINISH:
          processFinish(event);
          break;
        case NAME_CLOSE:
          processClose(event);
          // else ignore, we don't know it
          break;
        default:
          break;
      }
    // else ignore, we don't know it

    parent.updateProblem();
  }
Esempio n. 20
0
  /**
   * Handles the <tt>ActionEvent</tt> generated when user presses one of the buttons in this panel.
   */
  public void actionPerformed(ActionEvent evt) {
    JButton button = (JButton) evt.getSource();
    String buttonName = button.getName();

    if (buttonName.equals("call")) {
      Component selectedPanel = mainFrame.getSelectedTab();

      // call button is pressed over an already open call panel
      if (selectedPanel != null
          && selectedPanel instanceof CallPanel
          && ((CallPanel) selectedPanel).getCall().getCallState()
              == CallState.CALL_INITIALIZATION) {

        NotificationManager.stopSound(NotificationManager.BUSY_CALL);
        NotificationManager.stopSound(NotificationManager.INCOMING_CALL);

        CallPanel callPanel = (CallPanel) selectedPanel;

        Iterator participantPanels = callPanel.getParticipantsPanels();

        while (participantPanels.hasNext()) {
          CallParticipantPanel panel = (CallParticipantPanel) participantPanels.next();

          panel.setState("Connecting");
        }

        Call call = callPanel.getCall();

        answerCall(call);
      }
      // call button is pressed over the call list
      else if (selectedPanel != null
          && selectedPanel instanceof CallListPanel
          && ((CallListPanel) selectedPanel).getCallList().getSelectedIndex() != -1) {

        CallListPanel callListPanel = (CallListPanel) selectedPanel;

        GuiCallParticipantRecord callRecord =
            (GuiCallParticipantRecord) callListPanel.getCallList().getSelectedValue();

        String stringContact = callRecord.getParticipantName();

        createCall(stringContact);
      }
      // call button is pressed over the contact list
      else if (selectedPanel != null && selectedPanel instanceof ContactListPanel) {
        // call button is pressed when a meta contact is selected
        if (isCallMetaContact) {
          Object[] selectedContacts =
              mainFrame.getContactListPanel().getContactList().getSelectedValues();

          Vector telephonyContacts = new Vector();

          for (int i = 0; i < selectedContacts.length; i++) {

            Object o = selectedContacts[i];

            if (o instanceof MetaContact) {

              Contact contact =
                  ((MetaContact) o).getDefaultContact(OperationSetBasicTelephony.class);

              if (contact != null) telephonyContacts.add(contact);
              else {
                new ErrorDialog(
                        this.mainFrame,
                        Messages.getI18NString("warning").getText(),
                        Messages.getI18NString(
                                "contactNotSupportingTelephony",
                                new String[] {((MetaContact) o).getDisplayName()})
                            .getText())
                    .showDialog();
              }
            }
          }

          if (telephonyContacts.size() > 0) createCall(telephonyContacts);

        } else if (!phoneNumberCombo.isComboFieldEmpty()) {

          // if no contact is selected checks if the user has chosen
          // or has
          // writen something in the phone combo box

          String stringContact = phoneNumberCombo.getEditor().getItem().toString();

          createCall(stringContact);
        }
      } else if (selectedPanel != null && selectedPanel instanceof DialPanel) {
        String stringContact = phoneNumberCombo.getEditor().getItem().toString();
        createCall(stringContact);
      }
    } else if (buttonName.equalsIgnoreCase("hangup")) {
      Component selectedPanel = this.mainFrame.getSelectedTab();

      if (selectedPanel != null && selectedPanel instanceof CallPanel) {

        NotificationManager.stopSound(NotificationManager.BUSY_CALL);
        NotificationManager.stopSound(NotificationManager.INCOMING_CALL);
        NotificationManager.stopSound(NotificationManager.OUTGOING_CALL);

        CallPanel callPanel = (CallPanel) selectedPanel;

        Call call = callPanel.getCall();

        if (removeCallTimers.containsKey(callPanel)) {
          ((Timer) removeCallTimers.get(callPanel)).stop();
          removeCallTimers.remove(callPanel);
        }

        removeCallPanel(callPanel);

        if (call != null) {
          ProtocolProviderService pps = call.getProtocolProvider();

          OperationSetBasicTelephony telephony = mainFrame.getTelephonyOpSet(pps);

          Iterator participants = call.getCallParticipants();

          while (participants.hasNext()) {
            try {
              // now we hang up the first call participant in the
              // call
              telephony.hangupCallParticipant((CallParticipant) participants.next());
            } catch (OperationFailedException e) {
              logger.error("Hang up was not successful: " + e);
            }
          }
        }
      }
    } else if (buttonName.equalsIgnoreCase("minimize")) {
      JCheckBoxMenuItem hideCallPanelItem =
          mainFrame.getMainMenu().getViewMenu().getHideCallPanelItem();

      if (!hideCallPanelItem.isSelected()) hideCallPanelItem.setSelected(true);

      this.setCallPanelVisible(false);
    } else if (buttonName.equalsIgnoreCase("restore")) {

      JCheckBoxMenuItem hideCallPanelItem =
          mainFrame.getMainMenu().getViewMenu().getHideCallPanelItem();

      if (hideCallPanelItem.isSelected()) hideCallPanelItem.setSelected(false);

      this.setCallPanelVisible(true);
    }
  }
 @Override
 public void actionPerformed(ActionEvent event) {
   boolean forceReloadData = false;
   final Object eventSource = event.getSource();
   if (eventSource == displayButton) {
     actionMakeGraph();
   } else if (eventSource == saveGraph) {
     saveGraphToFile = true;
     try {
       ActionRouter.getInstance()
           .getAction(ActionNames.SAVE_GRAPHICS, SaveGraphics.class.getName())
           .doAction(new ActionEvent(this, 1, ActionNames.SAVE_GRAPHICS));
     } catch (Exception e) {
       log.error(e.getMessage());
     }
   } else if (eventSource == saveTable) {
     JFileChooser chooser = FileDialoger.promptToSaveFile("statistics.csv"); // $NON-NLS-1$
     if (chooser == null) {
       return;
     }
     FileWriter writer = null;
     try {
       writer = new FileWriter(chooser.getSelectedFile()); // TODO Charset ?
       CSVSaveService.saveCSVStats(
           getAllTableData(), writer, saveHeaders.isSelected() ? COLUMNS : null);
     } catch (FileNotFoundException e) {
       log.warn(e.getMessage());
     } catch (IOException e) {
       log.warn(e.getMessage());
     } finally {
       JOrphanUtils.closeQuietly(writer);
     }
   } else if (eventSource == chooseForeColor) {
     Color color =
         JColorChooser.showDialog(
             null,
             JMeterUtils.getResString("aggregate_graph_choose_color"), // $NON-NLS-1$
             colorBarGraph);
     if (color != null) {
       colorForeGraph = color;
     }
   } else if (eventSource == syncWithName) {
     graphTitle.setText(namePanel.getName());
   } else if (eventSource == dynamicGraphSize) {
     // if use dynamic graph size is checked, we disable the dimension fields
     if (dynamicGraphSize.isSelected()) {
       graphWidth.setEnabled(false);
       graphHeight.setEnabled(false);
     } else {
       graphWidth.setEnabled(true);
       graphHeight.setEnabled(true);
     }
   } else if (eventSource == columnSelection) {
     if (columnSelection.isSelected()) {
       columnMatchLabel.setEnabled(true);
       applyFilterBtn.setEnabled(true);
       caseChkBox.setEnabled(true);
       regexpChkBox.setEnabled(true);
     } else {
       columnMatchLabel.setEnabled(false);
       applyFilterBtn.setEnabled(false);
       caseChkBox.setEnabled(false);
       regexpChkBox.setEnabled(false);
       // Force reload data
       forceReloadData = true;
     }
   }
   // Not 'else if' because forceReloadData
   if (eventSource == applyFilterBtn || forceReloadData) {
     if (columnSelection.isSelected()
         && columnMatchLabel.getText() != null
         && columnMatchLabel.getText().length() > 0) {
       pattern = createPattern(columnMatchLabel.getText());
     } else if (forceReloadData) {
       pattern = null;
       matcher = null;
     }
     if (getFile() != null && getFile().length() > 0) {
       clearData();
       FilePanel filePanel = (FilePanel) getFilePanel();
       filePanel.actionPerformed(event);
     }
   } else if (eventSource instanceof JButton) {
     // Changing color for column
     JButton btn = ((JButton) eventSource);
     if (btn.getName() != null) {
       try {
         BarGraph bar = eltList.get(Integer.parseInt(btn.getName()));
         Color color = JColorChooser.showDialog(null, bar.getLabel(), bar.getBackColor());
         if (color != null) {
           bar.setBackColor(color);
           btn.setBackground(bar.getBackColor());
         }
       } catch (NumberFormatException nfe) {
       } // nothing to do
     }
   }
 }
Esempio n. 22
0
  /** Initialize the UI. */
  private void initComponents() // GEN-BEGIN:initComponents
      {

    setLayout(new GridBagLayout());

    /*
     * project info panel
     */
    JPanel projectInfoPanel = new JPanel();
    projectInfoPanel.setLayout(new GridBagLayout());

    projectInfoPanel.setBorder(new TitledBorder(Resource.getResourceString("ProjectInformation")));

    projectIdText = new JTextField();
    projectIdText.setText("projectIdText");

    description = new JTextField();
    JLabel lblItemNum = new JLabel();
    lblItemNum.setText(Resource.getResourceString("Item_#"));

    dueDateChooser = new JDateChooser();
    JLabel lblStartDate = new JLabel();
    JLabel lblDueDate = new JLabel();
    statusComboBox = new JComboBox();
    JLabel catlabel = new JLabel();

    JLabel lblStatus = new JLabel();
    ResourceHelper.setText(lblStatus, "Status");
    lblStatus.setLabelFor(statusComboBox);

    startDateChooser = new JDateChooser();
    ResourceHelper.setText(lblStartDate, "Start_Date");
    lblStartDate.setLabelFor(startDateChooser);

    ResourceHelper.setText(lblDueDate, "Due_Date");
    lblDueDate.setLabelFor(dueDateChooser);

    ResourceHelper.setText(catlabel, "Category");
    categoryBox = new JComboBox();
    catlabel.setLabelFor(categoryBox);

    projectInfoPanel.add(
        lblItemNum, GridBagConstraintsFactory.create(0, 0, GridBagConstraints.BOTH));
    projectInfoPanel.add(
        lblStatus, GridBagConstraintsFactory.create(0, 1, GridBagConstraints.BOTH));
    projectInfoPanel.add(catlabel, GridBagConstraintsFactory.create(0, 2, GridBagConstraints.BOTH));
    JLabel descLabel = new JLabel();
    descLabel.setText(Resource.getResourceString("Description"));
    projectInfoPanel.add(
        descLabel, GridBagConstraintsFactory.create(0, 3, GridBagConstraints.BOTH));

    projectInfoPanel.add(
        projectIdText, GridBagConstraintsFactory.create(1, 0, GridBagConstraints.BOTH));
    projectInfoPanel.add(
        statusComboBox, GridBagConstraintsFactory.create(1, 1, GridBagConstraints.BOTH, 1.0, 0.0));
    projectInfoPanel.add(
        categoryBox, GridBagConstraintsFactory.create(1, 2, GridBagConstraints.BOTH, 1.0, 0.0));
    GridBagConstraints dgbc =
        GridBagConstraintsFactory.create(1, 3, GridBagConstraints.BOTH, 1.0, 0.0);
    dgbc.gridwidth = 5;
    projectInfoPanel.add(description, dgbc);

    JLabel parentLabel = new JLabel(Resource.getResourceString("parent"));
    projectInfoPanel.add(
        parentLabel, GridBagConstraintsFactory.create(2, 0, GridBagConstraints.BOTH));
    projectInfoPanel.add(
        lblStartDate, GridBagConstraintsFactory.create(2, 1, GridBagConstraints.BOTH));
    projectInfoPanel.add(
        lblDueDate, GridBagConstraintsFactory.create(2, 2, GridBagConstraints.BOTH));

    projectInfoPanel.add(
        parentProjectComboBox,
        GridBagConstraintsFactory.create(3, 0, GridBagConstraints.BOTH, 1.0, 0.0));
    projectInfoPanel.add(
        startDateChooser,
        GridBagConstraintsFactory.create(3, 1, GridBagConstraints.BOTH, 1.0, 0.0));
    projectInfoPanel.add(
        dueDateChooser, GridBagConstraintsFactory.create(3, 2, GridBagConstraints.BOTH, 1.0, 0.0));

    JLabel daysLeftLabel = new JLabel();
    daysLeftLabel.setText(Resource.getResourceString("Days_Left"));
    daysLeftLabel.setHorizontalTextPosition(SwingConstants.RIGHT);
    daysLeftLabel.setHorizontalAlignment(SwingConstants.RIGHT);
    projectInfoPanel.add(daysLeftLabel, GridBagConstraintsFactory.create(4, 0));
    JLabel totalLabel = new JLabel();
    totalLabel.setText(Resource.getResourceString("total_tasks"));
    projectInfoPanel.add(totalLabel, GridBagConstraintsFactory.create(4, 1));
    JLabel openLabel = new JLabel();
    openLabel.setText(Resource.getResourceString("open_tasks"));
    projectInfoPanel.add(openLabel, GridBagConstraintsFactory.create(4, 2));

    daysLeftText = new JTextField();
    daysLeftText.setEditable(false);
    projectInfoPanel.add(
        daysLeftText, GridBagConstraintsFactory.create(5, 0, GridBagConstraints.BOTH, 1.0, 0.0));
    totalTaskCount = new JTextField();
    totalTaskCount.setEditable(false);
    projectInfoPanel.add(
        totalTaskCount, GridBagConstraintsFactory.create(5, 1, GridBagConstraints.BOTH, 1.0, 0.0));
    openTaskCount = new JTextField();
    openTaskCount.setEditable(false);
    projectInfoPanel.add(
        openTaskCount, GridBagConstraintsFactory.create(5, 2, GridBagConstraints.BOTH, 1.0, 0.0));

    add(
        projectInfoPanel,
        GridBagConstraintsFactory.create(0, 0, GridBagConstraints.BOTH, 1.0, 0.0));

    /*
     * button panel
     */
    JPanel buttonPanel = new JPanel();
    JButton savebutton = new JButton();

    savebutton.setIcon(new ImageIcon(getClass().getResource("/resource/Save16.gif")));
    ResourceHelper.setText(savebutton, "Save");
    savebutton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent evt) {
            saveProject();
          }
        });
    buttonPanel.add(savebutton, savebutton.getName());

    GridBagConstraints bc =
        GridBagConstraintsFactory.create(0, 7, GridBagConstraints.BOTH, 0.0, 0.0);
    bc.gridwidth = 6;
    projectInfoPanel.add(buttonPanel, bc);

    /*
     * link panel
     */

    linkPanel.setBorder(new TitledBorder(Resource.getResourceString("links")));
    add(linkPanel, GridBagConstraintsFactory.create(0, 2, GridBagConstraints.BOTH));

    /*
     * panel that will contain the project's task list
     */
    taskBorder = new JPanel();
    taskBorder.setBorder(new TitledBorder(Resource.getResourceString("tasks")));
    taskBorder.setLayout(new GridBagLayout());

    add(taskBorder, GridBagConstraintsFactory.create(0, 3, GridBagConstraints.BOTH, 1.0, 1.0));
  }
  /**
   * Réagit au clique de la souris sur un bouton
   *
   * @param e L'ActionEvent généré
   */
  public void actionPerformed(ActionEvent e) {
    if (e.getSource() instanceof JButton) {
      JButton b = (JButton) e.getSource();
      if (b.getName() == "statTab") { // Si on clique sur l'onglet statistiques
        cartes.show(panneau, "statistiques");
      } else if (b.getName() == "payTab") { // Si on clique sur l'onglet de paiement
        cartes.show(panneau, "paiement");
      } else if (b.getName() == "loginButton") { // Si on clique sur le bonton de login
        char[] input = passTextField.getPassword();
        String pass = new String("root"); // Le mot de passe
        if (pass.equals(new String(input))) {
          cartes.show(panneau, "paiement");
          loginLabel.setText("");
        } else loginLabel.setText("Mot de passe incorrect");

        Arrays.fill(input, '0');
        passTextField.selectAll();
      } else if (b.getName() == "annuler") { // Si clique sur annuler
        // On réserte la sélection et on déselectionne les tables
        ControleurTables.deleteSelection();
        this.tableCounter = 0;
        this.payTextField.setText("");
        this.valider.setEnabled(false);
        this.valider.setBackground(Color.GRAY);
      } else if (b.getName() == "valider") { // Si on clique sur valider

        // On récupère la date
        Calendar cal = Calendar.getInstance();
        cal.add(Calendar.SECOND, (int) this.difTemps);
        // On récupère le mode de paiement sélectionné
        String type = new String("carte bleue");
        if (especes.isSelected()) {
          type = "especes";
        } else if (cheque.isSelected()) {
          type = "cheque";
        }
        try { // On verifie que le prix rentré est correct
          // On met tout dans le meme try pour annuler l'insertion de la commande dans la bdd en cas
          // d'erreur
          float prix = Float.parseFloat(payTextField.getText());
          ModelePaiement mP = new ModelePaiement();
          mP.insert(cal, prix, type);
          // On recupère la selection
          ArrayList<Table> tab = ControleurTables.getSelection();
          // On met toutes les tables à laver
          for (int i = 0; i < tab.size(); i++) {
            tab.get(i).setStatut(Table.ALAVER);
            tab.get(i).setNom(null);
          }
          // On déselectionne les tables
          ControleurTables.deleteSelection();
          this.tableCounter = 0;
          this.payTextField.setText("");
          this.valider.setEnabled(false);
          this.valider.setBackground(Color.GRAY);
          // On insère le paiement dans la bdd
          modeleTable.updateTables(this.tables);
        } catch (NumberFormatException nfe) {
          JOptionPane.showMessageDialog(
              null, "Veuillez entrez un rpix valide.", "Erreur prix", JOptionPane.ERROR_MESSAGE);
        }
      } else if (b.getName() == "trier") { // Si on appuie sur trier
        float ca = -1;
        ModelePaiement mP = new ModelePaiement();
        if (service.isSelected()) { // Si on selection le chiffre d'affaire par service
          ca =
              mP.getCAService(
                  (String)
                      serviceComboBox
                          .getSelectedItem()); // On sélectonne le chiffre d'affaire en focntion du
                                               // service

        } else if (date.isSelected()) { // Si on selection le chiffre d'affaire par date
          try { // On verifie que la date est bien valide
            Calendar cal = Calendar.getInstance();
            SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
            cal.setTime(sdf.parse(dateTextField.getText()));
            ca = mP.getCADate(cal); // On va chercher le chiffre d'affaire en fonction de la date
          } catch (Exception npe) {
            JOptionPane.showMessageDialog(
                null,
                "Veuillez entrez une date de la forme 03/06/2012.",
                "Erreur date",
                JOptionPane.ERROR_MESSAGE);
          }
        }

        if (ca > -1) { // Si on a récupérer un chiffre d'affaire
          chiffreAffaire.setText("Chiffre d'affaire : " + Float.toString(ca));
        }
      } else if (b.getName() == "option") { // Si on clique sur option
        String strDate =
            JOptionPane.showInputDialog(null, "Réglage de temps (ex: 03/06/1996 15:06) ", null);

        try {
          Calendar cal = Calendar.getInstance();
          Calendar now = Calendar.getInstance();

          SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm");
          cal.setTime(sdf.parse(strDate));
          difTemps =
              (int)
                  ((cal.getTimeInMillis() - now.getTimeInMillis())
                      / 1000); // Transformation en secondes
          if ((cal.getTimeInMillis() - now.getTimeInMillis()) % 1000 > 0) {
            difTemps++;
          }
        } catch (Exception exep) {
          JOptionPane.showMessageDialog(
              null,
              "Vous devez entrer une date valide (ex: 03/06/1996 15:06).",
              "Date invalide",
              JOptionPane.ERROR_MESSAGE);
        }
      }
    }
  }