public String commando(String username, String channel, String text) throws RemoteException{
String[] result = text.split(" ", 3);
if(result[0].equalsIgnoreCase("/join")){
channel = result[1];
setChannel(channel);
joinChannel(username, channel);
}
else if(result[0].equalsIgnoreCase("/leave")){
channel = result[1];
setChannel(channel);
leaveChannel(username, channel);
}
else if(result[0].equalsIgnoreCase("/whisper")){
for (int x=2; x<result.length; x++)
newPrivateMessage(username, result[1], result[x]);
}
else if(result[0].equalsIgnoreCase("/exit")){
System.exit(0);
}
else{
error(brukernavn, "Wrong!");
}
return tekst;
}
빨간색으로 표시하려면 오류가 필요합니다. 이 메시지 ("Wrong!")는/dfdsfsd와 같은 것을 작성한 사용자에게 전달됩니다. 화면에 메시지가 표시되지만 빨간색으로 표시되지 않습니다. 어떤 생각?RMI 채팅 프로그램에 빨간색 "오류"메시지가 필요합니다.
편집 :
간섭 : 서버에서
public interface ChatFront extends Remote {
void error(String to, String message) throws RemoteException;
}
public interface Klient extends Remote {
void error(String to, String message) throws RemoteException;
}
: 나는 (노르웨이어를 사용) 그래서 이것은 U에 대한 문제가 될 수있는 이름 중 일부를 편집 한
class ChatFrontImpl extends UnicastRemoteObject implements ChatFront {
private UserDAO b = new UserDAO();
private Hashtable<String, ArrayList<String>> chanel = new Hashtable<String, ArrayList<String>>();
private ArrayList<Klient> clients= new ArrayList<Client>();
public ChatFrontImpl() throws RemoteException {
}
public void error(String to, String message) throws RemoteException{
errorTo(to, message);
}
private void errorTo(String to, String message) throws RemoteException{
for(Client k: clients){
if(k.findName().equals(to)){
k.error(to, message);
}
}
}
, 그러나 프로그램은 작동합니다. 이 기능을 찾기 위해, 당신이해야 콘솔 창을 사용하는 경우
public class GUI extends javax.swing.JFrame {
GUILogikk gl = new GUILogikk(this);
public void error(String to, String message){
//chatFelt.setCaretColor(Color.RED);
chatFelt.append("" + message + "\n");
chatFelt.setCaretPosition(chatFelt.getText().length());
}
}
사용자 인터페이스 기술은 무엇입니까? – home
인터페이스에 스타일 (색상)을 지정하는 코드를 보여 주면 도움이 될 수 있습니다. Swing, AWT, SWT, 터미널 창을 사용하고 있습니까? – jefflunt