コード例 #1
0
ファイル: ChatGUI.java プロジェクト: Ayoubane/chatsystem-og
  /**
   * Shows the file proposal sent from an another user
   *
   * @param fileName The file name
   * @param from Sender Username
   */
  public void showProposal(String fileName, String from) {

    int n = 0; // MAYBE PROBLEM!!!
    if (this.gui.controller.Language == "English") {
      n =
          JOptionPane.showConfirmDialog(
              this,
              "Would you like to get this file : " + fileName + " From" + from + " ?",
              "File Proposal",
              JOptionPane.YES_NO_OPTION);
    } else if (this.gui.controller.Language == "Francais") {
      n =
          JOptionPane.showConfirmDialog(
              this,
              "Voudrez vous telecharger le fichier : " + fileName + " envoyé par " + from + " ?",
              "Proposition De Telechargement",
              JOptionPane.YES_NO_OPTION);
    }

    // System.out.println("n = "+n);
    if (n == 0) {
      try {
        gui.acceptFileTransfer(fileName, from);
      } catch (IOException ex) {
        Logger.getLogger(ChatGUI.class.getName()).log(Level.SEVERE, null, ex);
      }
    } else {
      gui.notAcceptFileTransfer(fileName, from);
    }
  }