baudot[theGUI.portsComboBox.getSelectedIndex()],
baudot[theGUI.baudComboBox.getSelectedIndex()],
	void connect() {		try {			// Open the specified serial port			CommPortIdentifier cpi = (CommPortIdentifier)portsIDmap.get(			theGUI.portsComboBox.getSelectedItem());			thePort = (SerialPort)cpi.open("JModem", 15*1000);			// Set the serial port parameters.			thePort.setSerialPortParams(				baudot[theGUI.portsComboBox.getSelectedIndex()],		// baud				theGUI.getDataBits() == 7 ?				SerialPort.DATABITS_7 : SerialPort.DATABITS_8,				SerialPort.STOPBITS_1,							// stop bits				theGUI.getParity());							// parity			thePort.setFlowControlMode(SerialPort.FLOWCONTROL_RTSCTS_IN &				SerialPort.FLOWCONTROL_RTSCTS_OUT);		} catch (PortInUseException pue) {			theGUI.err("Port in use: close other app, or use different port.");			return;		} catch (UnsupportedCommOperationException uoe) {			theGUI.err("Unsupported options error: try different settings");			return;		}		// Similar to "raw" mode: return when 1 or more chars available.		try {			thePort.enableReceiveThreshold(1);			if (!thePort.isReceiveThresholdEnabled()) {				theGUI.err("Could not set receive threshold");				disconnect();				return;			}			thePort.setInputBufferSize(buf.length);		} catch (UnsupportedCommOperationException ev) {			theGUI.err("Unable to set receive threshold in Comm API; port unusable.");			disconnect();			return;		}		// Get the streams		try {			serialInput = thePort.getInputStream();		} catch (IOException e) {			theGUI.err("Error getting input stream:\n" + e.toString());			return;		}		try {			serialOutput = thePort.getOutputStream();		} catch (IOException e) {			theGUI.err("Error getting output stream:\n" + e.toString());			return;		}		// Now that we're all set, create a Thread to read data from the remote		serialReadThread = new Thread(new Runnable() {		int nbytes = buf.length;			public void run() {				do {					try {						// If the xfer program is running, stay out of its way.							if (submode == S_XFER) {								delay(1000);							continue;						}						nbytes = serialInput.read(buf, 0, buf.length);					} catch (IOException ev) {					theGUI.err("Error reading from remote:\n" + ev.toString());					return;					}					// XXX need an appendChar() method in MyTextArea					String tmp = new String(buf, 0, nbytes);					theGUI.theTextArea.append(tmp);					theGUI.theTextArea.setCaretPosition(					theGUI.theTextArea.getText().length());				} while (serialInput != null);			}		});		serialReadThread.start();		// Finally, tell rest of program, and user, that we're online.		state = S_CONNECTED;		theGUI.connect();	}