📄 main.java
字号:
/* * Copyright (c) 2000 Lyrisoft Solutions, Inc. * Used by permission */package com.lyrisoft.chat.client;import com.lyrisoft.chat.Translator;import com.lyrisoft.chat.server.local.*;import com.lyrisoft.chat.client.gui.IChatGUIFactory;import java.io.IOException;import java.util.Properties;/** * Main class for standalone-client execution. * Command-line args: [host] [port] * * Immediately instantiates a new Client object, which gets the client going */public class Main { public static void main(String[] args) { String host = null; int port = 0; try { host = args[0]; port = Integer.parseInt(args[1]); } catch (Exception e) { showUsageAndQuit(); } IChatGUIFactory factory = null; UserCommands userCommands = null; CommandProcessorLocal commandProcessor = null; Client client = new Client(host, port); try { String guiFactoryName = System.getProperty("guiFactory", "com.lyrisoft.chat.client.gui.awt102.GUIFactory"); factory = (IChatGUIFactory)Class.forName(guiFactoryName).newInstance(); Properties p = client.getProperties("commandProcessors.properties"); if (p != null) { commandProcessor = new CommandProcessorLocal(p); } else { throw new Exception("Could not load commandProcessors.properties"); } p = client.getProperties("userCommands.properties"); if (p != null) { userCommands = new UserCommands(p); } else { throw new Exception("Could not load userCommands.properties"); } p = client.getProperties("messages.properties"); initTranslator(p); } catch (Exception e) { e.printStackTrace(); System.exit(1); } client.setAttribute("guiFactory", factory); client.setAttribute("userCommands", userCommands); client.setAttribute("commandProcessor", commandProcessor); client.init(); client.getGUI().showLogin(); } protected static void initTranslator(Properties p) { Translator.init(p); } static void showUsageAndQuit() { System.err.println("usage: java com.lyrisoft.chat.client.Main host port"); System.exit(1); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -