@Override public void joinNotice(String who, String where, String context) { consolePanel.p(who + " joined " + where); EntryPanel peepList = peepLists.get(where); if (peepList != null) { peepList.addEntry(who); if (currentConvo != null && currentConvo.equals(where)) peepListPane.setViewportView(peepLists.get(where).PANEL); } }
@Override public void conversationStartedNotice(String convo) { convoList.addEntry(convo); convoList.highlightEntry(convo, Color.RED); convoListPane.setViewportView(convoList.PANEL); chatArea.createNewChat(convo); EntryPanel peepList = new EntryPanel(this); peepList.PANEL.setBackground(BACKGROUND); peepList.PANEL.setForeground(new Color(255, 69, 0)); peepLists.put(convo, peepList); }
@Override public void sendClicked(String userInput) { EntryPanel peepList = peepLists.get(currentConvo); if (peepList != null) { List<String> selectedPeeps = peepList.getSelected(); if (selectedPeeps.size() > 0) { for (String peep : selectedPeeps) if (!peep.equals(USERNAME)) CHAT_CLIENT.sendChatMessage(peep, userInput); return; } } CHAT_CLIENT.sendChatMessage(currentConvo, userInput); }
@Override public void conversationEndedNotice(String convo) { convoList.removeEntry(convo); convoListPane.setViewportView(convoList.PANEL); chatArea.removeChat(convo); peepLists.remove(convo); }
@Override public void chatMessage(String who, String where, String what) { if (convoList.containsEntry(where) == false) conversationStartedNotice(where); if (who.toUpperCase().equals(USERNAME.toUpperCase())) chatArea.clientPrint(what, who, where); else chatArea.serverPrint(what, who, where); }
private void setupConvoPanel() { convoPanel = new JPanel(); convoPanel.setLayout(new BorderLayout()); convoPanel.setBackground(BACKGROUND); convoList = new EntryPanel(this); convoList.PANEL.setBackground(BACKGROUND); convoList.PANEL.setForeground(new Color(255, 69, 0)); convoList.enforceSingleSelection(true); convoControlPanel = new JPanel(); convoTitle = new CstmTextField("", "Enter Convo Name"); joinConvo = new CstmButton("JOIN", "Join Convo"); joinConvo.addMouseListener(this); startConvo = new CstmButton("START", "Start Convo"); startConvo.addMouseListener(this); convoControlPanel.setLayout(new BorderLayout()); convoControlPanel.add(convoTitle, BorderLayout.CENTER); convoControlPanel.add(joinConvo, BorderLayout.WEST); convoControlPanel.add(startConvo, BorderLayout.EAST); convoListPane = new JScrollPane(convoList.PANEL); convoPanel.add(convoListPane, BorderLayout.CENTER); convoPanel.add(convoControlPanel, BorderLayout.SOUTH); }