Ejemplo n.º 1
2
 private final void socketrun() {
   do {
     if (link.socketport != 0) {
       try {
         Socket socket =
             new Socket(InetAddress.getByName(getCodeBase().getHost()), link.socketport);
         socket.setSoTimeout(30000);
         socket.setTcpNoDelay(true);
         link.s = socket;
       } catch (Exception _ex) {
         link.s = null;
       }
       link.socketport = 0;
     }
     if (link.runme != null) {
       Thread thread = new Thread(link.runme);
       thread.setDaemon(true);
       thread.start();
       link.runme = null;
     }
     if (link.iplookup != null) {
       String s = "unknown";
       try {
         s = InetAddress.getByName(link.iplookup).getHostName();
       } catch (Exception _ex) {
       }
       link.host = s;
       link.iplookup = null;
     }
     try {
       Thread.sleep(100L);
     } catch (Exception _ex) {
     }
   } while (true);
 }
 /** Implementation of Runnable interface. DO NOT access this method directly. */
 public void run() {
   GUIUtils.setAnimatedFrameIgnoreRepaint(
       true); // animated frames are updated by this thread so no need to repaint
   long sleepTime = delayTime;
   while (animationThread == Thread.currentThread()) {
     long currentTime = System.currentTimeMillis();
     for (int i = 0; i < stepsPerDisplay; i++) {
       doStep();
       stepCounter++;
       if (animationThread != Thread.currentThread()) {
         break; // check for stop condition
       } else {
         Thread.yield(); // give other threads a chance to run if needed
       }
     }
     org.opensourcephysics.display.GUIUtils.renderAnimatedFrames();
     // adjust the sleep time to try and achieve a constant animation rate
     // some VMs will hang if sleep time is less than 10
     sleepTime = Math.max(10, delayTime - (System.currentTimeMillis() - currentTime));
     try {
       Thread.sleep(sleepTime);
     } catch (InterruptedException ie) {
     }
   }
   GUIUtils.setAnimatedFrameIgnoreRepaint(
       false); // animated frames are updated by this thread so no need to repaint
 }
Ejemplo n.º 3
1
  @Override
  public void run() {
    // TODO Auto-generated method stub
    while (true) {
      try {
        Thread.sleep(100);
      } catch (Exception e) {
        // TODO: handle exception
      }
      //			判断每一粒子弹和每一辆敌人的坦克都是否有重合(击中)
      for (int i = 0; i < hero.bombs.size(); i++) {
        //				取出每个子弹
        Bomb myBomb = hero.bombs.get(i);
        //				子弹必须得存活才有判断的意义
        if (myBomb.isLive) {
          for (int j = 0; j < ets.size(); j++) {
            //						取出每辆坦克
            EnemyTank et = ets.get(j);
            if (et.isLive) {
              this.isHit(myBomb, et);
            }
          }
        }
      }

      this.repaint();
    }
  }
    public synchronized void run() {
      while (!m_quit) {
        // System.out.println("Sending statuspoller W!! ");
        try {
          if (m_cryoPanel != null && !m_paused) {
            if (initialDelay > 0) {
              Thread.sleep(initialDelay);
              initialDelay = 0;
            }
            if (dataCount == 0) {
              dataCount++;
              sendCommand(CMD_CLOCK);
              sendCommand(CMD_PARAMS);
            } else {
              dataCount++;
              sendCommand(CMD_CLOCK);
            }
            if (dataCount == dataUpdate) dataCount = 0;

            Thread.sleep(m_rate_ms);
          }
        } catch (InterruptedException ie) {
        }
      }
    }
Ejemplo n.º 5
0
  private static void GetProxy()
      throws InterruptedException, AWTException, UnsupportedFlavorException, IOException {
    Robot robot = new Robot();
    Thread.sleep(5000);
    for (int i = 1; i <= 50; ++i) {

      robot.keyPress(KeyEvent.VK_CONTROL);
      robot.keyPress(KeyEvent.VK_A);

      robot.keyRelease(KeyEvent.VK_CONTROL);
      robot.keyRelease(KeyEvent.VK_A);

      Thread.sleep(1000);
      robot.keyPress(KeyEvent.VK_CONTROL);
      robot.keyPress(KeyEvent.VK_C);
      robot.keyRelease(KeyEvent.VK_CONTROL);
      robot.keyRelease(KeyEvent.VK_C);

      Thread.sleep(500);
      Clipboard cb = Toolkit.getDefaultToolkit().getSystemClipboard();
      Transferable t = cb.getContents(null);
      String readText = (String) t.getTransferData(DataFlavor.stringFlavor);
      // System.out.println(readText);
      String filePath = "F:\\Proxys\\";
      String fileName = "proxy" + Integer.toString(i) + ".txt";
      writeFile(filePath, fileName, readText);
      robot.keyPress(KeyEvent.VK_CONTROL);
      robot.keyPress(KeyEvent.VK_TAB);
      robot.keyRelease(KeyEvent.VK_CONTROL);
      robot.keyRelease(KeyEvent.VK_TAB);
      Thread.sleep(1000);
    }
  }
Ejemplo n.º 6
0
  private static void openweb() throws InterruptedException, AWTException {
    Robot robot = new Robot();
    Thread.sleep(5000);

    String url = "http://www.freeproxylists.net/zh/?page=";
    Clipboard cb = Toolkit.getDefaultToolkit().getSystemClipboard();

    for (int i = 2; i <= 50; ++i) {
      String tUrl = url + Integer.toString(i);
      Transferable t = new StringSelection(tUrl);
      cb.setContents(t, null);
      robot.keyPress(KeyEvent.VK_CONTROL);
      robot.keyPress(KeyEvent.VK_T);
      robot.keyRelease(KeyEvent.VK_CONTROL);
      robot.keyRelease(KeyEvent.VK_T);
      Thread.sleep(1000);
      robot.keyPress(KeyEvent.VK_CONTROL);
      robot.keyPress(KeyEvent.VK_V);
      robot.keyRelease(KeyEvent.VK_CONTROL);
      robot.keyRelease(KeyEvent.VK_V);
      Thread.sleep(1000);
      robot.keyPress(KeyEvent.VK_ENTER);
      robot.keyRelease(KeyEvent.VK_ENTER);
      Thread.sleep(1000);
    }
  }
 @Override
 public void run() {
   while (true) {
     try {
       CompareImages ci =
           new CompareImages(
               Bot.get_screen(),
               Variables.disconnect,
               Variables.disconnectStart,
               Variables.disconnectFinish,
               new ArrayList<>(),
               0.1f);
       ci.compare();
       if (ci.result() != null) {
         System.out.println("DISCONNECT");
         Variables.needToWait.set(true);
         try {
           Thread.sleep(Variables.sleepAfterDisconnect + 10000);
         } catch (InterruptedException e) {
         }
       }
     } catch (AWTException e) {
     }
     try {
       Thread.sleep(1000);
     } catch (InterruptedException e) {
     }
   }
 }
Ejemplo n.º 8
0
    public void run() {
      try {
        if (myPreviousThread != null) myPreviousThread.join();
        Thread.sleep(delay);
        log("> run MouseMoveThread " + x + ", " + y);
        while (!hasFocus()) {
          Thread.sleep(1000);
        }
        int x1 = lastMouseX;
        int x2 = x;
        int y1 = lastMouseY;
        int y2 = y;
        // shrink range by 1 px on both ends
        // manually move this 1px to trip DND code
        if (x1 != x2) {
          int dx = x - lastMouseX;
          if (dx > 0) {
            x1 += 1;
            x2 -= 1;
          } else {
            x1 -= 1;
            x2 += 1;
          }
        }
        if (y1 != y2) {
          int dy = y - lastMouseY;
          if (dy > 0) {
            y1 += 1;
            y2 -= 1;
          } else {
            y1 -= 1;
            y2 += 1;
          }
        }
        robot.setAutoDelay(Math.max(duration / 100, 1));
        robot.mouseMove(x1, y1);
        int d = 100;
        for (int t = 0; t <= d; t++) {
          x1 =
              (int)
                  easeInOutQuad(
                      (double) t, (double) lastMouseX, (double) x2 - lastMouseX, (double) d);
          y1 =
              (int)
                  easeInOutQuad(
                      (double) t, (double) lastMouseY, (double) y2 - lastMouseY, (double) d);
          robot.mouseMove(x1, y1);
        }
        robot.mouseMove(x, y);
        lastMouseX = x;
        lastMouseY = y;
        robot.waitForIdle();
        robot.setAutoDelay(1);
      } catch (Exception e) {
        log("Bad parameters passed to mouseMove");
        e.printStackTrace();
      }

      log("< run MouseMoveThread");
    }
Ejemplo n.º 9
0
  public void actionPerformed(ActionEvent evt) {

    if (evt.getSource() == Rubric) {
      Rubric.setLabel("Loading...");
      try {
        Thread.sleep((1000));

      } catch (InterruptedException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
      removeAll();

      @SuppressWarnings("unused")
      RubricEditor_GUI RE = new RubricEditor_GUI();

    } else if (evt.getSource() == GradeSheet) {

      // Change the text on the button for fun
      GradeSheet.setLabel("Loading...");
      try {
        Thread.sleep((1000));
      } catch (InterruptedException e) {

        e.printStackTrace();
      }
      removeAll();

      @SuppressWarnings("unused")
      GradeSheetEditor_GUI GSE = new GradeSheetEditor_GUI();
    }
  }
Ejemplo n.º 10
0
  private static BibEntry downloadEntryBibTeX(String id, boolean downloadAbstract) {
    try {
      URL url =
          new URL(
              ACMPortalFetcher.START_URL
                  + ACMPortalFetcher.BIBTEX_URL
                  + id
                  + ACMPortalFetcher.BIBTEX_URL_END);
      URLConnection connection = url.openConnection();

      // set user-agent to avoid being blocked as a crawler
      connection.addRequestProperty(
          "User-Agent", "Mozilla/5.0 (Windows NT 5.1; rv:31.0) Gecko/20100101 Firefox/31.0");
      Collection<BibEntry> items = null;
      try (BufferedReader in =
          new BufferedReader(new InputStreamReader(connection.getInputStream()))) {
        items = BibtexParser.parse(in).getDatabase().getEntries();
      } catch (IOException e) {
        LOGGER.info("Download of BibTeX information from ACM Portal failed.", e);
      }
      if ((items == null) || items.isEmpty()) {
        return null;
      }
      BibEntry entry = items.iterator().next();
      Thread.sleep(
          ACMPortalFetcher.WAIT_TIME); // wait between requests or you will be blocked by ACM

      // get abstract
      if (downloadAbstract) {
        url = new URL(ACMPortalFetcher.START_URL + ACMPortalFetcher.ABSTRACT_URL + id);
        String page = Util.getResults(url);
        Matcher absM = ACMPortalFetcher.ABSTRACT_PATTERN.matcher(page);
        if (absM.find()) {
          entry.setField("abstract", absM.group(1).trim());
        }
        Thread.sleep(
            ACMPortalFetcher.WAIT_TIME); // wait between requests or you will be blocked by ACM
      }

      return entry;
    } catch (NoSuchElementException e) {
      LOGGER.info(
          "Bad BibTeX record read at: "
              + ACMPortalFetcher.BIBTEX_URL
              + id
              + ACMPortalFetcher.BIBTEX_URL_END,
          e);
      return null;
    } catch (MalformedURLException e) {
      LOGGER.info("Malformed URL.", e);
      return null;
    } catch (IOException e) {
      LOGGER.info("Cannot connect.", e);
      return null;
    } catch (InterruptedException ignored) {
      return null;
    }
  }
Ejemplo n.º 11
0
 static void blinkMenu(final Selectable selectable) {
   if (!animationsEnabled()) return;
   try {
     selectable.paintSelected(false);
     Thread.sleep(MENU_BLINK_DELAY);
     selectable.paintSelected(true);
     Thread.sleep(MENU_BLINK_DELAY);
   } catch (final InterruptedException ignored) {
   }
 }
 /**
  * This method is what makes Baron's health decrease over a certain period of time. It is
  * programmed such that the lower the difficulty, the lower the rate Baron's health decreases
  * making it easier to smite.
  */
 public void run() {
   try {
     while (baronHealth > 0) {
       hp();
       if (difficulty == 1) Thread.sleep(1000);
       else if (difficulty == 2) Thread.sleep(600);
       else if (difficulty == 3) Thread.sleep(350);
       else if (difficulty == 4) Thread.sleep(200);
     }
   } catch (Exception e) {
   }
 }
Ejemplo n.º 13
0
  public void appear(final CardGui card) {
    moving = card;
    player1.animations.add(moving);
    Thread t =
        new Thread(
            () -> {
              moving.setBounds(925 - 62, 609 - 93, 0, 0);
              int i = 0, j = 0;
              while (i <= 124 || j <= 186) {
                try {
                  if (i <= 124) {
                    i++;
                    moving.setBounds(925 - 62, 609 - 93, i, j);
                    Thread.sleep(1);
                  }
                  if (j <= 186) {
                    j++;
                    moving.setBounds(925 - 62, 609 - 93, i, j);

                    Thread.sleep(1);
                  }
                } catch (InterruptedException e) {
                  e.printStackTrace();
                }
              }
              i = 925 - 62;

              while (i >= 652) {
                i--;
                try {
                  Thread.sleep(1);
                } catch (InterruptedException e) {
                  e.printStackTrace();
                }
                moving.setLocation(i, 609 - 93);
              }

              player1.animations.remove(moving);
              player1.repairListeners(false);
              PlayGui.player.pdeck.textField.setText(
                  "cards left " + PlayGui.player.pdeck.Deck.cardsLeft());
              player1.cardDrawn = 1;
              PlayGui.player.pdeck.textField.repaint();
              setVisible(true);
              repaint();
            });
    t.start();
  }
Ejemplo n.º 14
0
  // Not sure about what happens if multiple of this test are
  //  instantiated in the same VM.  Being static (and using
  //  static vars), it aint gonna work.  Not worrying about
  //  it for now.
  public static void main(String args[]) throws InterruptedException {
    mainThread = Thread.currentThread();
    try {
      init();
    } catch (TestPassedException e) {
      // The test passed, so just return from main and harness will
      // interepret this return as a pass
      return;
    }
    // At this point, neither test pass nor test fail has been
    // called -- either would have thrown an exception and ended the
    // test, so we know we have multiple threads.

    // Test involves other threads, so sleep and wait for them to
    // called pass() or fail()
    try {
      Thread.sleep(sleepTime);
      // Timed out, so fail the test
      throw new RuntimeException("Timed out after " + sleepTime / 1000 + " seconds");
    } catch (InterruptedException e) {
      // The test harness may have interrupted the test.  If so, rethrow the exception
      // so that the harness gets it and deals with it.
      if (!testGeneratedInterrupt) throw e;

      // reset flag in case hit this code more than once for some reason (just safety)
      testGeneratedInterrupt = false;

      if (theTestPassed == false) {
        throw new RuntimeException(failureMessage);
      }
    }
  } // main
Ejemplo n.º 15
0
 private static void sleep(long milli) {
   try {
     Thread.sleep(milli);
   } catch (Exception ex) {
   }
   ;
 }
Ejemplo n.º 16
0
 public void run() {
   try {
     if (myPreviousThread != null) myPreviousThread.join();
     Thread.sleep(delay);
     log("> run MousePressThread");
     while (!hasFocus()) {
       Thread.sleep(1000);
     }
     robot.mousePress(mask);
     robot.waitForIdle();
   } catch (Exception e) {
     log("Bad parameters passed to mousePress");
     e.printStackTrace();
   }
   log("< run MousePressThread");
 }
Ejemplo n.º 17
0
 public void prompt(String msg, int delayMS) {
   try {
     Thread.sleep(delayMS);
   } catch (InterruptedException ie) {
   }
   prompt(msg);
 }
Ejemplo n.º 18
0
  public static void main(String[] args)
      throws ConfigException, InitializationException, InterruptedException {
    System.out.println("STARTED");

    config.load();
    Tray tray = Tray.getInstance();
    tray.registerProcess(tray.getClass().getSimpleName());
    tray.init("Everything is up to date.");

    // File imageFile = null;
    File imageFile = new File(config.getResDir() + File.separator + "logo48.png");
    tray.notify("hello asdas dasd dasd asd ", "test asdsad sd asd sa", imageFile);
    // tray.setStatus(Status.UPDATING);
    tray.addTrayEventListener(
        new TrayEventListener() {

          @Override
          public void trayEventOccurred(TrayEvent event) {
            System.out.println(event);
          }
        });
    tray.setStatusIcon(tray.getClass().getSimpleName(), StatusIcon.UPDATING);
    // System.out.println(FileUtil.showBrowseDirectoryDialog());

    Thread.sleep(5000);
  }
Ejemplo n.º 19
0
 public void fpsSetter() {
   try {
     Thread.sleep(fps / 1000);
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
Ejemplo n.º 20
0
  public void run() {
    MOVE_PREV = MOVE_DOWN;

    System.out.println("INIT!");
    map = new int[mapX][mapY];

    for (int i = 0; i < map.length; i++) {
      for (int j = 0; j < map[i].length; j++) {
        map[i][j] = 0;
      }
    }
    map[blockP.x][blockP.y] = 1;
    //    	map[0][20] = 1;

    StdDraw.setXscale(-1.0, 1.0);
    StdDraw.setYscale(-1.0, 1.0);

    // initial values

    // double vx = 0.015, vy = 0.023;     // velocity

    // main animation loop
    while (true) {

      drawGame();
      try {
        Thread.sleep(100);
      } catch (InterruptedException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
      movePrev();
    }
  }
Ejemplo n.º 21
0
  @Override
  protected Void doInBackground() throws Exception {
    Random random = new Random();
    int progress = 0;
    System.out.println("Start");
    // Initialize progress property.
    setProgress(0);
    while (progress < 100) {
      if (thread.length() == -1) {
        form.errorLabel.setText(thread.getURLString());
        break;
      }
      // Sleep for up to one second.
      try {
        Thread.sleep(random.nextInt(10));
      } catch (InterruptedException ignore) {
      }
      System.out.println(
          thread.numberOfBytes() + "----" + (thread.length() / 100) + "----" + progress);
      // Make random progress.
      if (thread.length() != 0 && (thread.numberOfBytes() / (thread.length() / 100) > progress)) {

        System.out.println("uvelichavame!" + progress);
        progress++;
        // progress =(int)(thread.numberBytes % (thread.length / 100));
        setProgress(Math.min(progress, 100));
      }
    }
    return null;
  }
Ejemplo n.º 22
0
 private void leuchten(JLabel label, String farbe) {
   try {
     if (!leuchten) {
       Thread.sleep(200);
       label.setIcon(new ImageIcon(farbe + "_0.png"));
       Thread.sleep(200);
       label.setIcon(new ImageIcon(farbe + "_1.png"));
       Thread.sleep(200);
       label.setIcon(new ImageIcon(farbe + "_0.png"));
       Thread.sleep(200);
       label.setIcon(new ImageIcon(farbe + "_1.png"));
       leuchten = true;
     }
   } catch (Exception e) {
   }
 }
Ejemplo n.º 23
0
  public void run() {
    while (true) {
      try {
        DatagramSocket ClientSoc = new DatagramSocket(ClinetPortNumber);
        String Command = "GET";

        byte Sendbuff[] = new byte[1024];
        Sendbuff = Command.getBytes();

        InetAddress ServerHost = InetAddress.getLocalHost();
        ClientSoc.send(new DatagramPacket(Sendbuff, Sendbuff.length, ServerHost, 5217));

        byte Receivebuff[] = new byte[1024];
        DatagramPacket dp = new DatagramPacket(Receivebuff, Receivebuff.length);
        ClientSoc.receive(dp);

        NewsMsg = new String(dp.getData(), 0, dp.getLength());
        System.out.println(NewsMsg);
        lblNewsHeadline.setText(NewsMsg);

        Thread.sleep(5000);
        ClientSoc.close();
      } catch (Exception ex) {
        ex.printStackTrace();
      }
    }
  }
Ejemplo n.º 24
0
  public SplashDemo() throws NullPointerException, IllegalStateException, IOException {
    super("SplashScreen demo");
    setSize(300, 200);
    setLayout(new BorderLayout());
    Menu m1 = new Menu("File");
    MenuItem mi1 = new MenuItem("Exit");
    m1.add(mi1);
    mi1.addActionListener(this);
    this.addWindowListener(closeWindow);

    MenuBar mb = new MenuBar();
    setMenuBar(mb);
    mb.add(m1);
    final SplashScreen splash = SplashScreen.getSplashScreen();
    if (splash == null) {
      System.out.println("SplashScreen.getSplashScreen() returned null");
      return;
    }
    Graphics2D g = splash.createGraphics();
    if (g == null) {
      System.out.println("g is null");
      return;
    }
    for (int i = 0; i < 100; i++) {
      renderSplashFrame(g, i);
      splash.update();
      try {
        Thread.sleep(90);
      } catch (InterruptedException e) {
      }
    }
    splash.close();
    setVisible(true);
    toFront();
  }
Ejemplo n.º 25
0
 public void sleep(long timeToSleep) {
   try {
     Thread.sleep(timeToSleep);
   } catch (InterruptedException e) {
     e.printStackTrace();
   }
 }
Ejemplo n.º 26
0
  private void tryToInitialize(int counter) {
    boolean existsCompatibleBrowser = getComponent() != null && isCompatible();
    synchronized (this) {
      initialized = existsCompatibleBrowser;
    }
    log.info(System.currentTimeMillis() + " initialized map: " + initialized);

    if (isInitialized()) {
      log.fine(System.currentTimeMillis() + " compatible, further initializing map");
      initializeAfterLoading();
      initializeBrowserInteraction();
      initializeCallbackListener();
      checkLocalhostResolution();
      checkCallback();
    } else {
      if (counter++ < 50) {
        log.info(System.currentTimeMillis() + " WAITING " + counter * 100 + " milliseconds");
        try {
          Thread.sleep(counter * 100);
        } catch (InterruptedException e) {
          // intentionally left empty
        }

        tryToInitialize(counter);
      }
    }
  }
Ejemplo n.º 27
0
 public void jButton12_actionPerformed(ActionEvent e) {
   List<TerminalInfoStruct> TerminalInfo = new LinkedList<TerminalInfoStruct>();
   List<DataContentStruct> DataContentInfo = new LinkedList<DataContentStruct>();
   for (int i = 0; i < 50; i++) {
     TerminalInfo.clear();
     DataContentInfo.clear();
     TerminalInfoStruct tis = new TerminalInfoStruct();
     int l = 91010001 + i;
     String s = Integer.toString(l);
     tis.TerminalAddress =
         ("" + s.substring(0, 4) + s.substring(6, 8) + s.substring(4, 6)).toCharArray();
     tis.TerminalCommType = 40;
     tis.TerminalProtocol = 80;
     TerminalInfo.add(tis);
     DataContentStruct dcs = new DataContentStruct();
     dcs.DataContentLength = txt_content.getText().length();
     dcs.DataContent = txt_content.getText().toCharArray();
     DataContentInfo.add(dcs);
     rtc.SendBatchToFep(
         Integer.parseInt(txt_AppID.getText()),
         TerminalInfo.size(),
         TerminalInfo,
         DataContentInfo,
         txt_gnm.getText().toCharArray(),
         0,
         0,
         0,
         0);
     try {
       Thread.sleep(1000);
     } catch (InterruptedException ex) {
     }
   }
 }
Ejemplo n.º 28
0
  /*This method runs the actual playing part of the game. It goes in a loop while game is true and constantly paints the game,
  requests the focus, checks for collisions, and checks if anyone won with a small delay. If game is false, it leaves the loop and the game is done.*/
  public void game() // constantly runs update and paint world
      {
    // Loops while game is true
    while (game) {
      // Paints the game
      paintGame();

      // Requests the focus for listening to key events
      window.requestFocus();

      // Checks if any player has collided with anything
      checkCollision();

      // Checks if any player has won
      checkWin();

      // Sleeps for SPEED milliseconds
      try {
        Thread.sleep(SPEED);
      } // delay
      catch (InterruptedException e) {
      }

      // Checks if window closed. If so, game is false
      if (!isVisible()) {
        game = false;
      }
    }

    // Makes the mode 5 so that it still stays on the game screen after game is done
    mode = 5;

    // Paints the game once more
    paintGame();
  }
Ejemplo n.º 29
0
 /**
  * Wait for a specified number of milliseconds before finishing. This provides an easy way to
  * specify a small delay which can be used when producing animations.
  *
  * @param milliseconds the number
  */
 public void wait(int milliseconds) {
   try {
     Thread.sleep(milliseconds);
   } catch (Exception e) {
     // ignoring exception at the moment
   }
 }
Ejemplo n.º 30
0
  public void jButton4_actionPerformed(ActionEvent e) {
    if (rtc != null) {
      boolean b =
          rtc.SendSelfDefinedMsg(
              Integer.parseInt(txt_AppID.getText()),
              txt_zdljdz.getText().toCharArray(),
              Integer.parseInt(txt_gyh.getText()),
              Integer.parseInt(txt_txfs.getText()),
              Integer.parseInt(txt_mlxh.getText()),
              txt_content.getText().length(),
              txt_content.getText().toCharArray(),
              0);
      try {
        Thread.sleep(1000);
      } catch (InterruptedException ex) {
      }
      rtc.SendSelfDefinedMsg(
          Integer.parseInt(txt_AppID.getText()) + 100,
          txt_zdljdz.getText().toCharArray(),
          Integer.parseInt(txt_gyh.getText()),
          Integer.parseInt(txt_txfs.getText()),
          Integer.parseInt(txt_mlxh.getText()),
          txt_content.getText().length(),
          txt_content.getText().toCharArray(),
          0);

      if (b) {
        System.out.println("send success!");
      } else {
        System.out.println("send fail!");
      }
    } else {
      System.out.println("no object,create it first");
    }
  }