/** * 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); } }
public MainPanel(GUI gui) { this.gui = gui; setBounds(0, gui.getHeight() / 10, gui.getWidth(), gui.getHeight() - gui.getHeight() / 10); setPreferredSize(new Dimension(gui.getWidth(), gui.getHeight() - gui.getHeight() / 10)); setLayout(new BorderLayout()); setOpaque(true); setBackground(Color.WHITE); tweetBox = new TweetBox(this); }
/** * Method called when Disconnect button is pressed * * @param evt */ private void jButton4ActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jButton4ActionPerformed try { if (this.gui.controller.Language == "English") { appendjTextPane1("Me : ", 2); // Or gui.getUser() ;) } else if (this.gui.controller.Language == "Francais") { appendjTextPane1("Moi : ", 2); // Or gui.getUser() ;) } appendjTextPane1("GoodBye, I'm " + gui.getUser(), 0); appendjTextPane1("\n", 0); } catch (BadLocationException ex) { Logger.getLogger(ChatGUI.class.getName()).log(Level.SEVERE, null, ex); } gui.performDisconnect(gui.getUser()); if (this.gui.controller.Language == "English") { JOptionPane.showMessageDialog(this, "You have been successfully disconnected."); } else if (this.gui.controller.Language == "Francais") { JOptionPane.showMessageDialog(this, "vous avez bien été déconnecté."); } } // GEN-LAST:event_jButton4ActionPerformed
/** * Method called when Select File method is pressed * * @param evt */ private void jButton2ActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jButton2ActionPerformed final JFileChooser fc = new JFileChooser(); int returnVal = fc.showOpenDialog(this); // Where frame is the parent component if (returnVal == JFileChooser.APPROVE_OPTION) { File file = null; file = fc.getSelectedFile(); gui.performSendProposal(file.getAbsolutePath(), file.getTotalSpace()); } else { // User did not choose a valid file } } // GEN-LAST:event_jButton2ActionPerformed
/** * Method called when Send Button is pressed * * @param evt */ private void jButton1ActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jButton1ActionPerformed try { if (this.gui.controller.Language == "English") { appendjTextPane1("Me : ", 2); // Or gui.getUser() ;) } else if (this.gui.controller.Language == "Francais") { appendjTextPane1("Moi : ", 2); // Or gui.getUser() ;) } appendjTextPane1(jTextArea2.getText(), 0); appendjTextPane1("\n", 0); } catch (BadLocationException ex) { Logger.getLogger(ChatGUI.class.getName()).log(Level.SEVERE, null, ex); } gui.performSend(jTextArea2.getText()); jTextArea2.setText(null); } // GEN-LAST:event_jButton1ActionPerformed
public void refreshTimeline() { gui.homeButtonClicked(); }
public void searchEntered() { gui.searchEntered(); }
public void newDMessageEntered() { gui.newDMessageEntered(); }
public void newDMessageButtonClicked() { gui.newDMessageButtonClicked(); }
public void backToMessageListClicked() { gui.backToMessageListClicked(); add(tweetBox, BorderLayout.SOUTH); }
public void retweetButtonClicked(long tweetId) { gui.retweetButtonClicked(tweetId); }
public String getCurrentUserScreenName() { return gui.getCurrentUserScreenName(); }
public void followButtonPressed(long userID) { gui.followButtonPressed(userID); }
public void changeUsernameClicked(String screenName) { gui.changeUsernameClicked(screenName); }
public void changeProfilePictureClicked(File image) { gui.changeProfilePictureClicked(image); }
public void deleteButtonClicked(long tweetId) { gui.deleteButtonClicked(tweetId); }
public long getCurrentUserId() { return gui.getCurrentUserId(); }
public void unFollowButtonClicled(long userID) { gui.unFollowButtonClicked(userID); }
public void tweetEntered() { gui.tweetEntered(); }
public void followersClicked(long userId) { gui.followersClicked(userId); }
public void meButtonClicked() { gui.meButtonClicked(); }
public void conversationClicked(String peer) { gui.conversationClicked(peer); }
public void unFavoriteButtonClicked(long tweetId) { gui.unFavoriteButtonClicked(tweetId); }
public void favoriteButtonClicked(long tweetId) { gui.favoriteButtonClicked(tweetId); }
public void unRetweetButtonClicked(long tweetId) { gui.unRetweetButtonClicked(tweetId); }
public void userNameClicked(long userId) { gui.userNameClicked(userId); }