WIP bug fix 3
This commit is contained in:
1 parent
fa4ee046b1
commit
23559dcc06
5 files changed
+7
-4
No files matched your search
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -20,7 +20,6 @@ public class ChatController {
|
||||
private final HashMap<TcpConnection, JMenuItem> chatMenus;
|
||||
private final HashMap<TcpConnection, ChatWindow> chatWindows;
|
||||
|
||||
|
||||
public ChatController(MainWindow mainWindow, ChatMenu chatMenu) {
|
||||
this.mainWindow = mainWindow;
|
||||
publicChatWindow = new PublicChatWindow(mainWindow);
|
||||
@@ -28,7 +27,9 @@ public class ChatController {
|
||||
chatMenus = new HashMap<>();
|
||||
chatWindows = new HashMap<>();
|
||||
|
||||
chatMenu.newMenuItem(new JMenuItem("Show global chat"), publicChatWindow);
|
||||
this.chatMenu = chatMenu;
|
||||
|
||||
this.chatMenu.newMenuItem(new JMenuItem("Show global chat"), publicChatWindow);
|
||||
}
|
||||
|
||||
public void addChatWindow(TcpConnection tcpConnection) {
|
||||
@@ -36,10 +37,8 @@ public class ChatController {
|
||||
|
||||
PrivateChatWindow newChat = new PrivateChatWindow(mainWindow, tcpConnection);
|
||||
chatWindows.put(tcpConnection, newChat);
|
||||
|
||||
JMenuItem newMenuItem = new JMenuItem();
|
||||
chatMenus.put(tcpConnection, newMenuItem);
|
||||
|
||||
newMenuItem.setText(tcpConnection.getAddress().toString());
|
||||
chatMenu.newMenuItem(newMenuItem, newChat);
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import pitiupi.net.Message;
|
||||
import pitiupi.net.tcp.TcpConnection;
|
||||
import pitiupi.plugin.PrivateConnectionPlugin;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
@@ -57,9 +58,12 @@ public class TestChat implements PrivateConnectionPlugin{
|
||||
chatController.receivePublic(testChatMessage);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void receivePrivateConnection(TcpConnection tcpConnection) {
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
chatController.addChatWindow(tcpConnection);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user