예제 #1
0
 public void actionPerformed(ActionEvent ae) {
   String cname = nameF.getText().trim();
   int state = conditions[stateC.getSelectedIndex()];
   try {
     if (isSpecialCase(cname)) {
       handleSpecialCase(cname, state);
     } else {
       JComponent comp = (JComponent) Class.forName(cname).newInstance();
       ComponentUI cui = UIManager.getUI(comp);
       cui.installUI(comp);
       results.setText("Map entries for " + cname + ":\n\n");
       if (inputB.isSelected()) {
         loadInputMap(comp.getInputMap(state), "");
         results.append("\n");
       }
       if (actionB.isSelected()) {
         loadActionMap(comp.getActionMap(), "");
         results.append("\n");
       }
       if (bindingB.isSelected()) {
         loadBindingMap(comp, state);
       }
     }
   } catch (ClassCastException cce) {
     results.setText(cname + " is not a subclass of JComponent.");
   } catch (ClassNotFoundException cnfe) {
     results.setText(cname + " was not found.");
   } catch (InstantiationException ie) {
     results.setText(cname + " could not be instantiated.");
   } catch (Exception e) {
     results.setText("Exception found:\n" + e);
     e.printStackTrace();
   }
 }
예제 #2
0
 /* (非 Javadoc)
  * @see ifttt.module.Messenger#sendMessage(java.lang.String)
  */
 @Override
 public void sendMessage(String msg) {
   output.append(msg);
   if (msg.endsWith("\n") == false) {
     output.append("\n");
   }
 }
 @Override
 public synchronized void write(byte[] ba, int str, int len) {
   try {
     curLength += len;
     if (bytesEndWith(ba, str, len, LINE_SEP)) {
       lineLengths.addLast(new Integer(curLength));
       curLength = 0;
       if (lineLengths.size() > maxLines) {
         textArea.replaceRange(null, 0, lineLengths.removeFirst().intValue());
       }
     }
     for (int xa = 0; xa < 10; xa++) {
       try {
         textArea.append(new String(ba, str, len));
         break;
       } catch (
           Throwable
               thr) { // sometimes throws a java.lang.Error: Interrupted attempt to aquire write
                      // lock
         if (xa == 9) {
           thr.printStackTrace();
         }
       }
     }
     textArea.setCaretPosition(textArea.getText().length());
   } catch (Throwable thr) {
     CharArrayWriter caw = new CharArrayWriter();
     thr.printStackTrace(new PrintWriter(caw, true));
     textArea.append(System.getProperty("line.separator", "\n"));
     textArea.append(caw.toString());
   }
 }
  public void actionPerformed(ActionEvent e) {

    // Handle open button action.
    if (e.getSource() == openButton) {
      int returnVal = fc.showOpenDialog(FileChooserDemo.this);

      if (returnVal == JFileChooser.APPROVE_OPTION) {
        File file = fc.getSelectedFile();
        // This is where a real application would open the file.
        log.append("Opening: " + file.getName() + "." + newline);
      } else {
        log.append("Open command cancelled by user." + newline);
      }
      log.setCaretPosition(log.getDocument().getLength());

      // Handle save button action.
    } else if (e.getSource() == saveButton) {
      int returnVal = fc.showSaveDialog(FileChooserDemo.this);
      if (returnVal == JFileChooser.APPROVE_OPTION) {
        File file = fc.getSelectedFile();
        // This is where a real application would save the file.
        log.append("Saving: " + file.getName() + "." + newline);
      } else {
        log.append("Save command cancelled by user." + newline);
      }
      log.setCaretPosition(log.getDocument().getLength());
    }
  }
예제 #5
0
 // サーバーから送られてきたメッセージの処理
 public void reachedMessage(String name, String value) {
   // チャットルームのリストに変更が加えられた
   if (name.equals("rooms")) {
     if (value.equals("")) {
       roomList.setModel(new DefaultListModel());
     } else {
       String[] rooms = value.split(" ");
       roomList.setListData(rooms);
     }
   }
   // ユーザーが入退室した
   else if (name.equals("users")) {
     if (value.equals("")) {
       userList.setModel(new DefaultListModel());
     } else {
       String[] users = value.split(" ");
       userList.setListData(users);
     }
   }
   // メッセージが送られてきた
   else if (name.equals("msg")) {
     msgTextArea.append(value + "\n");
   }
   // 処理に成功した
   else if (name.equals("successful")) {
     if (value.equals("setName")) msgTextArea.append(">名前を変更しました\n");
   }
   // エラーが発生した
   else if (name.equals("error")) {
     msgTextArea.append("ERROR>" + value + "\n");
   }
 }
예제 #6
0
 /** here the listening loop starts */
 public void start() {
   String input = null;
   while (_connected) {
     try {
       if (_myReader != null && !_socket.isClosed() && !_disconnect && _connected) {
         input = _myReader.readLine();
         if (_disconnect) {
           input = null;
           _socket.close();
         }
         if (input == null) {
           _connected = false;
           _textArea.append("client disconnected." + "\n");
         } else {
           _textArea.append(input + "\n");
         }
       } else {
         _textArea.append("server connection broken." + "\n");
         _connected = false;
       }
     } catch (ConnectException e) {
       System.err.println(e);
     } catch (Exception e) {
       _textArea.append("ERROR: broken pipe.\n");
       _connected = false;
       System.err.println(e);
       System.exit(1);
     }
   }
   System.exit(0);
 }
예제 #7
0
 // サーバーに接続する
 public void connectServer() {
   try {
     socket = new Socket(HOST, PORT);
     msgTextArea.append(">サーバーに接続しました\n");
   } catch (Exception err) {
     msgTextArea.append("ERROR>" + err + "\n");
   }
 }
예제 #8
0
 private void about() {
   results.setText("-About-");
   results.append("\n\n\nVersion 1.1.");
   results.append("\n\nCreated by Sean Crowley");
   results.append("\n\[email protected]");
   results.append("\n\nReddit.com/u/Crowley2012");
   results.append("\n\n\nFeel free to contact me via email or reddit with bugs/new features.");
 }
예제 #9
0
  public void onQueryGUI() {
    String protocolText = null;
    try {
      protocolText = protocol.getSelectedItem().toString();
      String hostText = host.getText();
      String portText = port.getText();
      String typeText = ((QueryType) type.getSelectedItem()).name;
      String useridText = userid.getText();
      String courseText = null;
      String conceptText = null;
      if (course.getSelectedItem() != null) courseText = course.getSelectedItem().toString();
      if (concept.getSelectedItem() != null) conceptText = concept.getSelectedItem().toString();

      HashMap<String, String> argMap = new HashMap<String, String>();
      argMap.put("protocol", protocolText);
      argMap.put("host", hostText);
      argMap.put("port", portText);
      argMap.put("type", typeText);
      argMap.put("userid", useridText);
      argMap.put("course", courseText);
      argMap.put("concept", conceptText);

      String msgText =
          "Client connects to host \""
              + hostText
              + "\" at port "
              + portText
              + " through protocol \""
              + protocolText
              + "\" in order to query \""
              + typeText
              + "\"\n";
      msg.append(msgText);
      msg.setCaretPosition(msg.getDocument().getLength());
      TriUMQueryArg arg = TriUMQueryArg.createQueryArg(argMap);
      showResult(arg.type, TriUMQueryClient.onQuery(argMap));
    } catch (Throwable e) {
      try {
        String err = "TriUMQueryRMI.onQuery causes error: " + e.getMessage() + ".";
        if (protocolText.toLowerCase().equals("soap")) {
          err +=
              "\nMaybe the cause is that applet can't access local computer due to security policy.\n";
          err += "This error often raise when using SOAP protocol.\n";
          err +=
              "You should change the security of JRE or sign key to this applet or choose another protocol such as RMI, HTTP, Socket.\n";
          err +=
              "It is ensured that the SOAP protocol works properly if you run the zebra-client as Java application (zebra-client.jar) instead of applet";
        }
        JOptionPane.showMessageDialog(null, err);
        System.out.println(err);
        e.printStackTrace();

        msg.append(err);
      } catch (Exception ex) {
        JOptionPane.showMessageDialog(null, ex.getMessage());
      }
    }
  }
 private void RodytiKnyguRinkinius() {
   neregKnyguZona.setText("");
   for (Book a : rg.neregKnygos) neregKnyguZona.append(a.toString() + "\n");
   regKnyguZona.setText("");
   for (Map.Entry<String, Book> me : rg.regKnygos.entrySet())
     regKnyguZona.append(String.format("%8s=%s\n", me.getKey(), me.getValue()));
   tfNeregSKaitytojųKiekis.setText(Integer.toString(rg.neregKnygos.size()));
   tfRegSKaitytojųKiekis.setText(Integer.toString(rg.regKnygos.size()));
 }
 private void rodytiAutoRinkinius() {
   zonaNeregAuto.setText("");
   for (Automobilis a : rg.neregAuto) zonaNeregAuto.append(a.toString() + "\n");
   zonaRegAuto.setText("");
   for (Map.Entry<String, Automobilis> me : rg.regAuto.entrySet())
     zonaRegAuto.append(String.format("%8s=%s\n", me.getKey(), me.getValue()));
   tfNeregKiekis.setText(Integer.toString(rg.neregAuto.size()));
   tfRegKiekis.setText(Integer.toString(rg.regAuto.size()));
 }
예제 #12
0
 /**
  * Prints messages to text area
  *
  * @param message the text to be printed
  */
 @Override
 public void displayMessage(String message) {
   if (message.length() == 0) return; // doesn't display empty lines
   if (textArea.getLineCount() >= 10) { // cleans the text area every 10 lines
     textArea.setText("");
   }
   textArea.append(message);
   textArea.append("\n");
 }
예제 #13
0
  /** The listener method. */
  public void actionPerformed(ActionEvent event) {
    Object source = event.getSource();

    if (source == b1) // click button
    {
      try {
        String message = tf.getText();
        server.sendPrivateMessage(parent, selfIdentity, message);
        ta.append("<" + parent.getUserName() + ">: " + message + lineSeparator);
        ta.setCaretPosition(ta.getText().length());
        tf.setText("");
      } catch (RemoteException ex) {
        System.out.print("Exception encountered while sending" + " private message.");
      }
    }

    if (source == tf) // press return
    {
      try {
        String message = tf.getText();
        server.sendPrivateMessage(parent, selfIdentity, message);
        ta.append("<" + parent.getUserName() + ">: " + message + lineSeparator);
        ta.setCaretPosition(ta.getText().length());
        tf.setText("");
      } catch (RemoteException ex) {
        System.out.print("Exception encountered while sending" + " private message.");
      }
    }
    if (source == jMenuItem3) {
      JFileChooser fileChooser = new JFileChooser();

      fileChooser.setDialogTitle("Choose or create a new file to store the conversation");
      fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
      fileChooser.setDoubleBuffered(true);

      fileChooser.showOpenDialog(this);

      File file = fileChooser.getSelectedFile();

      try {
        if (file != null) {

          Writer writer = new BufferedWriter(new FileWriter(file));

          writer.write(ta.getText());
          writer.flush();
          writer.close();
        }
      } catch (IOException ex) {
        System.out.println("Can't write to file. " + ex);
      }
    }
    if (source == jMenuItem4) {
      selfRemove();
      this.dispose();
    }
  }
 public synchronized void println(long x) {
   if (line.length() > 0) {
     textArea.append(line.append(String.valueOf(x)).toString());
     textArea.append("\n");
     line = new StringBuffer();
   } else {
     textArea.append(String.valueOf(x));
     textArea.append("\n");
   }
 }
예제 #15
0
 public void updateStatus() {
   txaStatus.setText("");
   txaStatus.append("size\t" + store.getRowCount() + "\n");
   txaStatus.append("total\t" + store.sumLengths() + "KB\n");
   txaStatus.append("\nThreads:\n");
   for (int i = 0; i < numThreads; i++) {
     txaStatus.append(" " + i + "- ");
     String jb = encryptDecryptThreads[i].getCur();
     if (jb == null) txaStatus.append("idle\n");
     else {
       txaStatus.append(jobString(jb) + "\n");
     }
   }
   txaStatus.append("\nJobs:\n");
   int c = 6 + numThreads;
   int i = 0;
   synchronized (jobs) {
     for (String s : jobs) {
       if (c + i < TXA_HEIGHT - 1) txaStatus.append(" - " + jobString(s) + "\n");
       else if (c + i == TXA_HEIGHT - 1) {
         txaStatus.append(" - [" + (jobs.size() - i) + "more ]");
       }
       i++;
     }
   }
 }
예제 #16
0
 public void actionPerformed(ActionEvent e) {
   if (e.getSource() == buttonwrap) {
     textArea.append("Wrap Text. \n");
     setWrapText();
   } else if (e.getSource() == buttonDoNotWrap) {
     textArea.append("Do not wrap text.\n");
     setDoNotWrapText();
   } else if (e.getSource() == buttonBlank) textArea.append("Nothing to see here.\n");
   else if (e.getSource() == buttonClearText) {
     textArea.append("Clear text.\n");
     setClearText();
   } else if (e.getSource() == buttonScrollV) {
     textArea.append("Scrolling vertically.\n");
     setScrollVertical();
   } else if (e.getSource() == buttonScrollH) {
     textArea.append("Scrolling horizontally.\n");
     setScrollHorizontal();
   } else if (e.getSource() == buttonScrollBothWays) {
     textArea.append("Scroll both ways.\n");
     setScrollBothWays();
   } else if (e.getSource() == buttonDoNotScroll) {
     textArea.append("No scrolling allowed.\n");
     setDoNotScroll();
   } else textArea.append("Should not get here!\n");
 }
예제 #17
0
  @Override
  public void nextPacket(JPacket packet, StringBuilder errbuf) {

    String source = "";
    String destination = "";
    String printResult = "";

    try {
      packet.getHeader(ipv4);
      if (!(ipv4.source()).equals(null)) {
        source = FormatUtils.ip(ipv4.source());
      }
      if (!(ipv4.destination()).equals(null)) {
        destination = FormatUtils.ip(ipv4.destination());
      }
      // textPane1.setText(textPane1.getText() + "> Source ip = " + source + ";  Destination ip = "
      // + destination + "\n");
      printResult = "> Source ip = " + source + ";  Destination ip = " + destination + "\n";
    } catch (Exception e) {
      printResult = printResult + "!!! Exception ip IP Addr > " + e.getCause() + "\n";
      textPane1.append(printResult);
      // textPane1.setCaretPosition(textPane1.getDocument().getLength());
    }

    if (packet.hasHeader(Sip.ID)) {
      packet.getHeader(sip1);
      printResult = printResult + "> sip1.getMethod().name() = " + sip1.getMethod().name() + "\n";
    }

    if (packet.hasHeader(Rtp.ID)) {
      packet.getHeader(rtp1);
      printResult =
          printResult
              + "> rtp1.csrcLength() = "
              + rtp1.csrcLength()
              + ";  rtp1.csrc() = "
              + rtp1.csrc()
              + "; rtp1.ssrc()"
              + rtp1.ssrc()
              + "\n";
    }

    /*
            if (packet.hasHeader(Tcp.ID)) {
                packet.getHeader(tcp);
                printResult = printResult + "> tcp.dst_port = " + tcp.destination() + "; tcp.src_port = " + tcp.source() + "; tcp.ack = " + tcp.ack()  + "\n";
            }
            if (packet.hasHeader(Udp.ID)) {
                packet.getHeader(udp1);
                printResult = printResult + "> udp.dst_port = " + udp1.destination() + "; udp.src_port = " + udp1.source()  + "\n";
            }
    */
    textPane1.append(printResult + "Frame " + packet.getFrameNumber() + " \n");
    // textPane1.setCaretPosition(textPane1.getDocument().getLength());
  }
예제 #18
0
 static void log(String message) {
   if (resetFlag){
     logArea.setText("");
     miniLogArea.setText("");
   }
   resetFlag = (message.length() == 0);
   logArea.append(message + "\n");
   miniLogArea.append(message + "\n");
   logArea.setCaretPosition(logArea.getDocument().getLength());
   miniLogArea.setCaretPosition(miniLogArea.getDocument().getLength());
 }
예제 #19
0
  private void updateTextArea(List<String> lines) {
    if (lines.isEmpty()) {
      myTextArea.append("Ziadne vysledky :(\n");
    }

    for (String line : lines) {
      myTextArea.append(line + "\n");
    }

    myTextArea.append("------------------------------------------\n");
  }
  /** Plaatst enkele regels tekst in het tekstgebied en enkele keuzes in de keuzelijst */
  private void mijnInit() {
    voorbeeldGebied.append("Dit is een tekstgebied\n");
    voorbeeldGebied.append("Er kunnen verschillende regels\n");
    voorbeeldGebied.append("tekst in getoond worden.\n");
    voorbeeldGebied.append("Een tekstgebied kan ook als invoer\n");
    voorbeeldGebied.append("gebruikt worden\n");

    voorbeeldKeuze.addItem("Dit is keuze1 in een keuzelijst");
    voorbeeldKeuze.addItem("Keuze2");
    voorbeeldKeuze.addItem("Of keuze3");
    voorbeeldKeuze.addItem("Zoveel u wilt");
  }
예제 #21
0
  public void run() {
    try {
      FileInputStream fis = new FileInputStream(file);
      XSSFWorkbook workbook = new XSSFWorkbook(fis);
      XSSFSheet sheet = workbook.getSheetAt(0);
      Iterator<Row> rowIterator = sheet.iterator();
      Iterator<Row> rowIterator2 = sheet.iterator();

      if (rowIterator.hasNext()) {
        Row row = rowIterator.next();
        Iterator<Cell> cellIterator = row.cellIterator();
        String aux = "";
        while (cellIterator.hasNext()) {
          Cell cell = cellIterator.next();
          switch (cell.getCellType()) {
            case Cell.CELL_TYPE_STRING:
              aux += cell.getStringCellValue().toUpperCase() + " ";
              break;
          }
        }
        System.out.println("Aux: " + aux);
        if (aux.trim().equals(VALID_HEAD)) {
          textArea.append("EXCEL VALIDO\n\n");
          int size = 0;
          rowIterator2.next();
          while (rowIterator2.hasNext()) {
            rowIterator2.next();
            size++;
          }
          progressBar.setMaximum(size);
          progressBar.setValue(0);
          textArea.append("Clientes en fichero: " + size + "\n\n");
          int num = 0;
          while (rowIterator.hasNext()) {
            num++;
            textArea.append("--- CLIENT NUMBER " + num + " ---\n");
            Row row2 = rowIterator.next();
            processLine(row2.cellIterator());
            progressBar.setValue(num);
            Thread.sleep(1000);
          }
        } else {
          textArea.append(
              "El fichero excel seleccionado no es valido. "
                  + "Selecciona un fichero excel con las columnas: \n"
                  + VALID_HEAD);
        }
      }
      fis.close();
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }
예제 #22
0
 public void loadActionMap(ActionMap am, String indent) {
   Object[] k = am.allKeys();
   if (k == null) {
     results.append(indent + "No ActionMap defined\n");
   } else {
     results.append(indent + "\nActionMap (" + k.length + " local keys)\n");
   }
   if (k != null) {
     for (int i = 0; i < k.length; i++) {
       results.append(indent + "  Action:  " + k[i] + "\n");
     }
   }
 }
예제 #23
0
 public void loadInputMap(InputMap im, String indent) {
   KeyStroke[] k = im.allKeys();
   if (k == null) {
     results.append(indent + "No InputMap defined\n");
   } else {
     results.append(indent + "\nInputMap (" + k.length + " local keys)\n");
   }
   if (k != null) {
     for (int i = 0; i < k.length; i++) {
       results.append(indent + "  Key:  " + k[i] + ", binding: " + im.get(k[i]) + "\n");
     }
   }
 }
예제 #24
0
 public void getserver() {
   try {
     server = new ServerSocket(1978); // 实例化Socket对象
     ta_info.append("服务器套接字已经创建成功\n"); // 输出信息
     while (true) { // 如果套接字是连接状态
       ta_info.append("等待客户机的连接......\n"); // 输出信息
       socket = server.accept(); // 实例化Socket对象
       ta_info.append("连接成功......\n");
     }
   } catch (Exception e) {
     e.printStackTrace(); // 输出异常信息
   }
 }
예제 #25
0
 public synchronized void esperaY(JTextArea consola) {
   this.consola = consola;
   while (enposicion == false) {
     try {
       consola.append("\n");
       consola.append("Esperando a proceso Y...");
       wait();
     } catch (InterruptedException e) {
     }
   }
   enposicion = false;
   notifyAll();
 }
 private void sendRSA() {
   try {
     // print local
     cipherTextArea.append("RSAE" + rsa.getE());
     cipherTextArea.append("RSAN" + rsa.getN());
     // send the RSA stuff
     outputStrm.writeObject("RSAE" + rsa.getE());
     outputStrm.writeObject("RSAN" + rsa.getN());
     outputStrm.flush();
   } catch (IOException e) {
     chatTextWindow.append(" Something messed up!\n");
   }
 }
예제 #27
0
 public String obtenerCodigo() {
   // Este código separa los tokens correctamente
   tokens = new StringTokenizer(codigo, "\n");
   while (tokens.hasMoreTokens()) {
     linea = tokens.nextToken();
     StringTokenizer token = new StringTokenizer(linea);
     areaCodigo.append("\n");
     line++;
     areaCodigo.append(FuncionTokens(linea, line));
   }
   System.out.println(areaCodigo);
   return areaCodigo.getText();
 }
예제 #28
0
 protected void compileGoal(boolean andRun) {
   String sgoal = gl.getText();
   if (!(sgoal.length() == 0)) {
     try {
       ProParser p = new ProParser(sgoal, intmsg);
       goal = p.getClause();
       intmsg.append("compiled goal: " + goal + "\n");
       if (andRun) run();
     } catch (Exception e) {
       outp.append("errore" + e + " \n");
     }
   } else outp.append("inserire il goal" + " \n");
 }
예제 #29
0
  private void processLine(Iterator<Cell> cellIterator) {
    String name = cellIterator.next().getStringCellValue();
    String lastname = cellIterator.next().getStringCellValue();
    String email = cellIterator.next().getStringCellValue();
    int telephone = (int) cellIterator.next().getNumericCellValue();
    String business = cellIterator.next().getStringCellValue();
    String summerTime = cellIterator.next().getStringCellValue();
    String winterTime = cellIterator.next().getStringCellValue();
    String website = cellIterator.next().getStringCellValue();
    double latitude = cellIterator.next().getNumericCellValue();
    double longitude = cellIterator.next().getNumericCellValue();
    String address = cellIterator.next().getStringCellValue();
    String town = cellIterator.next().getStringCellValue();
    String subcategory = cellIterator.next().getStringCellValue();

    TownDTO townDTO = towns.get(town.toUpperCase());
    SubcategoryDTO subcategoryDTO = subcategories.get(subcategory.toUpperCase());
    if (townDTO == null || subcategoryDTO == null) {
      if (townDTO == null) {
        textArea.append(" - Error: No existe la ciudad: " + town + "\n");
      }
      if (subcategoryDTO == null) {
        textArea.append(" - Error: No existe la subcategoria: " + subcategory + "\n");
      }
    } else {
      ClientDTO client =
          new ClientDTO(
              name,
              lastname,
              email,
              business,
              null,
              "",
              website,
              address,
              townDTO,
              summerTime,
              winterTime,
              telephone,
              latitude,
              longitude,
              subcategoryDTO);
      String result = controller.addClient(client, "");
      if (result.startsWith("OK")) {
        textArea.append("Added: " + client + "\n\n");
      } else {
        textArea.append(result.substring(4) + ": " + client + "\n\n");
      }
    }
  }
예제 #30
0
  /** 处理接收到得用户信息 */
  private void receiveServerMsg() {
    try {

      ObjectInputStream serverInput = new ObjectInputStream(socket.getInputStream());
      Object object = serverInput.readObject();
      // 判断对方是否在线
      if (object == null) { // type为3表示用户不在线,转离线消息
        ObjectOutputStream output = new ObjectOutputStream(socket.getOutputStream());
        Message m = new Message();
        m.setType(3);
        m.setSendIP(myIP);
        m.setMessage(sendMsgTextField.getText().trim());
        m.setReceiveIP(destinationIP);
        output.writeObject(m);
        chartTextArea.append("对方不在线,信息已经转入离线信息。\n");
      } else {
        // 用户收到的是正常的聊天信息
        if (object instanceof Message) {
          Message m = (Message) object;
          /*String destinationIP = m.getSendIP();
          new Client(destinationIP, serverIP, PORT, table);*/
          chartTextArea.append(m.getSendIP() + ":\n" + m.getMessage() + "\n");
        }
        // 用户收到的是更新在线用户的信息
        else {
          @SuppressWarnings("unchecked")
          List<String> onlineIP = (List<String>) object;

          System.out.println("friend list:" + onlineIP.toString());

          // 将在线用户加入到界面中显示
          String[] tableHeads = new String[] {"在线用户"};
          DefaultTableModel dtm = (DefaultTableModel) friendTable.getModel();
          dtm.setColumnIdentifiers(tableHeads);

          for (int i = 0; i < onlineIP.size(); i++) {
            Vector<String> onlineIPVector = new Vector<String>();
            onlineIPVector.add(onlineIP.get(i));
            dtm.addRow(onlineIPVector);
          }
        }
      }

    } catch (IOException e) {
      e.printStackTrace();
    } catch (ClassNotFoundException e) {
      e.printStackTrace();
    }
  }