⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 administrativelogin.java

📁 这是一个用java和xml编写的流媒体服务器管理软件
💻 JAVA
字号:
/* * ==================================================================== * The Class Description  * Version:  1.0.0 * Date:     11/08/2005 * Author:   Xing.zhou * Function: Administrator or User login screen  *  * ==================================================================== *  */package vocal.ui;import java.awt.BorderLayout;import java.awt.Dimension;import java.awt.Toolkit;import java.io.DataInputStream;import java.net.InetAddress;import java.net.UnknownHostException;import javax.swing.JApplet;import javax.swing.JFrame;import javax.swing.JOptionPane;import vocal.comm.VPPException;import vocal.comm.VPPTransactionWrapper;public class AdministrativeLogin extends JApplet{  boolean isStandalone = false;  boolean state = false;		//current status is application or applet  String hostName;  static String ServerIp;  int portNumber;  AdministrativeLoginPanel panel;  private static VPPTransactionWrapper connection = null;  // Get a parameter value  public String getParameter(String key, String def)  {    return isStandalone ? System.getProperty(key, def)            : (getParameter(key) != null ? getParameter(key) : def);  }  // Initialize the applet  public void init()  {  	  //isStandalone = false;      String javaVersion = java.lang.System.getProperty("java.version").substring(0,3);      //System.out.println(javaVersion);      if(javaVersion.compareTo("1.4") < 0)      {	  if(isStandalone)	  {	      System.err.println("This program requires Java JRE 1.4 or higher to run.\n");	  }	  else	  {	      JOptionPane.showMessageDialog(this, 					    "This program requires Java JRE 1.4 or higher.\n",					    "ERROR",					    JOptionPane.ERROR_MESSAGE);	  }	  connection = null;	  return;      }      //System.out.println(isStandalone);      if (false == isStandalone)      {    	      	  state = isStandalone;      }      else      {    	      	  state = !isStandalone;      }      System.out.println(state);      if (state)      {    	  // this applet is buggy!    	  JOptionPane.showMessageDialog(this, 					"This applet does not work in the applet context due to applet permissions problems.\n" +					"Please see http://bugzilla.vovida.org/bugzilla/show_bug.cgi?id=579 for details\n", 					"ERROR",					JOptionPane.ERROR_MESSAGE);    	  connection = null;    	  return;      }      else      {    	  try    	  {    		  hostName = this.getParameter("host", "192.168.1.39");    		  //hostName = this.getParameter("host", ServerIp);    		      	  }    	  catch (Exception e)    	  {    		  e.printStackTrace();    	  }    	  try    	  {    		  portNumber = Integer.parseInt(this.getParameter("port", "6005"));    	  }    	  catch (Exception e)    	  {    		  e.printStackTrace();    	  }    	  try    	  {    		  connection = new VPPTransactionWrapper(hostName, portNumber);    	  }    	  catch (VPPException e)    	  {    		  System.out.println("Could not open connection to pserver");    		  e.printStackTrace();    		  JOptionPane.showMessageDialog(this,     				  "Could not open connection to pserver because: \n" + e,     				  "ERROR", JOptionPane.ERROR_MESSAGE);    		  return;    	  }    	  panel = new AdministrativeLoginPanel(isStandalone, connection,     			  getRootPane());    	  getContentPane().add(panel);      }  }  public String[][] getParameterInfo()  {    String[][] pinfo =     {      {        "host", "String", "Host name of machine running pserver"      },       {        "port", "int", "Port number of pserver"      },     };    return pinfo;  }  // Main method  public static void main(String[] args)  {  	/*    if (args.length < 2)    {      System.out.println("Usage:");      System.out.println("  AdministrativeLogin host port");      return;    }    	*/ 	  try	  {		 //得到本机的IP	    InetAddress address=InetAddress.getLocalHost();		    ServerIp = (String)address.getHostAddress();	    System.out.println(ServerIp);      } 	  catch(UnknownHostException e)	  {		  System.out.println("counld not find.");	  }  	         //System.setProperty("host", ServerIp);    System.setProperty("host", "192.168.1.39");    System.setProperty("port", "6005");    AdministrativeLogin applet = new AdministrativeLogin();    applet.state = true;    applet.isStandalone = true;    JFrame frame = new JFrame();    // EXIT_ON_CLOSE == 3    frame.setDefaultCloseOperation(3);    frame.setTitle("Extend Multimedia Server");    applet.init();    if (connection == null)    {	System.exit(-1);    }    applet.panel = new AdministrativeLoginPanel(applet.isStandalone,             applet.connection, frame.getRootPane());    vocal.util.Logger.log("Test log message");    applet.start();    frame.getContentPane().add(applet.panel, BorderLayout.CENTER);    frame.pack();           Dimension d = Toolkit.getDefaultToolkit().getScreenSize();    frame.setLocation((d.width - frame.getSize().width) / 2,                       (d.height - frame.getSize().height) / 2);    frame.setVisible(true);    frame.setResizable(false);  }  public static VPPTransactionWrapper getConnection()  {    return connection;  }}

⌨️ 快捷键说明

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