public void onSessionChanged(SessionChangeEvent changeEvent) { Session5250 ses5250 = (Session5250) changeEvent.getSource(); SessionPanel ses = ses5250.getGUI(); switch (changeEvent.getState()) { case TN5250jConstants.STATE_REMOVE: closeSessionInternal(ses); break; } }
/** Component initialization */ private void jbInit() throws Exception { this.setSize(new Dimension(400, 300)); if (isSpecified("-L")) LangTool.init(parseLocale(getParameter("-L"))); else LangTool.init(); // Let's check some permissions try { System.getProperty(".java.policy"); } catch (SecurityException e) { e.printStackTrace(); TN5250jSecurityAccessDialog.showErrorMessage(e); return; } log = TN5250jLogFactory.getLogger(this.getClass()); Properties sesProps = new Properties(); log.info(" We have loaded a new one"); // Start loading properties - Host must exist sesProps.put(TN5250jConstants.SESSION_HOST, getParameter("host")); if (isSpecified("-e")) sesProps.put(TN5250jConstants.SESSION_TN_ENHANCED, "1"); if (isSpecified("-p")) { sesProps.put(TN5250jConstants.SESSION_HOST_PORT, getParameter("-p")); } // if (isSpecified("-f",args)) // propFileName = getParm("-f",args); if (isSpecified("-cp")) sesProps.put(TN5250jConstants.SESSION_CODE_PAGE, getParameter("-cp")); if (isSpecified("-gui")) sesProps.put(TN5250jConstants.SESSION_USE_GUI, "1"); if (isSpecified("-t")) sesProps.put(TN5250jConstants.SESSION_TERM_NAME_SYSTEM, "1"); if (isSpecified("-132")) sesProps.put(TN5250jConstants.SESSION_SCREEN_SIZE, TN5250jConstants.SCREEN_SIZE_27X132_STR); else sesProps.put(TN5250jConstants.SESSION_SCREEN_SIZE, TN5250jConstants.SCREEN_SIZE_24X80_STR); // socks proxy host argument if (isSpecified("-sph")) { sesProps.put(TN5250jConstants.SESSION_PROXY_HOST, getParameter("-sph")); } // socks proxy port argument if (isSpecified("-spp")) sesProps.put(TN5250jConstants.SESSION_PROXY_PORT, getParameter("-spp")); // check if device name is specified if (isSpecified("-dn")) sesProps.put(TN5250jConstants.SESSION_DEVICE_NAME, getParameter("-dn")); // are we to use a ssl and if we are what type if (isSpecified("-sslType")) { sesProps.put(TN5250jConstants.SSL_TYPE, getParameter("-sslType")); } loadSystemProperty("SESSION_CONNECT_USER"); loadSystemProperty("SESSION_CONNECT_PASSWORD"); loadSystemProperty("SESSION_CONNECT_PROGRAM"); loadSystemProperty("SESSION_CONNECT_LIBRARY"); loadSystemProperty("SESSION_CONNECT_MENU"); manager = SessionManager.instance(); final Session5250 s = manager.openSession(sesProps, "", "Test Applet"); final SessionPanel gui = new SessionPanel(s); // final JTerminal jt = new JTerminal(s); this.getContentPane().add(gui); s.connect(); SwingUtilities.invokeLater( new Runnable() { public void run() { // jt.grabFocus(); gui.grabFocus(); } }); }