public AppFrame() {
    GlobalData.oFrame = this;
    setSize(this.width, this.height);

    this.toolkit = Toolkit.getDefaultToolkit();
    this.tracker = new MediaTracker(this);

    String sHost = "";
    try {
      localAddr = InetAddress.getLocalHost();
      if (localAddr.isLoopbackAddress()) {
        localAddr = LinuxInetAddress.getLocalHost();
      }
      sHost = localAddr.getHostAddress();
    } catch (UnknownHostException ex) {
      sHost = "Error finding local IP.";
    }

    this.textLines[0] = "The RemoteDroid server application is now running.";
    this.textLines[1] = "";
    this.textLines[2] = ("Your IP address is: " + sHost);
    this.textLines[3] = "";
    this.textLines[4] = "Enter this IP address on the start screen of the";
    this.textLines[5] = "RemoteDroid application on your phone to begin.";
  }
示例#2
0
  public AppFrame() {
    super();
    GlobalData.oFrame = this;
    this.setSize(this.width, this.height);
    this.toolkit = Toolkit.getDefaultToolkit();

    Dimension w = toolkit.getScreenSize();
    int fx = (int) w.getWidth();
    int fy = (int) w.getHeight();

    int wx = (fx - this.width) / 2;
    int wy = (fy - this.getHeight()) / 2;

    setLocation(wx, wy);

    this.tracker = new MediaTracker(this);
    String sHost = "";
    try {

      localAddr = InetAddress.getLocalHost();
      if (localAddr.isLoopbackAddress()) {
        localAddr = LinuxInetAddress.getLocalHost();
      }
      sHost = localAddr.getHostAddress();
    } catch (UnknownHostException ex) {
      sHost = "你的IP地址错误";
    }
    //
    this.textLines[0] = "服务器正在运行.";
    this.textLines[1] = "";
    this.textLines[2] = "你的IP地址: " + sHost;
    this.textLines[3] = "";
    this.textLines[4] = "请打开你的手机客户端";
    this.textLines[5] = "";
    this.textLines[6] = "输入屏幕上显示的IP地址.";
    //
    try {
      URL fileURL = this.getClass().getProtectionDomain().getCodeSource().getLocation();
      String sBase = fileURL.toString();
      if ("jar".equals(sBase.substring(sBase.length() - 3, sBase.length()))) {
        jar = new JarFile(new File(fileURL.toURI()));

      } else {
        basePath = System.getProperty("user.dir") + "\\res\\";
      }
    } catch (Exception ex) {
      this.textLines[1] = "exception: " + ex.toString();
    }
  }