fileexchangeapplication.java

来自「JAVA Servlet2.3外文书籍源码」· Java 代码 · 共 62 行

JAVA
62
字号
package firewall.client;

import java.awt.*;
import java.awt.event.*;

import javax.swing.*;

import java.net.URL;
import java.net.MalformedURLException;

/**
 * Title:        FileExchange
 * Description:  The main driver class for the application client side
 * Copyright:    Copyright (c) 2001
 * Company:
 * @author Andrew Harbourne-Thomas
 * @version 1.0
 */
public class FileExchangeApplication {

  /**
   * Private to avoid instantiation - class is not designed to be instantiated
   */
  private FileExchangeApplication() {}

  /**
   * Main method essentially runs the client side by instantiating the
   *
   * @param args First parameter (if necessary) will identify the server
   *        address, including port, to be used
   */
  public static void main(String[] args) {
    URL server;
    //setup url to access servlet on server
    try {
      if (args.length > 0) {
        server = new URL(args[0] + "/httpServlet/servlet/firewall.server.FileExchangeServlet");//@@
      }
      else {
        server = new URL("http://localhost:8080/httpServlet/servlet/firewall.server.FileExchangeServlet");//@@
      }
    }
    catch (MalformedURLException mue) {
      System.out.println("Error in using FileExchangeApp");
      System.out.println("Usage:\n  java firewall.client.FileExchangeApp [ServletURL]");
      mue.printStackTrace();
      return;
    }

    //setup the application gui
    JFrame frame = new FileExchangeView(server, "File Exchange Application");

    frame.addWindowListener(new WindowAdapter() {
      public void windowClosing(WindowEvent e) {
        System.exit(0);
      }
    });

    frame.pack();
    frame.setVisible(true);
  }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?