1 package zirc.gui ; 2 3 import java.awt.event.* ; 4 import javax.swing.event.* ; 5 import zirc.base.* ; 6 import zirc.msg.* ; 7 import javax.swing.* ; 8 9 22 29 30 public class PrivateFrame extends AbstractChatFrame 31 { 32 private final ImageIcon privIMG = new ImageIcon("fichiers/images/privateIcon.png") ; 33 private String correspondant ; 34 35 public PrivateFrame(IRCconnexion _IRCchat, String _correspondant) 36 { 37 super(_IRCchat) ; 38 this.setFrameIcon(privIMG); 39 correspondant = _correspondant ; 40 } 41 42 void jTextField1_actionPerformed(ActionEvent e) 43 { 44 45 String txt = jTextField1.getText() ; 46 47 if (txt.length() > 0) 48 { 49 50 if (txt.charAt(0) == '/') 51 { 52 IRCchat.sendCommand(txt.substring(1)) ; 54 } 55 else 56 { 57 String send = "PRIVMSG " + correspondant + " :" + txt ; 59 IRCchat.sendCommand(send) ; 60 61 MSGprivMsg msg = new MSGprivMsg(IRCchat, ":" + IRCchat.GetUser_nickName() + "!", correspondant, send) ; 63 msg.reagit() ; 64 msg.affiche() ; 65 } 66 } 67 68 jTextField1.setText("") ; 69 70 } 71 72 void this_internalFrameClosed(InternalFrameEvent e) 73 { 74 super.this_internalFrameClosed(e) ; 75 destroy() ; 76 } 77 78 public void destroy() 79 { 80 81 IRCchat.removePrivate(this) ; 83 84 try 85 { 86 setClosed(true) ; 87 } 88 catch (java.beans.PropertyVetoException e) 89 { 90 System.out.println("propertyVeto...") ; 91 } 92 } 93 94 public String getCorrespondant() 95 { 96 return correspondant ; 97 } 98 99 public void setCorrespondant(String _name) 100 { 101 this.setCorrespondant(_name) ; 102 setTitle(_name) ; 103 } 104 } 105 | Popular Tags |