我创建了与订阅者和发布者的 Java 聊天。当我发送所有用户都收到的消息时,我试图向特定用户发送私人消息,我试图在我使用“IF”时取消用户以获取消息,但它没有任何想法。
else if (tempM[2].equals(chat)) {
//send message to every one
if (userNameListErea.isSelectionEmpty()) {
chatTextErea.append(tempM[0] + ": " + tempM[1] + "\n");
// not send message to your self.
} else if (userNameListErea.getSelectedValue().toString().equals(userName)) {
chatTextErea.append("Can not sent private to your self \n");
// if its not public and not to ypurself the its private
}else {
chatTextErea.append(userNameListErea.getSelectedValue() + " send u private: " +
tempM[1] + "\n");
}
}
也许我错过了阻止用户查看消息的正确命令