Example #1
0
 // 当鼠标单击事件发生时
 public void actionPerformed(ActionEvent evt) {
   try {
     // 初始化聊天通信类
     comUtil = new ComUtil(chatFrame);
     final String loginMsg =
         YeekuProtocol.PRESENCE
             + userField.getText()
             + YeekuProtocol.SPLITTER
             + iconList.getSelectedObjects()[0]
             + YeekuProtocol.PRESENCE;
     comUtil.broadCast(loginMsg);
     // 启动定时器每20秒广播一次在线信息
     javax.swing.Timer timer =
         new javax.swing.Timer(1000 * 10, event -> comUtil.broadCast(loginMsg));
     timer.start();
     loginFrame.setVisible(false);
     chatFrame.setVisible(true);
   } catch (Exception ex) {
     loginFrame.setTipMsg("确认30001端口空闲,且网络正常!");
   }
 }
Example #2
0
 private void signOutActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_signOutActionPerformed
   dispose();
   LoginFrame lf = new LoginFrame();
   lf.setVisible(true);
 } // GEN-LAST:event_signOutActionPerformed