Beispiel #1
0
  @Override
  public void run() {
    try {

      Object obj = null;

      while ((obj = ois.readObject()) != null) {
        if (obj instanceof String) {
          // clientUI.txtChat.append((String)obj + "\n");
          try {
            clientUI.doc.insertString(
                clientUI.doc.getLength(), (String) obj + "\n", clientUI.sc.getStyle("MainSytle"));
          } catch (BadLocationException e) {
            e.printStackTrace();
          }
        } else if (obj instanceof String[]) {
          String[] str = (String[]) obj;
          List<String> l = clientUI.lstConnector.getSelectedValuesList(); // 선택되어 있던 명단을 기억

          clientUI.listModel.clear(); // 현재 리스트 목록 삭제
          int[] indices = new int[l.size()];
          for (int i = 0; i < indices.length; i++) indices[i] = -1;
          int index = 0;
          for (int i = 0; i < str.length; i++) {
            clientUI.listModel.addElement(str[i]);
            for (String s : l) if (s.equals(str[i])) indices[index++] = i; // connector				
          }
          clientUI.lstConnector.setSelectedIndices(indices); // 선택되어 있던 명단을 복원하여 다시 선택 상태로 전환
        } else if (obj instanceof ImageIcon) {
          showImage(obj);
        }
        clientUI.endScroll();
      }

    } catch (IOException | ClassNotFoundException e) {
      e.getMessage();
    }
  }
 private void logoutActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_logoutActionPerformed
   // TODO add your handling code here:
   dispose();
   ClientUI.main();
 } // GEN-LAST:event_logoutActionPerformed