Exemplo n.º 1
0
 public void cutScore(String whom) {
   try {
     out88.writeUTF("减分");
     out88.flush();
     out88.writeUTF("");
   } catch (IOException e) {
     e.printStackTrace();
   }
 }
Exemplo n.º 2
0
 public void addScore() {
   try {
     out88.writeUTF("加分");
     out88.flush();
     out88.writeUTF("");
   } catch (IOException e) {
     e.printStackTrace();
   }
 }
Exemplo n.º 3
0
  // Function use to Save Records to File After Deleting the Record of User Choice.
  void deleteFile() {

    try {
      FileOutputStream fos = new FileOutputStream("Bank.dat");
      DataOutputStream dos = new DataOutputStream(fos);
      if (records != null) {
        for (int i = 0; i < total; i++) {
          for (int r = 0; r < 6; r++) {
            dos.writeUTF(records[i][r]);
            if (records[i][r] == null) break;
          }
        }
        JOptionPane.showMessageDialog(
            this,
            "Record has been Deleted Successfuly.",
            "BankSystem - Record Deleted",
            JOptionPane.PLAIN_MESSAGE);
        txtClear();
      } else {
      }
      dos.close();
      fos.close();
    } catch (IOException ioe) {
      JOptionPane.showMessageDialog(
          this,
          "There are Some Problem with File",
          "BankSystem - Problem",
          JOptionPane.PLAIN_MESSAGE);
    }
  }
Exemplo n.º 4
0
  public void nick_name(String msg) {
    try {
      String name = msg.substring(13);
      this.setName(name);
      Vector v = father.onlineList;
      boolean isRepeatedName = false;
      int size = v.size();
      for (int i = 0; i < size; i++) {
        ServerAgentThread tempSat = (ServerAgentThread) v.get(i);
        if (tempSat.getName().equals(name)) {
          isRepeatedName = true;
          break;
        }
      }
      if (isRepeatedName == true) {
        dout.writeUTF("<#NAME_REPEATED#>");
        din.close();
        dout.close();
        sc.close();
        flag = false;
      } else {
        v.add(this);
        father.refreshList();
        String nickListMsg = "";
        StringBuilder nickListMsgSb = new StringBuilder();
        size = v.size();
        for (int i = 0; i < size; i++) {
          ServerAgentThread tempSat = (ServerAgentThread) v.get(i);
          nickListMsgSb.append("!");
          nickListMsgSb.append(tempSat.getName());
        }
        nickListMsgSb.append("<#NICK_LIST#>");
        nickListMsg = nickListMsgSb.toString();
        Vector tempv = father.onlineList;
        size = tempv.size();
        for (int i = 0; i < size; i++) {
          ServerAgentThread tempSat = (ServerAgentThread) tempv.get(i);
          tempSat.dout.writeUTF(nickListMsg);
          if (tempSat != this) {
            tempSat.dout.writeUTF("<#MSG#>" + this.getName() + "is now online....");
          }
        }
      }

    } catch (IOException e) {
      e.printStackTrace();
    }
  }
Exemplo n.º 5
0
  public void run() {
    String objRouter = applet.getParameter("name");
    // No Internationalisation
    try {
      ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
      DataOutputStream outp = new DataOutputStream(byteStream);
      outp.writeInt(GenericConstants.ROUTER_PROPERTIES);
      outp.writeUTF(objRouter);
      outp.flush();

      byte[] bytes = byteStream.toByteArray();
      outp.close();
      byteStream.reset();
      byteStream.close();
      byte[] data = GenericSession.getInstance().syncSend(bytes);
      if (data != null) {
        DataInputStream inp = new DataInputStream(new ByteArrayInputStream(data));
        int reqId = inp.readInt();
        if (reqId == GenericConstants.ROUTER_PROPERTIES) {
          int length = inp.readInt();
          byte serverData[] = new byte[length];
          inp.readFully(serverData);
          routerobject = NmsClientUtil.deSerializeVector(serverData);
        }

        init();
        refresh();
        super.setVisible(true);
      }
      /*init();
      refresh();
      super.setVisible(true);*/

      else close();

    } catch (Exception e) {
      // NmsClientUtil.err(NmsClientUtil.getFrame(app),"IO Error sending request to server.
      // "+e);//No Internationalisation
    }
  }
Exemplo n.º 6
0
 public void send(String str) throws IOException {
   DataOutputStream dos = new DataOutputStream(s.getOutputStream());
   dos.writeUTF(str);
 }