/** * Display a system message in the chat box. * * @param message the <code>String</code> message to be shown. */ public void systemMessage(String message) { chatArea.append("\nMegaMek: " + message); //$NON-NLS-1$ moveToEnd(); }
@Override public void gamePlayerChat(GamePlayerChatEvent e) { chatArea.append('\n' + e.getMessage()); PlayerListDialog.refreshPlayerList(playerList, client); moveToEnd(); }
public void keyPressed(KeyEvent ev) { if (ev.getKeyCode() == KeyEvent.VK_ENTER) { history.addFirst(inputField.getText()); historyBookmark = -1; if (!inputField.getText().startsWith(Client.CLIENT_COMMAND)) { client.sendChat(inputField.getText()); } else { systemMessage(client.runCommand(inputField.getText())); } inputField.setText(""); //$NON-NLS-1$ if (history.size() > MAX_HISTORY) { history.removeLast(); } } else if (ev.getKeyCode() == KeyEvent.VK_UP) { historyBookmark++; fetchHistory(); } else if (ev.getKeyCode() == KeyEvent.VK_DOWN) { historyBookmark--; fetchHistory(); } cb2.setMessage(inputField.getText()+ev.getKeyChar()); moveToEnd(); }
@Override public void gamePhaseChange(GamePhaseChangeEvent e) { // This is a really lame place for this, but I couldn't find a // better one without making massive changes (which didn't seem // worth it for one little feature). if (bv.getLocalPlayer() != client.getLocalPlayer()) { // The adress based comparison is somewhat important. // Use of the /reset command can cause the player to get reset, // and the equals function of Player isn't powerful enough. bv.setLocalPlayer(client.getLocalPlayer()); } // Make sure the ChatterBox starts out deactived. bv.setChatterBoxActive(false); // Swap to this phase's panel. switchPanel(getClient().getGame().getPhase()); menuBar.setPhase(getClient().getGame().getPhase()); validate(); cb.moveToEnd(); }