public void initPortParameters(SerialPort port){
  initialized=false;
  if (port != null) {
    cbPort.setSelectedItem(port.getName());
    cbBaudrate.setSelectedItem(String.valueOf(port.getBaudRate()));
    cbParity.setSelectedIndex(port.getParity());
    cbDataBits.setSelectedIndex(port.getDataBits() - 5);
    cbStopBits.setSelectedIndex(port.getStopBits() - 1);
    int prt=port.getFlowControlMode();
    cbProtocolRx.setSelectedIndex((prt & SerialPort.FLOWCONTROL_RTSCTS_IN) != 0 ? 1 : (prt & SerialPort.FLOWCONTROL_XONXOFF_IN) != 0 ? 2 : 0);
    cbProtocolTx.setSelectedIndex((prt & SerialPort.FLOWCONTROL_RTSCTS_OUT) != 0 ? 1 : (prt & SerialPort.FLOWCONTROL_XONXOFF_OUT) != 0 ? 2 : 0);
    btnDSR.setSelected(port.isDSR());
    btnCTS.setSelected(port.isCTS());
    btnCD.setSelected(port.isCD());
    btnDTR.setSelected(port.isDTR());
    btnRTS.setSelected(port.isRTS());
  }
  initialized=true;
}

public void initPortParameters ( SerialPort port ) { initialized = false ; if ( port != null ) { cbPort . setSelectedItem ( port . getName ( ) ) ; cbBaudrate . setSelectedItem ( String . valueOf ( port . getBaudRate ( ) ) ) ; cbParity . setSelectedIndex ( port . getParity ( ) ) ; cbDataBits . setSelectedIndex ( port . getDataBits ( ) - 5 ) ; cbStopBits . setSelectedIndex ( port . getStopBits ( ) - 1 ) ; int prt = port . getFlowControlMode ( ) ; cbProtocolRx . setSelectedIndex ( ( prt & SerialPort . FLOWCONTROL_RTSCTS_IN ) != 0 ? 1 : ( prt & SerialPort . FLOWCONTROL_XONXOFF_IN ) != 0 ? 2 : 0 ) ; cbProtocolTx . setSelectedIndex ( ( prt & SerialPort . FLOWCONTROL_RTSCTS_OUT ) != 0 ? 1 : ( prt & SerialPort . FLOWCONTROL_XONXOFF_OUT ) != 0 ? 2 : 0 ) ; btnDSR . setSelected ( port . isDSR ( ) ) ; btnCTS . setSelected ( port . isCTS ( ) ) ; btnCD . setSelected ( port . isCD ( ) ) ; btnDTR . setSelected ( port . isDTR ( ) ) ; btnRTS . setSelected ( port . isRTS ( ) ) ; } initialized = true ; }
initialize all port parameters port - & gt ; dialog
