コード例 #1
0
ファイル: ChatWindow.java プロジェクト: jmacdotorg/volity
  /** Sends the message that the user typed in the input text area. */
  private void doSendMessage() {
    assert (SwingUtilities.isEventDispatchThread()) : "not in UI thread";

    try {
      String message = mInputText.getText();

      /* Make sure we've got the right resource. */
      mRemoteIdFull = applyLastKnownResource(mRemoteIdBare);
      mChatObject.setParticipant(mRemoteIdFull);

      mChatObject.sendMessage(message);
      mInputText.setText("");
      mLog.message(mLocalId, mLocalId, message);
      // Make the noise, since we won't get an incoming copy of this
      Audio.playMessage();
    } catch (XMPPException ex) {
      new ErrorWrapper(ex);
      JOptionPane.showMessageDialog(
          this, ex.toString(), JavolinApp.getAppName() + ": Error", JOptionPane.ERROR_MESSAGE);
    }
  }